Documentation Index
Fetch the complete documentation index at: https://docs.plugged.in/llms.txt
Use this file to discover all available pages before exploring further.
MCP Protocol Compliance
The Plugged.in MCP Proxy is 100% compliant with the Model Context Protocol specification. This document outlines the technical implementation details, protocol requirements, and validation testing.As of version 1.10.6, the proxy passes all 84+ protocol compliance tests covering CORS, headers, version negotiation, error codes, and transport mechanisms.
Streamable HTTP Transport
The proxy implements the MCP Streamable HTTP transport with full spec compliance:HTTP Headers
| Header | Direction | Format | Purpose |
|---|---|---|---|
Mcp-Session-Id | Bidirectional | Title-Case | Session identification and management |
Mcp-Protocol-Version | Bidirectional | Title-Case | Protocol version negotiation (2024-11-05) |
Authorization | Request | Bearer <token> | Optional API authentication |
Content-Type | Bidirectional | application/json | JSON-RPC 2.0 message format |
- Custom headers use Title-Case format per MCP spec:
Mcp-Session-Id, notmcp-session-id - Server accepts headers with any casing in requests (case-insensitive)
- Server always responds with correct Title-Case format
- All custom headers are exposed via
Access-Control-Expose-Headersfor JavaScript clients
Protocol Version Validation
- Protocol version header is optional in requests
- If provided, server validates against supported version (2024-11-05)
- Unsupported versions return JSON-RPC error
-32600(Invalid Request) - Server always includes
Mcp-Protocol-Version: 2024-11-05in responses - Header casing is normalized (server accepts any case, returns Title-Case)
CORS Configuration
Full CORS support for web-based MCP clients:- Preflight OPTIONS requests handled on all endpoints
- Custom MCP headers exposed to JavaScript clients
- Consistent CORS headers across
/mcp,/health, and/.well-knownendpoints
JSON-RPC 2.0 Error Codes
The proxy uses standardized error codes per JSON-RPC 2.0 specification:| Code | Name | When Used |
|---|---|---|
-32600 | Invalid Request | Malformed request, unsupported protocol version |
-32601 | Method Not Found | HTTP method not allowed (e.g., PUT on /mcp) |
-32603 | Internal Error | Server-side exception, transport failure |
-32001 | Unauthorized | Authentication failure (invalid/missing API key) |
-32000 | Application Error | Session not found, business logic errors |
Supported HTTP Methods
| Method | Endpoint | Purpose | Session Required |
|---|---|---|---|
POST | /mcp, / | JSON-RPC requests | Optional (created if missing) |
GET | /mcp, / | Server-Sent Events (SSE) | Optional |
DELETE | /mcp, / | Session termination | Optional (graceful if missing) |
OPTIONS | All | CORS preflight | No |
GET | /health | Health check | No |
GET | /.well-known/mcp-config | Server discovery (Smithery) | No |
POSTrequests receive parsed JSON body via Express middlewareGETrequests (SSE) receiveundefinedbody (no request body expected)DELETErequests gracefully handle missing sessions (200 OK response)- Unsupported methods return
-32601error
Session Management
The proxy supports both stateful (session-based) and stateless operation modes:Stateful Mode (Default)
- Server generates or reuses session ID from
Mcp-Session-Idheader - Sessions stored in memory map:
Map<sessionId, StreamableHTTPServerTransport> - Same session ID reuses existing transport (performance optimization)
- DELETE request terminates session and removes from map
- Missing session ID in DELETE returns 200 OK (idempotent)
Stateless Mode
- New transport created for every request
- No session persistence between requests
- Session headers ignored
- DELETE always returns success
- Ideal for serverless deployments (AWS Lambda, Cloudflare Workers)
Authentication
Optional Bearer token authentication for tool/resource operations:- Lazy authentication: Only required for tool/resource calls
- Discovery exempt:
tools/list,resources/list,prompts/listwork without auth - Header format:
Authorization: Bearer <PLUGGEDIN_API_KEY> - Error handling: Missing/invalid tokens return
-32001(Unauthorized) - Malformed headers: Non-Bearer format rejected with
-32001
tools/callresources/read- Any method starting with
tools/orresources/
initializetools/listresources/listprompts/list- Health checks
Architecture & Code Organization
The proxy implementation follows clean architecture principles:Core Files
src/constants.ts - Protocol constants
src/middleware.ts - Reusable middleware
corsMiddleware- CORS header managementversionMiddleware- Protocol version validationacceptMiddleware- Accept header normalizationcreateAuthMiddleware()- Authentication factoryresolveTransport()- Session/transport resolution
src/streamable-http.ts - HTTP server implementation
- Express-based HTTP server
- Middleware composition
- Request routing
- Session management
Port Validation
- Must be valid integer
- Range: 1-65535
- Invalid values default to 12006
- Prevents port conflicts and security issues
Well-Known Discovery
MCP server discovery for Smithery and other platforms:/.well-known/mcp-config- Standard location/mcp/.well-known/mcp-config- Reverse proxy support
Content-Type: application/jsonautomatically set- CORS headers included for web access
Testing & Validation
The proxy includes comprehensive test coverage:Test Categories
CORS Headers (4 tests)- ✅ Access-Control-Expose-Headers present
- ✅ MCP headers allowed in requests
- ✅ OPTIONS preflight on
/mcp - ✅ OPTIONS preflight on
/health
- ✅ Requests without version accepted
- ✅ Valid version (2024-11-05) accepted
- ✅ Invalid version rejected with -32600
- ✅ Version included in all responses
- ✅ Header casing normalized (accepts any case)
- ✅ Response uses Title-Case (Mcp-Session-Id)
- ✅ Request accepts any casing
- ✅ -32601 for unsupported HTTP methods
- ✅ -32001 for missing Authorization
- ✅ -32001 for malformed Authorization
- ✅ -32603 for internal errors
- ✅ Session creation and reuse
- ✅ Session deletion
- ✅ Graceful handling of missing sessions
Running Tests
- ✅ 84 tests passing
- ✅ 100% protocol compliance
- ✅ Zero deprecation warnings
Performance Characteristics
Stateful Mode:- Session lookup: O(1) via Map
- Memory: ~1KB per active session
- Recommended: Desktop clients, persistent connections
- Per-request overhead: ~5ms (transport creation)
- Memory: No session storage
- Recommended: Serverless, load-balanced deployments
- CORS: <0.1ms (header setting)
- Version validation: <0.1ms (string comparison)
- Accept normalization: <0.1ms (array operations)
- Authentication: <0.5ms (header parsing + validation)
Deployment Considerations
Production Checklist
- Set
REQUIRE_API_AUTH=truefor remote deployments - Use
--statelessfor serverless environments - Configure reverse proxy to preserve headers
- Set up health check monitoring (
/health) - Enable HTTPS termination (proxy supports HTTP only)
- Consider rate limiting at reverse proxy level
Smithery Cloud
Smithery deployment uses thesrc/server.ts entry point:
PLUGGEDIN_API_KEY- Your API keyPLUGGEDIN_API_BASE_URL- API endpoint (default: https://plugged.in)PORT- Server port (default: 12006)REQUIRE_API_AUTH- Enable auth (default: false)
Docker Deployment
Breaking Changes Policy
The proxy follows semantic versioning:- Major version: Breaking protocol changes
- Minor version: New features, backward compatible
- Patch version: Bug fixes, no API changes
- ✅ Fully backward compatible
- ✅ No breaking changes since 1.0.0
- ✅ Protocol version validation is optional
References
- MCP Specification: https://spec.modelcontextprotocol.io/
- JSON-RPC 2.0: https://www.jsonrpc.org/specification
- CORS Spec: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
- Smithery Docs: https://smithery.ai/docs
- Source Code: https://github.com/VeriTeknik/pluggedin-mcp
Changelog
v1.10.6 (Latest)
- ✅ Added
Access-Control-Expose-Headersfor MCP compliance - ✅ Implemented protocol version validation (2024-11-05)
- ✅ Fixed header casing to Title-Case per spec
- ✅ Standardized JSON-RPC error codes
- ✅ Added 13 new protocol compliance tests
- ✅ Extracted constants and middleware for maintainability
- ✅ Improved PORT validation with range checking
- ✅ All 84 tests passing
v1.10.5
- Previous stable release
- Basic Streamable HTTP support
Need Help? Check the Troubleshooting Guide or Installation Guide for common issues and solutions.

