Skip to content

docs(mcp-server): document basePath option and host OAuth collision#10

Merged
Scra3 merged 5 commits into
mainfrom
docs/mcp-server-base-path
Jul 6, 2026
Merged

docs(mcp-server): document basePath option and host OAuth collision#10
Scra3 merged 5 commits into
mainfrom
docs/mcp-server-base-path

Conversation

@Scra3

@Scra3 Scra3 commented Jul 6, 2026

Copy link
Copy Markdown
Member

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). basePath scopes every MCP route under a prefix so both coexist.

Changes

  • reference/agent-api/nodejs.mdx — add basePath to the mountAiMcpServer params, a <Warning> on the collision, a prefixed-endpoints table, and a <Note> on the /mcp/mcp doubling.
  • product/embed/mcp-server.mdx — add a <Warning> in the "Mounted" section pointing to basePath.

⚠️ Merge timing

basePath is not released yet — merge this after the code PR (ForestAdmin/agent-nodejs#1737) ships in a release.

🤖 Generated with Claude Code

Note

Document basePath option and OAuth route collision warning for mountAiMcpServer

  • Adds a warning in mcp-server.mdx and nodejs.mdx that mountAiMcpServer registers OAuth and .well-known routes at the backend root, which may shadow existing routes in an application.
  • Documents the optional basePath parameter, which scopes all MCP routes under a dedicated prefix to avoid collisions, with updated endpoint mappings and usage examples.
  • Clarifies that discovery documents remain at the origin root but are served at prefix-suffixed paths, and that basePath requires the agent to be served at the domain root (otherwise startup errors).

Changes since #10 opened

  • Documented MCP server routing behavior and basePath configuration option [7750b43]
  • Updated OAuth authorize endpoint to accept both GET and POST methods [7750b43]

Macroscope summarized 40fd79f.

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>
Comment thread product/embed/mcp-server.mdx Outdated
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>
@mintlify

mintlify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
forest 🟢 Ready View Preview Jul 6, 2026, 1:37 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

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>
Comment thread reference/agent-api/nodejs.mdx Outdated
Comment thread reference/agent-api/nodejs.mdx Outdated
Comment thread reference/agent-api/nodejs.mdx Outdated
Comment thread reference/agent-api/nodejs.mdx Outdated
- 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>
Comment thread reference/agent-api/nodejs.mdx
@Scra3 Scra3 merged commit ea4eeb2 into main Jul 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants