Skip to content

Support MCP SDK 1 and 2 with reliable stdio telemetry - #16

Merged
jkubo merged 3 commits into
mainfrom
dependabot/pip/mcp-gte-1.28.1-and-lt-3
Oct 8, 2026
Merged

jkubo merged 3 commits into
mainfrom
dependabot/pip/mcp-gte-1.28.1-and-lt-3

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

MCP SDK 2 replaces the SDK 1 server entrypoint and dispatches synchronous tools on worker threads. That breaks the existing import path and silently drops telemetry on the thread-bound SQLite connection. This change selects the installed SDK's native server API and registers an asynchronous adapter that runs the existing synchronous helper on the event loop. Direct Python helpers remain synchronous, with their signatures, tool schemas, fact attribution and telemetry source preserved.

The MCP dependency range becomes >=1.28.1,<3, while the lock retains the merged security fixes. CI now runs Python 3.11 and 3.12 against both MCP majors, resolves the chosen major explicitly, verifies it, and runs the full suite. Real stdio regressions cover initialization, all seven tool schemas, separate session identities, repeated fact confirmations, and complete telemetry under concurrent requests.

Validation of the final source tree: all 843 tests pass in each current Python/MCP combination; supported API floors 1.28.1 and 2.0.0 pass compatibility and stdio probes. Independent real-stdio probes on both current SDK majors produce all 75 telemetry rows for three batches of 25 concurrent calls and exactly 15 repeated fact confirmations. Fresh native dispatch checks across four SDK releases preserve all seven signatures and retain all 71 observed callbacks. Public commit metadata and the exact GitHub CI result are checked separately before merge.

GitHub validation: all four Python/MCP jobs passed at the exact reviewed head: https://github.com/jkubo/gaius/actions/runs/37729372886

@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python Pull requests that update python code labels Sep 16, 2026
@jkubo

jkubo commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Migration check on current main d4199177b09634e7161037333b80846cb1668973:

  • The four security dependency updates are merged and the repository now has zero open Dependabot alerts. Main tests pass on Python 3.11 and 3.12.
  • MCP 2.3.0 still fails the existing two attribution tests at from mcp.server.fastmcp import FastMCP, because that module was removed. This PR remains blocked until source compatibility is implemented.
  • A diagnostic that substitutes mcp.server.MCPServer for FastMCP in child-process memory successfully completes an actual stdio initialize/list-tools/call-tool round trip. All seven tools are registered. Two fact calls retain distinct session identities and produce a confirmation count of two; all three calls emit MCP telemetry with the supplied session identity. Only temporary databases were used. Production source was unchanged, so this is migration evidence, not a completed fix.

The fix must preserve compatibility with the supported MCP 1 series, widen the dependency constraint, regenerate the lock from current main without dropping the security updates, and pass the full test suite plus the stdio check under MCP 1 and MCP 2. Code execution is pending the repository's device-signed build grant.

jkubo added 3 commits October 8, 2026 11:56
Bind mcp.server.MCPServer when the installed SDK exports it, and FastMCP otherwise, without aliasing one class to the other. Widen the mcp extra to >=1.28.1,<3 and regenerate the lock on the merged security floors. Cover both clients with a real stdio lifecycle test.
Install the project extras and an explicit SDK 1 or SDK 2 range in one resolver transaction, print the installed SDK version, and fail when that major does not match the matrix.
SDK 2 offloads a sync tool onto a worker thread. The telemetry
connection is cached with default thread affinity, so those calls
drop events. The adapter runs the existing sync helper inline, and
_register still returns that helper for direct Python calls.
@jkubo
jkubo force-pushed the dependabot/pip/mcp-gte-1.28.1-and-lt-3 branch from 596047e to 7a52dc5 Compare October 8, 2026 04:49
@jkubo jkubo changed the title chore(deps-dev): update mcp requirement from <2,>=1.28.1 to >=1.28.1,<3 Support MCP SDK 1 and 2 with reliable stdio telemetry Oct 8, 2026
@jkubo
jkubo merged commit 520c2eb into main Oct 8, 2026
4 checks passed
@dependabot
dependabot Bot deleted the dependabot/pip/mcp-gte-1.28.1-and-lt-3 branch October 8, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant