Skip to content

Reworked technical/tool.md adding MCP support - #57

Merged
cableman merged 1 commit into
mainfrom
feature/updated-agentic
Jul 16, 2026
Merged

Reworked technical/tool.md adding MCP support#57
cableman merged 1 commit into
mainfrom
feature/updated-agentic

Conversation

@cableman

Copy link
Copy Markdown
Contributor
  • Auth on /mcp has to be a pure-ASGI middleware. BaseHTTPMiddleware breaks the streamable transport (double http.response.start / AssertionError), so the old "wrap it in a FastAPI middleware" advice was actively harmful.
  • Endpoint is served at POST /mcp (FastMCP default), mounted last so the REST routes still win. Fixed the curl and Open WebUI URL accordingly.
  • Host validation: it's the enable_dns_rebinding_protection flag (default on), a bad Host is a 421, and :* is the wildcard-port form.
  • Test client fixture must be session-scoped when the test runs the lifespan — session_manager.run() only starts once.
  • Bumped mcp[cli] to >=1.20 and called out the mcp.server.fastmcp vs the standalone fastmcp package mixup.

Also added notes on reusing one service function across the REST route and the MCP tool, and compacting tool output so chat clients don't blow the context window replaying it every turn.

Fixed all the broken ./new-agent.md links (that file is agentic_tool.md) and added an §8.7 pointer from the agent guide over to the MCP guide.

@cableman
cableman force-pushed the feature/updated-agentic branch from cf61b13 to 24b3ad1 Compare July 16, 2026 09:17
- Auth on /mcp has to be a pure-ASGI middleware. BaseHTTPMiddleware breaks
  the streamable transport (double http.response.start / AssertionError),
  so the old "wrap it in a FastAPI middleware" advice was actively harmful.
- Endpoint is served at POST /mcp (FastMCP default), mounted last so the
  REST routes still win. Fixed the curl and Open WebUI URL accordingly.
- Host validation: it's the enable_dns_rebinding_protection flag (default
  on), a bad Host is a 421, and :* is the wildcard-port form.
- Test client fixture must be session-scoped when the test runs the
  lifespan — session_manager.run() only starts once.
- Bumped mcp[cli] to >=1.20 and called out the mcp.server.fastmcp vs the
  standalone fastmcp package mixup.

Also added notes on reusing one service function across the REST route and
the MCP tool, and compacting tool output so chat clients don't blow the
context window replaying it every turn.

Fixed all the broken ./new-agent.md links (that file is agentic_tool.md)
and added an §8.7 pointer from the agent guide over to the MCP guide.
@cableman
cableman force-pushed the feature/updated-agentic branch from 24b3ad1 to 0f8aa9a Compare July 16, 2026 09:22
@jekuaitk
jekuaitk self-requested a review July 16, 2026 09:29
@cableman
cableman merged commit 0117056 into main Jul 16, 2026
1 check passed
@cableman
cableman deleted the feature/updated-agentic branch July 16, 2026 09:39
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