Overview
xmcp supports two transport protocols for MCP communication:- HTTP Transport - RESTful API over HTTP/HTTPS, ideal for web clients and remote connections
- STDIO Transport - Standard input/output communication, perfect for local CLI tools and desktop applications
xmcp.config.ts based on your deployment needs.
HTTP Transport
HTTP transport exposes your MCP server as a RESTful API over HTTP/HTTPS.Basic Configuration
examples/http-transport/xmcp.config.ts
Enabling HTTP Transport
Use thehttp key in your config:
HTTP Configuration Options
Enable HTTP transport. Use
true for defaults or an object for custom configurationPort number for the HTTP server
Starting the HTTP Server
http://localhost:3002/mcp (or your configured port).
HTTP Endpoints
The HTTP transport automatically creates MCP-compliant endpoints:POST /mcp- Main MCP protocol endpointGET /health- Health check endpointGET /.well-known/oauth-protected-resource- OAuth discovery (if auth configured)
Example Tool with HTTP
examples/http-transport/src/tools/greet.ts
When to Use HTTP
Web Applications
Connect from web browsers, React apps, or any HTTP client
Remote Access
Access your MCP server from different machines or networks
Cloud Deployment
Deploy to serverless platforms, containers, or cloud providers
Authentication
Use middleware for API keys, JWT, OAuth, or custom auth
STDIO Transport
STDIO transport uses standard input/output for process-to-process communication.Basic Configuration
examples/stdio-transport/xmcp.config.ts
Starting with STDIO
STDIO Communication Flow
- Client spawns your MCP server as a subprocess
- Client sends JSON-RPC messages to stdin
- Server processes requests and responds via stdout
- Server logs and errors go to stderr
Example Tool with STDIO
examples/stdio-transport/src/tools/greet.ts
When to Use STDIO
Desktop Applications
Integrate with Electron apps, Claude Desktop, or native applications
CLI Tools
Build command-line tools that communicate via stdin/stdout
Local Development
Fast local testing without network overhead
Process Isolation
Each client gets its own isolated server process
Dual Transport Support
You can enable both transports simultaneously:Transport Comparison
| Feature | HTTP | STDIO |
|---|---|---|
| Remote Access | ✅ Yes | ❌ No (local only) |
| Authentication | ✅ Middleware support | ⚠️ Limited |
| Web Browsers | ✅ Yes | ❌ No |
| Desktop Apps | ⚠️ Via network | ✅ Native |
| Deployment | ✅ Cloud-ready | ⚠️ Local only |
| Performance | ⚠️ Network overhead | ✅ Fast IPC |
| Process Model | Shared server | Isolated per client |
Development Tips
Test Locally First
Use STDIO during development for faster iteration without network setup
Deploy with HTTP
Switch to HTTP for production deployments and cloud hosting
Enable Both
Support both transports for maximum flexibility
Use TypeScript
Enable
skipTypeCheck: false in production for type safetyTypeScript Configuration
Both examples include TypeScript options:examples/http-transport/xmcp.config.ts
Next Steps
Client Connections
Connect to other MCP servers as a client
Authentication
Secure your HTTP transport with authentication
Middleware
Add custom middleware to HTTP transport
Deployment
Deploy your MCP server to production