HTTP Endpoint & Routing
Set up and customize HTTP endpoints and routing for your MCP server.
Set up HTTP endpoints for your MCP server.
Built-In Endpoint
The module provides a pre-built HTTP endpoint at public/mcp.bxm:
POST http://localhost/~bxai/mcp.bxmSpecify a server using query parameter or URL segment:
# Query parameter
POST http://localhost/~bxai/mcp.bxm?server=myApp
# URL segment
POST http://localhost/~bxai/mcp.bxm/myAppDiscovery (GET)
Get server capabilities:
curl http://localhost/~bxai/mcp.bxm?server=myAppResponse:
{
"jsonrpc": "2.0",
"result": {
"protocolVersion": "2024-11-05",
"capabilities": {
"tools": {},
"resources": {},
"prompts": {}
},
"serverInfo": {
"name": "myApp",
"version": "1.0.0"
}
}
}Custom Entry Points
Create your own MCP endpoint at any URL:
Now you have a fully functional endpoint at:
Custom Routing Examples
Secured Admin Endpoint
API Versioned Endpoint
Multi-Server Router
MCPRequestProcessor
The MCPRequestProcessor handles all HTTP request/response logic:
What it does automatically:
✅ Extracts server name from query parameter or URL segment
✅ Parses JSON-RPC 2.0 requests
✅ Routes to correct MCP server instance
✅ Returns formatted JSON-RPC responses
✅ Fires all MCP events (onMCPRequest, onMCPResponse, onMCPError)
✅ Applies security checks and headers
✅ Handles CORS preflight requests
Static Server Management
Check server existence and manage registry:
Use Cases
Custom Routing
Framework Integration
Integrate MCP servers into existing URL schemes:
Security
Put endpoints behind middleware:
Testing
With curl
With Postman
Create POST request to
http://localhost/~bxai/mcp.bxm?server=myAppSet
Content-Type: application/jsonUse JSON body with MCP methods
Send and inspect responses
Next Steps
🔐 Server Configuration — Auth & security
📊 Observability — Monitor requests
✅ Best Practices — Production setup
Last updated