-
Notifications
You must be signed in to change notification settings - Fork 170
feat: add health check endpoint to mcp server #712
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
base: main
Are you sure you want to change the base?
feat: add health check endpoint to mcp server #712
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 a health check endpoint to the MCP server's HTTP transport layer to support container orchestration and monitoring systems. The endpoint is designed to be accessible without authentication.
Key changes:
- Added a
/healthGET endpoint that returns a JSON response with status and service information - Positioned the health endpoint before authentication middleware to ensure it's always accessible
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/transports/streamableHttp.ts | Implements the /health endpoint before authentication middleware |
| tests/integration/transports/streamableHttp.test.ts | Adds integration test verifying the health endpoint works without authentication |
|
Hey, thank you so much for this contribution! The code looks good to me, but we would need you to sign the MongoDB Contributor Agreement before we can merge it. |
|
it looks good to me π |
|
@ashwin-ranade let us know when you've signed https://www.mongodb.com/legal/contributor-agreement |
|
This PR has gone 30 days without any activity and meets the project's definition of "stale". This will be auto-closed if there is no new activity over the next 30 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy! |
Summary
Adds a simple
/healthendpoint that returns HTTP 200 for Kubernetes/Docker health checks.Motivation
Container orchestration platforms need a basic HTTP endpoint for readiness probes. The existing
/mcpendpoint expects MCP protocol requests and authentication, making it unsuitable for standard health checks.Changes
GET /healthendpoint returning{"status": "healthy", "service": "mongodb-mcp"}Testing
All existing tests pass (13/13 in streamableHttp test suite), including new health endpoint tests with and without custom headers configured.
Manual verification:
Run
mongodb-mcp-servervia Node:Verify health endpoint works by curl-ing it in a different terminal: