Skip to main content
Glama
KVerduyn
by KVerduyn
MCP_COMPLIANCE.md10 kB
# MCP 2025-06-18 Compliance Report ## Overview This document describes the compliance status of the School Vacation MCP Server with the Model Context Protocol specification version 2025-06-18. ## Completed Upgrades ### 1. SDK Version Update ✓ - **Previous**: `@modelcontextprotocol/sdk` v0.4.0 - **Current**: `@modelcontextprotocol/sdk` v1.21.0 - **Status**: COMPLETE ### 2. Protocol Version Update ✓ - **Previous**: 2024-11-05 - **Current**: 2025-06-18 (using `LATEST_PROTOCOL_VERSION` constant) - **Location**: [src/mcp-http-server.ts](src/mcp-http-server.ts#L222) - **Status**: COMPLETE ### 3. Breaking API Changes Fixed ✓ The SDK v1.21.0 introduced a breaking change in the `Server` constructor: **Old API (v0.4.0)**: ```typescript new Server({ name: 'server-name', version: '1.0.0', capabilities: { tools: {} } }) ``` **New API (v1.21.0)**: ```typescript new Server( { name: 'server-name', version: '1.0.0' }, { capabilities: { tools: {} } } ) ``` **Files Updated**: - [src/index.ts](src/index.ts#L12-L22) - stdio server - [src/mcp-http-server.ts](src/mcp-http-server.ts#L23-L33) - HTTP+MCP combined server **Status**: COMPLETE ### 4. Testing ✓ All three server modes have been tested and confirmed working: - **stdio server** ([src/index.ts](src/index.ts)) - Standard MCP protocol - **HTTP server** ([src/http-server.ts](src/http-server.ts)) - REST API only - **Combined HTTP+MCP server** ([src/mcp-http-server.ts](src/mcp-http-server.ts)) - Both REST and MCP **Status**: COMPLETE ## Compliance Status ### Current Compliance Level: BASIC ⚠️ The server meets basic protocol requirements but lacks advanced security features introduced in 2025-06-18. ## MCP 2025-06-18 Feature Support ### ✓ Supported Features #### Core Protocol - ✓ JSON-RPC 2.0 message format - ✓ Protocol version 2025-06-18 - ✓ Stateful connection management - ✓ Capability negotiation during initialization #### Tools Implementation - ✓ `tools/list` method with proper JSON Schema - ✓ `tools/call` method with parameter validation - ✓ Structured tool definitions with descriptions - ✓ Required/optional parameter declarations - ✓ Enum support for restricted values #### Error Handling - ✓ JSON-RPC 2.0 error codes (-32600, -32601, -32603) - ✓ Proper error response format - ✓ Error messages in tool execution #### Transport Layers - ✓ stdio transport (standard MCP) - ✓ HTTP transport with JSON-RPC endpoint - ✓ CORS support for web clients ### ⚠️ Partially Implemented Features #### Tool Output Format - Current: Returns JSON strings inside text content blocks - 2025-06-18: Supports structured output with `outputSchema` (Zod validation) - **Recommendation**: Consider using the new `McpServer` high-level API with `outputSchema` support - **Priority**: MEDIUM ### ⛔ Missing Features (Required by Spec) #### 1. OAuth/Authorization (HIGH PRIORITY) **Status**: NOT IMPLEMENTED The 2025-06-18 specification now treats MCP servers as OAuth 2.0 Resource Servers. **Requirements**: - OAuth 2.0 authorization flow - RFC 8707 Resource Indicators - Token validation - Explicit user consent flows **Current Risk**: - No authentication on HTTP endpoints - Tools can be called without authorization - No user consent mechanism **Recommendation**: ```typescript // Add to mcp-http-server.ts import { validateOAuthToken } from './auth.js'; app.post('/mcp', async (req, res) => { const authHeader = req.headers.authorization; if (!authHeader) { return res.status(401).json({ jsonrpc: '2.0', id: req.body?.id || null, error: { code: -32001, message: 'Unauthorized - missing authorization header' } }); } try { const token = authHeader.replace('Bearer ', ''); await validateOAuthToken(token); // Continue with request handling... } catch (error) { return res.status(403).json({ jsonrpc: '2.0', id: req.body?.id || null, error: { code: -32002, message: 'Forbidden - invalid token' } }); } }); ``` #### 2. Elicitation Support (MEDIUM PRIORITY) **Status**: NOT IMPLEMENTED Elicitation allows servers to request additional information from users during tool execution. **Use Cases**: - Requesting user confirmation before sensitive operations - Asking for additional parameters not in original request - Interactive workflows **Current Limitation**: Tools cannot request user input during execution **Recommendation**: Add elicitation capability if interactive confirmation is needed for vacation queries #### 3. Structured Output Schema (MEDIUM PRIORITY) **Status**: NOT IMPLEMENTED The 2025-06-18 spec supports defining output schemas using Zod validation. **Current Approach**: ```typescript return { content: [{ type: 'text', text: JSON.stringify({ date, region, isSchoolVacation }) }] } ``` **Modern Approach**: ```typescript server.registerTool('check_school_vacation', { description: '...', inputSchema: { ... }, outputSchema: { date: z.string(), region: z.string(), isSchoolVacation: z.boolean() } }, async ({ date, region }) => { return { content: [{ type: 'text', text: '...' }], structuredContent: { date, region, isSchoolVacation: result } }; }); ``` **Benefit**: Type-safe, validated structured outputs ### ⚠️ Security Best Practices #### Current Security Issues 1. **No Authorization** - All endpoints are publicly accessible 2. **No User Consent Flow** - Tools execute without explicit permission 3. **No Rate Limiting** - Vulnerable to abuse 4. **No Input Sanitization** - Date strings parsed without validation 5. **No Audit Logging** - No record of tool invocations #### Required by Spec (RFC 2119) The specification states that implementors **SHOULD**: - Build robust consent and authorization flows - Provide clear security documentation - Implement appropriate access controls - Follow security best practices - Consider privacy implications #### Recommended Immediate Actions 1. **Add Environment-Based Auth Token** (Quick Fix): ```typescript const AUTH_TOKEN = process.env.MCP_AUTH_TOKEN; app.use('/mcp', (req, res, next) => { if (AUTH_TOKEN && req.headers.authorization !== `Bearer ${AUTH_TOKEN}`) { return res.status(401).json({ error: 'Unauthorized' }); } next(); }); ``` 2. **Add Rate Limiting**: ```bash npm install express-rate-limit ``` ```typescript import rateLimit from 'express-rate-limit'; const limiter = rateLimit({ windowMs: 15 * 60 * 1000, // 15 minutes max: 100 // limit each IP to 100 requests per windowMs }); app.use('/mcp', limiter); ``` 3. **Add Request Logging**: ```typescript app.post('/mcp', async (req, res) => { console.log({ timestamp: new Date().toISOString(), method: req.body.method, params: req.body.params, ip: req.ip }); // ... handle request }); ``` ## Deployment Considerations ### Docker Deployment The Docker configuration is already set up, but should be enhanced with: 1. **Environment Variables for Auth**: ```yaml # docker-compose.yml environment: - NODE_ENV=production - PORT=3000 - MCP_AUTH_TOKEN=${MCP_AUTH_TOKEN} ``` 2. **Health Check Enhancement**: ```dockerfile HEALTHCHECK --interval=30s --timeout=3s \ CMD node -e "require('http').get('http://localhost:3000/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))" ``` ### Production Checklist - [ ] Set `MCP_AUTH_TOKEN` environment variable - [ ] Enable HTTPS/TLS for production - [ ] Configure proper CORS origins (not wildcard) - [ ] Add rate limiting - [ ] Set up audit logging - [ ] Implement OAuth 2.0 if exposing publicly - [ ] Add input validation for dates - [ ] Set up monitoring and alerts - [ ] Document security model for users ## Validation Tools ### Testing Protocol Compliance ```bash # Initialize connection echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | node dist/index.js # List tools echo '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | node dist/index.js # Call tool echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"check_school_vacation","arguments":{"date":"25/12/2024","region":"flanders"}}}' | node dist/index.js ``` ### HTTP Endpoint Testing ```bash # Initialize curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' # Test tool curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"check_school_vacation","arguments":{"date":"25/12/2024","region":"flanders"}}}' ``` ## Summary ### What Changed 1. ✓ SDK updated from v0.4.0 → v1.21.0 2. ✓ Protocol version updated to 2025-06-18 3. ✓ Server constructor API updated (breaking change) 4. ✓ All server modes tested and working ### What's Missing (Priority Order) 1. **HIGH**: OAuth/Authorization layer 2. **HIGH**: User consent flows 3. **HIGH**: Basic authentication (env token) 4. **MEDIUM**: Rate limiting 5. **MEDIUM**: Structured output schemas 6. **MEDIUM**: Input validation 7. **LOW**: Elicitation support (only if needed) 8. **LOW**: Audit logging ### Next Steps 1. Implement basic token-based authentication (see recommendations above) 2. Add rate limiting to prevent abuse 3. Consider OAuth 2.0 implementation for production use 4. Evaluate whether to migrate to `McpServer` high-level API 5. Add comprehensive security documentation for users ## References - [MCP Specification 2025-06-18](https://modelcontextprotocol.io/specification/2025-06-18) - [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk) - [OAuth 2.0 RFC 6749](https://tools.ietf.org/html/rfc6749) - [Resource Indicators RFC 8707](https://tools.ietf.org/html/rfc8707)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/KVerduyn/School_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server