Transports (HTTP & STDIO)
Choose between HTTP and STDIO transport mechanisms for your MCP server based on deployment scenario.
MCP servers can communicate via two transport mechanisms. Choose based on your deployment scenario.
🌐 HTTP Transport (Web)
Best for: Web applications, REST APIs, browser-based clients, any HTTP-capable client
How It Works
Clients send JSON-RPC requests over HTTP POST to a .bxm endpoint. The server processes and returns JSON-RPC responses.
Built-In Endpoint
Use the automatic endpoint provided by the module:
POST http://localhost/~bxai/mcp.bxm?server=myAppOr create a custom endpoint:
// api/my-mcp.bxm
<bx:script>
import bxModules.bxai.models.mcp.MCPRequestProcessor
MCPRequestProcessor::startHttp()
</bx:script>Features
✅ CORS support with wildcard patterns ✅ Body size limits ✅ API key authentication ✅ HTTP Basic Auth ✅ Security headers ✅ Server-Sent Events (SSE) streaming ✅ Discovery endpoint (GET)
Making Requests
🖥️ STDIO Transport (Command-Line)
Best for: Desktop applications, CLI tools, IDE integrations, local AI assistants (Claude Desktop, etc.)
How It Works
Clients communicate via standard input/output (STDIN/STDOUT). Requests and responses are JSON-RPC formatted, one per line.
Create a Script Entry Point
Run STDIO Server
Features
✅ JSON-RPC over STDIN/STDOUT ✅ Line-based protocol ✅ Graceful shutdown signal ✅ Process lifecycle management ❌ No HTTP headers/CORS (not needed) ❌ No status codes (JSON-RPC error codes used)
STDIO Communication
🎯 Choosing a Transport
Web application with browser clients
HTTP
REST API for external services
HTTP
Desktop AI assistant (Claude Desktop)
STDIO
VS Code extension / IDE integration
STDIO
Command-line tool
STDIO
Docker container as MCP service
Both
Testing/Development
HTTP (easier to test with curl)
Comparison
Setup
Automatic or simple .bxm
Script entry point
Security
Auth headers, CORS, HTTPS
Process isolation
Performance
Network latency
Local process
Debugging
curl/Postman friendly
Process logs
Scalability
Multi-client, reverse proxy
Single client per process
Integration
Browser, mobile, web apps
Desktop apps, CLIs, IDEs
Examples
HTTP Example (Claude Desktop)
STDIO Example (Claude Desktop)
Next Steps
🚀 Getting Started — Your first server
🔐 Server Configuration — Authentication & security
🛠️ HTTP Endpoint — Custom HTTP routing
Last updated