Stdio-based MCP servers communicate through standard input/output (stdin/stdout) rather than HTTP endpoints. This approach is particularly useful for local development and testing.
Overview
Unlike HTTP-based MCP servers that expose REST endpoints, stdio-based servers:
- Communicate through standard input and output streams
- Use JSON-RPC over stdio for message exchange
- Provide lower latency for local operations
Exposing Stdio Servers as HTTP Endpoints
Use mcp-proxy
to convert stdio servers to HTTP endpoints.
Using mcp-proxy
mcp-proxy
can wrap any stdio-based MCP server command to expose it as HTTP endpoints:
# Install TypeScript version (https://github.com/punkpeye/mcp-proxy)
npm install mcp-proxy
# Wrap any stdio-based MCP server command
npx mcp-proxy --port 8000 --host 0.0.0.0 --server stream --debug <your-stdio-command>
---
# Install Python version (https://github.com/sparfenyuk/mcp-proxy)
uv tool install mcp-proxy
# or
pipx install mcp-proxy
# Wrap any stdio-based MCP server command
mcp-proxy --port 8000 --host 0.0.0.0 --transport streamablehttp --debug <your-stdio-command>
Benefits of Using mcp-proxy
- Convert any stdio server to HTTP endpoints
- Support multiple concurrent connections
- Access stdio servers over the network
- CORS enabled by default
Integration with TrueFoundry
Configure your MCP server in TrueFoundry as an HTTP server:
Server Type
: HTTP (not stdio)
Endpoint URL
: http://your-proxy-host:8000/mcp
Example: MongoDB MCP Server
Complete setup for MongoDB MCP server with stdio and proxy:
# Install MongoDB MCP server
npm install -g mongodb-mcp-server
# Option 1: Direct stdio usage
npx mongodb-mcp-server
# Option 2: Via TypeScript mcp-proxy for HTTP endpoints
npx mcp-proxy --port 8000 --host 0.0.0.0 --server stream --debug npx mongodb-mcp-server
# Option 3: Via Python mcp-proxy (alternative)
mcp-proxy --port 8000 --host 0.0.0.0 npx mongodb-mcp-server
# Test proxy endpoints
curl http://localhost:8000/mcp # HTTP endpoint
TrueFoundry Service Deployment
Deploy any stdio-based MCP server as a TrueFoundry service. Example with MongoDB MCP server:
type: service
name: mongodb-mcp
image:
type: image
image_uri: node:24
command: >-
npx -y mcp-proxy --port 8000 --host 0.0.0.0 --server stream --debug npx
mongodb-mcp-server
ports:
- host: <your-host>
port: 8000
expose: true
protocol: TCP
app_protocol: http
env:
MDB_MCP_CONNECTION_STRING: mongodb://root:password@mongodb.default.svc.cluster.local:27017
workspace_fqn: <your-workspace>
replicas: 1
allow_interception: false
resources:
node:
type: node_selector
capacity_type: spot
cpu_request: 0.2
cpu_limit: 0.5
memory_request: 2000
memory_limit: 5000
ephemeral_storage_request: 1000
ephemeral_storage_limit: 2000
Customizing for Different MCP Servers:
Replace the command with your specific MCP server:
# Using TypeScript mcp-proxy (default)
command: >-
npx -y mcp-proxy --port 8000 --host 0.0.0.0 --server stream --debug python your-server.py
# Using Python mcp-proxy (alternative)
command: >-
pip install mcp-proxy && mcp-proxy --port 8000 --host 0.0.0.0 python your-server.py
# For TypeScript MCP servers
command: >-
npx -y mcp-proxy --port 8000 --host 0.0.0.0 --server stream --shell tsx your-server.ts
# For Node.js MCP servers
command: >-
npx -y mcp-proxy --port 8000 --host 0.0.0.0 --server stream --debug node your-server.js