Skip to content

Conversation

@chlowell
Copy link
Contributor

Closes #105 by adding an end-to-end test that uses publisher to publish examples from docs/server-json/examples.md to a live local registry so we can have some confidence that the examples are valid and publisher and registry work together.

sample output

Found 8 examples in "docs/server-json/examples.md"
Publishing example starting on line 6
  ✅ publisher output:
        2025/07/24 22:29:06 Using GitHub OAuth for authentication
        2025/07/24 22:29:06 {"id":"1f5ccc19-e83f-4023-b757-f3fdbcc782ab","message":"Server publication successful"}

        2025/07/24 22:29:06 Successfully published to registry!
  ✅ registry response matches example

...

published 8/8 examples
========== registry logs ==========
WARNING: "noauth" build tag has disabled authentication
2025/07/24 22:29:03 Starting MCP Registry Application v0.1.0 (commit: undefined)
2025/07/24 22:29:05 MongoDB database name: mcp-registry
2025/07/24 22:29:05 MongoDB collection name: servers_v2
2025/07/24 22:29:05 HTTP server starting on :8080

To make this possible in a local dev loop without modifying (much of) the registry's internals, I added a build tag that disables registry auth. Gating this feature behind a build tag makes it hard to enable accidentally and ensures the no-auth code doesn't exist in normal builds, and registry prints a warning when auth was disabled at build time. I also tweaked publisher to return a nonzero exit code when an operation fails.

Running the test exposed a bug fixed in this PR: a couple mongo operations used versiondetail in a key whereas the Server model uses version_detail.

I did a little reorganizing as well by moving the publish handler tests in /integrationtests, which rely on mocking internal implementations, into the existing unit test suite.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/database/mongo.go 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@chlowell chlowell marked this pull request as ready for review July 24, 2025 23:20
@chlowell chlowell requested review from tadasant and toby July 24, 2025 23:21
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The delta here is the tests from integrationtests/publish_integration_test.go, tweaked to use the slightly different mocks defined in this file

Copy link
Member

@tadasant tadasant left a comment

Choose a reason for hiding this comment

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

This is awesome, thank you! Looks great.

@chlowell chlowell merged commit 4f5e85b into modelcontextprotocol:main Jul 25, 2025
7 checks passed
@chlowell chlowell deleted the integration branch July 25, 2025 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automated test suite that covers publication of a range of server formats

3 participants