docs(mcp-server): document basePath option and host OAuth collision#10
Merged
Conversation
The embedded MCP server registers its OAuth and .well-known routes at the
host root, which shadows a host app's own OAuth routes. Document the new
mountAiMcpServer({ basePath }) option that scopes every MCP route under a
prefix, with a warning on the collision and its resolution.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The prior wording implied basePath moves the .well-known routes under the prefix. Per OAuth discovery (RFC 8414/9728) those metadata documents stay at the host root and are only prefix-suffixed (e.g. /.well-known/oauth-authorization-server/ai), which is what avoids the collision with a host app's own root .well-known routes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
4 tasks
OAuth discovery must be served at the origin root, so the code now rejects a basePath when the agent's base URL has a path. Document that constraint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Document the /mcp/mcp repetition (prefix applies to the protocol endpoint too) on the embed page, and tighten the basePath param description now that .well-known routes are not moved under the prefix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
hercemer42
requested changes
Jul 6, 2026
- State that default mode claims the entire /oauth/* and /.well-known/* namespaces (captured-but-unserved routes 404/405 instead of falling through). - Mark the authorization endpoint as GET, POST (browser redirect flow). - Note that root /.well-known/* must still reach the agent behind a proxy. - Clarify the basePath param description (discovery stays at origin root). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
hercemer42
approved these changes
Jul 6, 2026
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.
What
Documents the new
agent.mountAiMcpServer({ basePath })option (code PR: ForestAdmin/agent-nodejs#1737).The embedded MCP server registers its OAuth (
/oauth/authorize,/oauth/token) and.well-known/*routes at the host root. If the host app already serves its own OAuth routes, they get shadowed and break (reported by a customer).basePathscopes every MCP route under a prefix so both coexist.Changes
reference/agent-api/nodejs.mdx— addbasePathto themountAiMcpServerparams, a<Warning>on the collision, a prefixed-endpoints table, and a<Note>on the/mcp/mcpdoubling.product/embed/mcp-server.mdx— add a<Warning>in the "Mounted" section pointing tobasePath.basePathis not released yet — merge this after the code PR (ForestAdmin/agent-nodejs#1737) ships in a release.🤖 Generated with Claude Code
Note
Document
basePathoption and OAuth route collision warning formountAiMcpServermountAiMcpServerregisters OAuth and.well-knownroutes at the backend root, which may shadow existing routes in an application.basePathparameter, which scopes all MCP routes under a dedicated prefix to avoid collisions, with updated endpoint mappings and usage examples.basePathrequires the agent to be served at the domain root (otherwise startup errors).Changes since #10 opened
basePathconfiguration option [7750b43]Macroscope summarized 40fd79f.