Skip to content

Support STDIO transport for local MCP servers #10

@kashifpk

Description

@kashifpk

Summary

Add support for STDIO transport to enable testing local MCP servers that communicate via stdin/stdout instead of HTTP.

Background

The official MCP Inspector supports multiple transports:

  • STDIO - Direct process communication for local servers
  • SSE - Server-Sent Events for remote servers
  • Streamable HTTP - Bidirectional HTTP streaming (currently supported by Anvil)

Many MCP servers, especially those used with Claude Desktop, are configured to run via STDIO. Supporting this transport would significantly expand the servers Anvil can test.

Proposed Implementation

CLI

# Launch a local server via stdio
anvil --stdio "python -m my_mcp_server" list-tools
anvil --stdio "node build/index.js" call get_weather --arg city=Berlin

# Or with a config file reference
anvil --server my-local-server list-tools

Web UI

  • Add transport type selector (HTTP / STDIO)
  • For STDIO: input field for the command to execute
  • Spawn subprocess and communicate via stdin/stdout

Technical Considerations

  • Use asyncio.subprocess for spawning the MCP server process
  • Implement proper process lifecycle management (start, stop, restart)
  • Handle process crashes gracefully
  • Consider security implications of executing arbitrary commands

Acceptance Criteria

  • CLI can connect to STDIO-based MCP servers
  • Web UI can launch and connect to STDIO servers
  • Proper error handling for process failures
  • Documentation updated with STDIO examples

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions