diff --git a/.github/workflows/publish-mcp.yml b/.github/workflows/publish-mcp.yml new file mode 100644 index 00000000..3fee9ea5 --- /dev/null +++ b/.github/workflows/publish-mcp.yml @@ -0,0 +1,59 @@ +name: Publish to MCP Registry + +# Publishes server.json to the official MCP Registry (registry.modelcontextprotocol.io), +# which the GitHub MCP Registry (github.com/mcp) syncs from. +# +# Run this AFTER the PyPI package and GHCR image for the release exist — the registry +# validates both artifacts at publish time: +# 1. Tag + GitHub release -> Docker image published to GHCR (release-docker.yml) +# 2. Run "publish" workflow -> package published to PyPI (publish.yml) +# 3. Run this workflow -> server published to the MCP Registry + +on: + workflow_dispatch: + inputs: + ref: + description: "Tag to publish (e.g. v0.4.1)" + required: true + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + id-token: write # Required for OIDC authentication to the MCP Registry + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.ref }} + + - name: Set version in server.json from pyproject.toml + run: | + VERSION=$(grep -m1 '^version' pyproject.toml | sed 's/.*"\(.*\)"/\1/') + echo "Publishing version $VERSION" + jq --arg v "$VERSION" ' + .version = $v + | .packages |= map( + if .registryType == "pypi" then .version = $v + elif .registryType == "oci" then .identifier = (.identifier | sub(":[^:]*$"; ":" + $v)) + else . end) + ' server.json > server.json.tmp && mv server.json.tmp server.json + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + + - name: Verify PyPI package exists + run: curl -fsS "https://pypi.org/pypi/mcp-clickhouse/${VERSION}/json" > /dev/null + + - name: Verify GHCR image exists + run: docker manifest inspect "ghcr.io/clickhouse/mcp-clickhouse:${VERSION}" > /dev/null + + - name: Install mcp-publisher + run: | + curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher + + - name: Authenticate to MCP Registry + run: ./mcp-publisher login github-oidc + + - name: Publish server to MCP Registry + run: ./mcp-publisher publish diff --git a/Dockerfile b/Dockerfile index a60122b7..abba322b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,6 +34,7 @@ FROM python:3.13-slim-bookworm LABEL org.opencontainers.image.source="https://github.com/ClickHouse/mcp-clickhouse" LABEL org.opencontainers.image.description="MCP server for ClickHouse" LABEL org.opencontainers.image.licenses="Apache-2.0" +LABEL io.modelcontextprotocol.server.name="io.github.ClickHouse/mcp-clickhouse" # Set the working directory WORKDIR /app diff --git a/README.md b/README.md index 2358b4a3..7af49d9b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # ClickHouse MCP Server + + [![PyPI - Version](https://img.shields.io/pypi/v/mcp-clickhouse)](https://pypi.org/project/mcp-clickhouse) An MCP server for ClickHouse. diff --git a/server.json b/server.json new file mode 100644 index 00000000..f82e82c7 --- /dev/null +++ b/server.json @@ -0,0 +1,166 @@ +{ + "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", + "name": "io.github.ClickHouse/mcp-clickhouse", + "title": "ClickHouse", + "description": "Official ClickHouse MCP server for querying and exploring ClickHouse clusters and chDB.", + "version": "0.4.0", + "repository": { + "url": "https://github.com/ClickHouse/mcp-clickhouse", + "source": "github" + }, + "websiteUrl": "https://clickhouse.com", + "packages": [ + { + "registryType": "pypi", + "identifier": "mcp-clickhouse", + "version": "0.4.0", + "runtimeHint": "uvx", + "transport": { + "type": "stdio" + }, + "environmentVariables": [ + { + "name": "CLICKHOUSE_HOST", + "description": "Hostname of the ClickHouse server", + "isRequired": true + }, + { + "name": "CLICKHOUSE_USER", + "description": "Username for ClickHouse authentication", + "isRequired": true + }, + { + "name": "CLICKHOUSE_PASSWORD", + "description": "Password for ClickHouse authentication", + "isRequired": true, + "isSecret": true + }, + { + "name": "CLICKHOUSE_PORT", + "description": "ClickHouse HTTP(S) port. Defaults to 8443 when CLICKHOUSE_SECURE=true, 8123 otherwise", + "isRequired": false + }, + { + "name": "CLICKHOUSE_SECURE", + "description": "Use HTTPS to connect to ClickHouse", + "format": "boolean", + "default": "true", + "isRequired": false + }, + { + "name": "CLICKHOUSE_VERIFY", + "description": "Verify SSL certificates", + "format": "boolean", + "default": "true", + "isRequired": false + }, + { + "name": "CLICKHOUSE_DATABASE", + "description": "Default database to use", + "isRequired": false + }, + { + "name": "CLICKHOUSE_ROLE", + "description": "ClickHouse role to activate for the session", + "isRequired": false + }, + { + "name": "CLICKHOUSE_ALLOW_WRITE_ACCESS", + "description": "Allow write operations (DDL and DML). Queries run read-only by default", + "format": "boolean", + "default": "false", + "isRequired": false + }, + { + "name": "CLICKHOUSE_ALLOW_DROP", + "description": "Allow destructive operations (DROP, TRUNCATE) when write access is also enabled", + "format": "boolean", + "default": "false", + "isRequired": false + }, + { + "name": "CLICKHOUSE_MCP_QUERY_TIMEOUT", + "description": "Query tool timeout in seconds", + "format": "number", + "default": "30", + "isRequired": false + } + ] + }, + { + "registryType": "oci", + "identifier": "ghcr.io/clickhouse/mcp-clickhouse:0.4.0", + "transport": { + "type": "stdio" + }, + "environmentVariables": [ + { + "name": "CLICKHOUSE_HOST", + "description": "Hostname of the ClickHouse server", + "isRequired": true + }, + { + "name": "CLICKHOUSE_USER", + "description": "Username for ClickHouse authentication", + "isRequired": true + }, + { + "name": "CLICKHOUSE_PASSWORD", + "description": "Password for ClickHouse authentication", + "isRequired": true, + "isSecret": true + }, + { + "name": "CLICKHOUSE_PORT", + "description": "ClickHouse HTTP(S) port. Defaults to 8443 when CLICKHOUSE_SECURE=true, 8123 otherwise", + "isRequired": false + }, + { + "name": "CLICKHOUSE_SECURE", + "description": "Use HTTPS to connect to ClickHouse", + "format": "boolean", + "default": "true", + "isRequired": false + }, + { + "name": "CLICKHOUSE_VERIFY", + "description": "Verify SSL certificates", + "format": "boolean", + "default": "true", + "isRequired": false + }, + { + "name": "CLICKHOUSE_DATABASE", + "description": "Default database to use", + "isRequired": false + }, + { + "name": "CLICKHOUSE_ROLE", + "description": "ClickHouse role to activate for the session", + "isRequired": false + }, + { + "name": "CLICKHOUSE_ALLOW_WRITE_ACCESS", + "description": "Allow write operations (DDL and DML). Queries run read-only by default", + "format": "boolean", + "default": "false", + "isRequired": false + }, + { + "name": "CLICKHOUSE_ALLOW_DROP", + "description": "Allow destructive operations (DROP, TRUNCATE) when write access is also enabled", + "format": "boolean", + "default": "false", + "isRequired": false + }, + { + "name": "CLICKHOUSE_MCP_QUERY_TIMEOUT", + "description": "Query tool timeout in seconds", + "format": "number", + "default": "30", + "isRequired": false + } + ] + } + ] +}