feat: migrate llama-index-tools-mcp to mcp 2.x - #22557
Merged
logan-markewich merged 2 commits intoAug 11, 2026
Merged
Conversation
Bump the mcp dependency to >=2.0.0,<3 and update the integration for the 2.0 breaking changes: - Server-side FastMCP was removed; use mcp.server.mcpserver.MCPServer (utils.workflow_as_mcp, test server, example server). - ClientSession.read_timeout_seconds now takes float seconds instead of a timedelta. - Model fields are snake_case: tool.input_schema, ListResourceTemplatesResult.resource_templates, content.mime_type. - ProgressFnT moved from mcp.shared.session to mcp.shared.dispatcher. - Context.log now takes the payload as data= rather than message=. - HTTP client / OAuth are built on httpx2 in 2.0, so the client's http_client typing and tests use httpx2. Tests: 51 passed (tests/), 3 passed (mcp-discovery).
3 tasks done
logan-markewich
approved these changes
Aug 11, 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.
Description
Migrates the
llama-index-tools-mcpintegration to the MCP Python SDK 2.x line. The previous pin (mcp>=1.24.0,<2) blocksmcp2.0.0, which removed the server-sideFastMCPmodule, changed several model fields from camelCase to snake_case, moved a couple of public symbols, and switched the HTTP/SSE client layer tohttpx2. This updates the integration, its test server, and the example to the 2.0 API and loosens the pin tomcp>=2.0.0,<3.This takes the "upgrade to 2.x" approach (require the 2.x SDK) rather than supporting both 1.x and 2.x side by side.
Fixes #22515
New Package?
Did I fill in the
tool.llamahubsection in thepyproject.tomland provide a detailed README.md for my new integration or package?Version Bump?
Did I bump the version in the
pyproject.tomlfile of the package I am updating? (Except for thellama-index-corepackage)Type of Change
(Breaking only in that it now requires
mcp2.x; the public llama-index API is unchanged.)What changed
mcp>=1.24.0,<2→mcp>=2.0.0,<3.client.pyProgressFnTmoved from the removedmcp.shared.sessiontomcp.shared.dispatcher.ClientSession(read_timeout_seconds=...)now takes float seconds instead of atimedelta.http_clienttyping switched fromhttpxtohttpx2(2.0 builds its HTTP/SSE clients and OAuth provider onhttpx2); docstrings updated.message.content.mimeType→mime_type.base.pyListResourceTemplatesResult.resourceTemplates→resource_templates(this was a silent failure before — thehasattrguard always fell through to[]).tool.inputSchema→tool.input_schema.utils.pymcp.server.fastmcp.FastMCPwas removed in 2.0 →mcp.server.mcpserver.MCPServer.Context.log(..., message=...)→data=...(the 2.0 signature).tests/server.py,examples/mcp_server.py:FastMCP→MCPServer, promptsbaseimport moved tomcp.server.mcpserver.prompts.tests/test_client.py:mimeType→mime_type; provided HTTP client useshttpx2.AsyncClient.How Has This Been Tested?
Ran the package test suites against
mcp2.0.0:llama-index-tools-mcptests: 51 passed (spins up the in-repo MCP stdio server).llama-index-tools-mcp-discoverytests: 3 passed.ruff checkclean on the integration and tests (the example file has pre-existing docstring-style warnings unrelated to this change).Suggested Checklist: