-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add support for custom middleware in the correct order. #2026
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,9 @@ import ( | |||||||||
| ) | ||||||||||
|
|
||||||||||
| type InventoryFactoryFunc func(r *http.Request) (*inventory.Inventory, error) | ||||||||||
|
|
||||||||||
| // GitHubMCPServerFactoryFunc is a function type for creating a new MCP Server instance. | ||||||||||
| // middleware are applied AFTER the default GitHub MCP Server middlewares (like error context injection) | ||||||||||
|
||||||||||
| // middleware are applied AFTER the default GitHub MCP Server middlewares (like error context injection) | |
| // Custom middleware created via this factory will execute after the default GitHub MCP Server | |
| // middlewares (such as error context and dependency injection) have populated the request context, | |
| // allowing the custom middleware to read errors and dependencies set by the defaults. |
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.
Consider adding test coverage for the new middleware parameter to verify that custom middleware is executed in the correct order relative to the default middlewares (error context and deps injection). A test could verify that custom middleware can successfully read errors from the context that were set by tools/handlers, confirming the middleware chain works as intended.
This issue also appears on line 101 of the same file.