Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 49 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
51 changes: 51 additions & 0 deletions server.json

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this only needed for the publish workflow, or does it also need to be as static content in the repo? Reason why I ask is that we would need to remember to change versions "version": "0.6.5" in server.json now. And if this is really only a file needed for the Github workflow, we might maybe just sed/replace the version in the JSON before running mcp-publisher

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's only needed for publish (at least I hope so, it would indeed be annoying to have to change it, although version bumps are done via CI so it might not be too bad). Our release CI is already doing the sed/replacing (using jq) so yeah maybe we just make it abundantly clear by setting it to $VERSION... good spot

Original file line number Diff line number Diff line change
@@ -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"
}
]
}
]
}