feat: custom endpoints#11
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements custom HTTP endpoint support for MCP servers, allowing developers to define REST-like endpoints alongside MCP protocol endpoints with Zod validation and automatic type inference.
Key Changes
- New
defineEndpoint()anddefinePermissionAwareEndpoint()helper functions for type-safe endpoint definitions - Zod-based validation for request body, query parameters, path parameters, and responses
- Permission-aware endpoint support that injects permission context into handlers
- Integration with both standard and permission-based MCP server transports
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/http/customEndpoints.ts |
Type definitions, interfaces, and helper functions for custom endpoints |
src/http/endpointRegistration.ts |
Core registration logic for custom endpoints with validation |
src/http/FastifyTransport.ts |
Integration with standard transport |
src/permissions/PermissionAwareFastifyTransport.ts |
Integration with permission-aware transport |
src/index.ts |
Public API exports for custom endpoint functionality |
src/server/createMcpServer.ts |
Bug fix to suppress expected "Not connected" errors |
tests/customEndpoints.test.ts |
Comprehensive unit tests (573 lines) |
tests/customEndpoints.integration.test.ts |
Integration tests with both server types (530 lines) |
examples/custom-endpoints-demo.ts |
Example demonstrating all features (557 lines) |
package-lock.json |
Dependency updates |
.npmrc |
npm registry configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.