Skip to content

Python MCP servers via uvx/uv not working - wrong transport selected #2

@radkoa

Description

@radkoa

Problem

When using mcp-filter to wrap Python-based MCP servers launched via uvx (e.g., mcp-atlassian), the filter fails to discover any tools. The upstream server starts but returns 0 tools.

Root Cause

In src/mcp_filter/upstream.py, the _connect_stdio() function detects transport type based on the command:

  • npxNpxStdioTransport
  • python or .pyPythonStdioTransport
  • Everything elseNodeStdioTransport

The problem is that uvx (Python package runner, similar to npx for Python) falls into the "everything else" category and incorrectly uses NodeStdioTransport, which doesn't work properly with Python MCP servers.

Expected Behavior

Commands like:

mcp-filter run -t stdio --stdio-command uvx --stdio-arg mcp-atlassian ...

Should use FastMCP's UvxStdioTransport (which exists and works correctly).

Environment

  • FastMCP provides both UvxStdioTransport and UvStdioTransport for this purpose
  • Verified by checking available transports:
    from fastmcp.client import *
    # Available: NpxStdioTransport, PythonStdioTransport, UvxStdioTransport, UvStdioTransport, ...

Affected Use Cases

Any Python-based MCP server that users want to filter:

  • mcp-atlassian
  • Other Python MCP servers installed via pip/uv

Suggested Fix

Add detection for uvx and uv commands in _connect_stdio():

elif command == "uvx":
    transport = UvxStdioTransport(tool_name=args[0], tool_args=args[1:])
elif command == "uv":
    # Handle "uv run script.py" pattern
    transport = UvStdioTransport(command=args[1], args=args[2:])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions