diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3650a78..bea8a27 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -9,11 +9,12 @@ on: permissions: contents: read - id-token: write jobs: docker: runs-on: ubuntu-latest + permissions: + id-token: write steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 @@ -31,3 +32,50 @@ jobs: latest ${{ steps.tag.outputs.version }} push: true + + mcp-registry: + runs-on: ubuntu-latest + needs: docker + permissions: + contents: read + id-token: write + steps: + - name: Checkout code + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Extract version from tag + id: version + run: | + # Get the tag from the triggering workflow + TAG=$(git describe --tags --exact-match HEAD 2>/dev/null || echo "") + if [ -z "$TAG" ]; then + echo "No tag found at HEAD" + exit 1 + fi + echo "VERSION=$TAG" >> $GITHUB_OUTPUT + + - name: Install dependencies + run: | + sudo apt-get update && sudo apt-get install -y jq + curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.2.3/mcp-publisher_1.2.3_linux_amd64.tar.gz" | tar xz mcp-publisher + chmod +x mcp-publisher + sudo mv mcp-publisher /usr/local/bin/ + + - name: Update server.json with Docker image + run: | + # Update the server.json with the correct Docker image reference + # (note the image tag does not include the "v" prefix) + jq --arg version "${{ steps.version.outputs.VERSION }}" \ + --arg image "grafana/mcp-grafana:${{ steps.version.outputs.VERSION#v }}" \ + '.packages[0].version = $version | + .packages[0].identifier = $image | + .version = $version' server.json > server.json.tmp + mv server.json.tmp server.json + + - name: Login to MCP Registry + run: mcp-publisher login github-oidc + + - name: Publish to MCP Registry + run: mcp-publisher publish diff --git a/Dockerfile b/Dockerfile index 90d7aec..9283e85 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Build stage FROM golang:1.24-bullseye AS builder -LABEL io.modelcontextprotocol.server.name="grafana/mcp-grafana" +LABEL io.modelcontextprotocol.server.name="io.github.grafana/mcp-grafana" # Set the working directory WORKDIR /app diff --git a/server.json b/server.json new file mode 100644 index 0000000..1247be2 --- /dev/null +++ b/server.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://static.modelcontextprotocol.io/schemas/2025-09-29/server.schema.json", + "name": "io.github.grafana/mcp-grafana", + "description": "An MCP server giving access to Grafana dashboards, data and more.", + "repository": { + "url": "https://github.com/grafana/mcp-grafana", + "source": "github" + }, + "version": "$VERSION", + "packages": [ + { + "registryType": "oci", + "registryBaseUrl": "https://docker.io", + "identifier": "grafana/mcp-grafana", + "version": "$VERSION", + "transport": { + "type": "stdio" + }, + "environmentVariables": [ + { + "description": "URL to your Grafana instance", + "isRequired": true, + "format": "string", + "isSecret": false, + "name": "GRAFANA_URL" + }, + { + "description": "Service account token used to authenticate with your Grafana instance", + "isRequired": false, + "format": "string", + "isSecret": true, + "name": "GRAFANA_SERVICE_ACCOUNT_TOKEN" + }, + { + "description": "Username to authenticate with your Grafana instance", + "isRequired": false, + "format": "string", + "isSecret": false, + "name": "GRAFANA_USERNAME" + }, + { + "description": "Password to authenticate with your Grafana instance", + "isRequired": false, + "format": "string", + "isSecret": true, + "name": "GRAFANA_PASSWORD" + } + ] + } + ] +}