-
Notifications
You must be signed in to change notification settings - Fork 145
chore: add MCP registry publishing #679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds MCP registry publication support to the MongoDB MCP Server project. It introduces a server.json configuration file for the MCP registry, creates a code generation script to keep environment variable documentation synchronized, and updates the CI/CD pipeline to publish to the registry.
Key Changes:
- Added MCP registry configuration file (
server.json) with environment variables and package arguments - Created automated script to generate environment variable definitions from Zod schema
- Updated publish workflow to include MCP registry publication step
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| server.json | New MCP registry configuration with environment variables and package arguments for npm and OCI packages |
| src/common/config.ts | Refactored UserConfig to use Zod schema with descriptions, enabling automated documentation generation |
| scripts/generateArguments.ts | New script to generate and sync environment variable definitions across server.json from config schema |
| package.json | Added mcpName field and generate:args script for documentation generation |
| Dockerfile | Added MCP server name label for registry identification |
| .github/workflows/publish.yml | Updated workflow to generate arguments, install MCP publisher, and publish to registry |
.github/workflows/publish.yml
Outdated
| run: brew install mcp-publisher | ||
|
|
||
| - name: Login to MCP Registry | ||
| run: mcp-publisher login github-oidc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not too sure if this is going to work but seems worth trying
| @@ -0,0 +1,670 @@ | |||
| { | |||
| "$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json", | |||
| "name": "io.github.mongodb-js/mongodb-mcp-server", | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can either use io.github.mongodb-js and use GitHub Auth or mongodb.com and use DNS auth. the latter depends on a lot of external approvals I imagine so sticking to GitHub
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can also use an auth token, though OIDC publishing will also be great to adopt for NPM in the future: https://github.blog/changelog/2025-07-31-npm-trusted-publishing-with-oidc-is-generally-available/
| /** | ||
| * This script generates environment variable definitions and updates: | ||
| * - server.json environmentVariables arrays | ||
| * - TODO: README.md configuration table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needed some extra handling but will be great to have in the future.
| vectorSearchDimensions: number; | ||
| vectorSearchSimilarityFunction: Similarity; | ||
| } | ||
| export const UserConfigSchema = z.object({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to turn this into a single source of truth for our arguments. This should be useful in the future, including for runtime validation.
| loggers: z | ||
| .array(z.enum(["stderr", "disk", "mcp"])) | ||
| .default(["disk", "mcp"]) | ||
| .describe("Comma separated values, possible values are 'mcp', 'disk' and 'stderr'."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description doesn't seem to match the type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah these are copied over from README.md but the schema were created with (eventual) validation in mind. Definitely a confusing setup the way it is, so will remove all the descriptions for now since I dropped my bonus goal to get this to handle README.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So... I think for the time being this is fine, this isn't something we're consuming yet and as far as user-facing description and program-facing validation, it still makes sense.
In the future we should adopt https://zod.dev/metadata and have multiple fields to define this. This needs a Zod version bump otherwise I'd use it now
ed41cc3 to
e42a448
Compare
src/common/config.ts
Outdated
| httpHeaders: z | ||
| .record(z.string()) | ||
| .describe( | ||
| "Custom HTTP headers to include in responses from the HTTP server (only used when transport is 'http'). Useful for adding CORS headers, authentication tokens, or other custom headers required by your client application." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this accurate? my interpretation of when one would use this @nirinchev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, these are headers that the http server will validate when making requests. This is e.g. what we do for the auth header by the vscode extension.
.github/workflows/publish.yml
Outdated
| RELEASE_CHANNEL: ${{ steps.npm-tag.outputs.RELEASE_CHANNEL }} | ||
| steps: | ||
| - uses: GitHubSecurityLab/actions-permissions/monitor@v1 | ||
| - uses: mongodb-js/devtools-shared/actions/setup-bot-token@main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this in the wrong job?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it? seems to be the way we get the token everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're adding this to the check job, but seems like you're trying to use it in the publish job. Step outputs cannot be passed across jobs.
.github/workflows/publish.yml
Outdated
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
|
||
| - name: Update server.json version and arguments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this at least temporarily as the last step? I expect there may be rough edges in the first couple of runs, so don't want this failing to impact the other steps.
6ba4c47 to
a01db62
Compare
160fe40 to
97c7585
Compare
ece3085 to
5e82dc1
Compare
5e82dc1 to
d3b80f5
Compare
According to instructions in https://github.com/modelcontextprotocol/registry/blob/main/docs/guides/publishing/publish-server.md