Commit 97f9dc4
fix: restore MCP server startup under pydantic 2.11 / fastmcp 2.12
The server crashed on startup with two cascading pydantic errors while
fastmcp built output schemas from typed tool return annotations:
1. typing.TypedDict is rejected by pydantic on Python < 3.12 — import
TypedDict/NotRequired/Required from typing_extensions instead
(tool_responses.py and vector_backend/sync.py).
2. The hand-rolled recursive JsonValue alias was "not fully defined":
fastmcp builds the output TypeAdapter in its own module namespace, so
the "JsonValue" string forward-ref could not be resolved. Use
pydantic's built-in recursive JsonValue and drop the now-unneeded
`from __future__ import annotations`.
Loose version pins (pydantic>=2.7, fastmcp>=2.1) let newer releases pull
in the stricter behavior; the startup test mocks FastMCP, so the real
schema-building path was never exercised in CI.
Verified: server completes the MCP initialize handshake, tools/list
returns all 18 tools with schemas, and `claude mcp list` reports
Connected.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 22f3c3b commit 97f9dc4
2 files changed
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
0 commit comments