Repository navigation
fix(server-core): require auth for MCP execution routes under legacy auth #1564
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
Open
shu-chen-dot-ca
wants to merge
4
commits into
VoltAgent:main
Choose a base branch
from
shu-chen-dot-ca:fix-1493-mcp-legacy-auth-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+250
−7
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4a6aab4
fix(server-core): require auth for MCP execution routes under legacy …
shu-chen-dot-ca f2e4711
fix(server-core): match trailing-slash and HEAD requests in legacy auth
shu-chen-dot-ca 12a2d8e
test(server-elysia): cover authenticated and trailing-slash MCP tool …
shu-chen-dot-ca 04962d4
fix(server-core): keep HEAD and trailing-slash public routes matching…
shu-chen-dot-ca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| "@voltagent/server-core": patch | ||
| --- | ||
|
|
||
| fix(server-core): require authentication for MCP execution routes under legacy `auth` | ||
|
|
||
| The legacy auth policy protected agent, tool, and workflow execution but left the MCP execution routes open, so an MCP client could call exposed tools, agents, and workflows without a token. `PROTECTED_ROUTES` now includes the MCP Streamable HTTP route (`/mcp/:serverId/mcp`), the SSE connection and message routes (`GET /mcp/:serverId/sse`, `POST /mcp/:serverId/messages`), MCP tool invocation, reading a single MCP prompt or resource, and the logging level route. MCP discovery is unchanged: `GET /mcp/servers`, `GET /mcp/servers/:serverId` and `GET /mcp/servers/:serverId/tools` stay public, and the prompt, resource and resource template lists stay public in the default mode (with `defaultPrivate: true` they require auth, as before). Apps that relied on unauthenticated MCP access can opt back in with `publicRoutes`. `requiresAuth()` also matches a path with a trailing slash and a `HEAD` request the same way as the route without the slash and its `GET`, so those spellings no longer reach protected handlers without a token. | ||
|
|
||
| Fixes #1493 |
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
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
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
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
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
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.
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.
P2: Elysia's MCP discovery routes are not in
DEFAULT_LEGACY_PUBLIC_ROUTES, sodefaultPrivate: truenow leavesGET /mcp,GET /mcp/:serverId, andGET /mcp/:serverId/toolsprotected. Add the Elysia discovery patterns to the legacy public list, or qualify the policy and documentation to make this framework difference explicit.Prompt for AI agents