From 557d01c72d695d7417c432cdd7c7230d462786a7 Mon Sep 17 00:00:00 2001 From: Henry Mao <1828968+calclavia@users.noreply.github.com> Date: Wed, 29 Jan 2025 02:02:07 +0800 Subject: [PATCH 1/3] Add Dockerfile --- Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8f440b4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile +# Use a Python image with uv pre-installed +FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS uv + +# Set the working directory +WORKDIR /app + +# Copy the project files to the container +COPY . . + +# Enable bytecode compilation +ENV UV_COMPILE_BYTECODE=1 + +# Copy from the cache instead of linking since it's a mounted volume +ENV UV_LINK_MODE=copy + +# Install the project's dependencies using the lockfile and settings +RUN --mount=type=cache,target=/root/.cache/uv \ + --mount=type=bind,source=uv.lock,target=uv.lock \ + --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ + uv sync --frozen --no-install-project --no-dev --no-editable + +# Then, add the rest of the project source code and install it +# Installing separately from its dependencies allows optimal layer caching +ADD . /app +RUN --mount=type=cache,target=/root/.cache/uv \ + uv sync --frozen --no-dev --no-editable + +FROM python:3.12-slim-bookworm + +WORKDIR /app + +COPY --from=uv /root/.local /root/.local +COPY --from=uv --chown=app:app /app/.venv /app/.venv + +# Place executables in the environment at the front of the path +ENV PATH="/app/.venv/bin:$PATH" + +# when running the container, add --db-path and a bind mount to the host's db file +ENTRYPOINT ["mcp-hn"] \ No newline at end of file From 9d22b6df499c988b30ab460398fd55ab534f641e Mon Sep 17 00:00:00 2001 From: Henry Mao <1828968+calclavia@users.noreply.github.com> Date: Wed, 29 Jan 2025 02:02:08 +0800 Subject: [PATCH 2/3] Add Smithery configuration --- smithery.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 smithery.yaml diff --git a/smithery.yaml b/smithery.yaml new file mode 100644 index 0000000..c511846 --- /dev/null +++ b/smithery.yaml @@ -0,0 +1,12 @@ +# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml + +startCommand: + type: stdio + configSchema: + # JSON Schema defining the configuration options for the MCP. + type: object + properties: {} + commandFunction: + # A function that produces the CLI command to start the MCP on stdio. + |- + (config) => ({ command: 'mcp-hn' }) \ No newline at end of file From 1fdb6e4596620849825e1027a4fbd52eab8f9556 Mon Sep 17 00:00:00 2001 From: Henry Mao <1828968+calclavia@users.noreply.github.com> Date: Wed, 29 Jan 2025 02:02:09 +0800 Subject: [PATCH 3/3] Update README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 2911538..7537444 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Hacker News MCP Server +[![smithery badge](https://smithery.ai/badge/mcp-hn)](https://smithery.ai/mcp-hn) + A Model Context Protocol (MCP) server that provides tools for fetching information from Hacker News. ## Tools @@ -35,6 +37,14 @@ User: Can you use the puppeteer tool to read the article about and also use ## Quickstart +### Installing via Smithery + +To install Hacker News MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/mcp-hn): + +```bash +npx -y @smithery/cli install mcp-hn --client claude +``` + ### Claude Desktop: Update the following: