Skip to content

Python: [Bug]: Local CI MCP server fails to start on mcp 2.x, so MCP integration tests fall back to the external URL #10075

Open

Description

Observed Behavior

python/scripts/local_mcp_streamable_http_server.py is the deterministic MCP server that .github/actions/setup-local-mcp-server starts for the MCP integration tests (used by python-merge-tests.yml and python-integration-tests.yml). It still imports mcp.server.fastmcp.FastMCP. The workspace locks mcp 2.3.0, where that module no longer exists, so the server exits on import:

ModuleNotFoundError: No module named 'mcp.server.fastmcp'. This is mcp 2.x, where FastMCP was renamed to MCPServer ...

The action's health check then fails, and it logs "Local MCP server was unavailable; continuing with fallback LOCAL_MCP_URL". So the integration tests silently run against the external vars.LOCAL_MCP__URL instead of the local server the action is meant to provide.

Separately, both tests that use LOCAL_MCP_URL (test_streamable_http_integration and test_mcp_connection_reset_integration in packages/core/tests/core/test_mcp.py) fail against any server. They assert tool.session is not None, but with mcp 2.x MCPTool connects through a high-level mcp.Client, and the deprecated session property returns None for those connections. The reset test also patches tool.session.call_tool, which no longer exists on that path.

Expected Behavior

The local CI MCP server starts on mcp 2.x, and the MCP integration tests pass against it.

Steps to Reproduce

  1. cd python && uv run python scripts/local_mcp_streamable_http_server.py
  2. Observe the import error.
  3. With a working server, run LOCAL_MCP_URL=http://127.0.0.1:8011/mcp uv run pytest packages/core/tests/core/test_mcp.py -m integration.

Minimal Reproduction

cd python
uv run python scripts/local_mcp_streamable_http_server.py --port 8011

Error Messages and Stack Traces

ModuleNotFoundError: No module named 'mcp.server.fastmcp'. This is mcp 2.x, where FastMCP was renamed to MCPServer (from mcp.server.mcpserver import MCPServer) ...

FAILED packages/core/tests/core/test_mcp.py::test_streamable_http_integration - assert None is not None
FAILED packages/core/tests/core/test_mcp.py::test_mcp_connection_reset_integration - assert None is not None

Package Versions

mcp 2.3.0 (uv.lock); main at dc6617a

Python Version

Python 3.13

Operating System

macOS

Regression

Yes. The script was written for mcp 1.x, and the workspace moved to mcp>=2.2.0,<3.

Additional Context

Proposed fix:

  • Port the script to mcp.server.mcpserver.MCPServer. In 2.x, host, port and path are passed to run(transport="streamable-http", ...) instead of the constructor. Set structured_output=False so the tool keeps returning plain text.
  • Update the two integration tests to check tool.is_connected and the normalized connection (tool._connection) instead of the deprecated session.

I have a PR ready and will link it here.

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Nov 4, 2026
  2. 1aifanatic commented on Nov 4, 2026

    @1aifanatic
    ContributorAuthor

    PR with the proposed fix: #10077

  3. added
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Nov 4, 2026
  4. github-actions commented on Nov 4, 2026

    @github-actions
    Contributor

    🤖 Automated triage reproduction notes (agent-authored — trust but verify)

    Agent analysis

    Repro: python/scripts/local_mcp_streamable_http_server.py::<module> line 11 fails under locked MCP 2.3.0 when importing mcp.server.fastmcp.FastMCP; run cd python && uv run python scripts/local_mcp_streamable_http_server.py --port 801. Separately, python/packages/core/tests/core/test_mcp.py::test_streamable_http_integration and ::test_mcp_connection_reset_integration fail at lines 424 and 427 after connecting to any MCP 2 streamable HTTP server because tool.session is None; start an MCP 2 server exposing one tool and run both node IDs with LOCAL_MCP_URL set.

    • Failing test: python/packages/core/tests/core/test_mcp.py
    • Files examined: python/scripts/local_mcp_streamable_http_server.py, .github/actions/setup-local-mcp-server/action.yml, python/packages/core/tests/core/test_mcp.py, python/packages/core/agent_framework/_mcp.py, python/packages/core/pyproject.toml, python/pyproject.toml, python/uv.lock
    • Tests run: python/packages/core/tests/core/test_mcp.py::test_streamable_http_integration, python/packages/core/tests/core/test_mcp.py::test_mcp_connection_reset_integration
    • Reported version: mcp 2.3.0
    • Current version: agent-framework-core 1.24.0
  5. removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

pythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions