Skip to main content
Glama
interface-mapping.md•10.8 kB
# Interface Mapping & Integration Guide **Document Version**: 1.1 **Project Version**: 0.1.0 **Last Updated**: 2025-06-08 **Revision**: MCP Compliance Integration **Status**: Phase 1 Revised - Ready for Phase 2 ## šŸŽÆ Overview This document provides comprehensive mapping of existing TypeScript interfaces to MCP (Model Context Protocol) primitives, enabling full compliance with Anthropic's official MCP specification for educational content servers. ## šŸ“‹ MCP Primitive Mapping ### Core MCP Architecture Compliance **Required MCP Primitives:** - **Resources**: URI-based structured content with subscription support - **Tools**: Executable functions invokable by LLMs with user consent - **Prompts**: Pre-defined templates for guided interactions ### Interface to MCP Primitive Mapping #### 1. ContentElementType → MCP Resources **Existing Interface Mapping:** ```typescript // content-elements.ts exports export type ContentElementType = | TextElement | ImageElement | VideoElement | QuizElement | InteractiveElement | LayoutElement | CodeElement; // Maps to MCP Resources server.resource("content-elements", new ResourceTemplate("content://{elementType}/{elementId}", { list: ["elementType"] }), async (uri, params) => { const { elementType, elementId } = params; return await contentAPI.getElement(elementId); } ); server.resource("element-library", new ResourceTemplate("library://elements/{category}/{difficulty}", { list: ["category"] }), async (uri, params) => { return await contentAPI.listElements({ category: params.category, difficulty: params.difficulty }); } ); ``` #### 2. ContentComposition → MCP Resources **Existing Interface Mapping:** ```typescript // content-elements.ts ContentComposition interface // Maps to hierarchical MCP Resources server.resource("compositions", new ResourceTemplate("composer://compositions/{compositionId}", { list: [] }), async (uri, params) => { return await contentAPI.getComposition(params.compositionId); } ); server.resource("composition-library", new ResourceTemplate("composer://library/{subject}/{grade}", { list: ["subject"] }), async (uri, params) => { return await contentAPI.listCompositions({ subject: params.subject, gradeLevel: params.grade }); } ); ``` #### 3. ContentAPI Methods → MCP Tools **Existing Interface Mapping:** ```typescript // mcp-server.ts ContentAPI interface methods // Map to executable MCP Tools server.tool("create-element", { elementType: z.enum(["text", "image", "video", "quiz", "interactive", "layout", "code"]), content: z.object({}).passthrough(), metadata: z.object({}).optional() }, async (params) => { return await contentAPI.createElement({ type: params.elementType, content: params.content, metadata: params.metadata }); }); server.tool("update-element", { elementId: z.string(), updates: z.object({}).passthrough(), version: z.string().optional() }, async (params) => { return await contentAPI.updateElement( params.elementId, params.updates, params.version ); }); server.tool("create-composition", { elements: z.array(z.string()), layout: z.object({}).passthrough(), settings: z.object({}).optional() }, async (params) => { return await contentAPI.createComposition({ elements: params.elements, layout: params.layout, settings: params.settings }); }); ``` #### 4. EducationalAPI Methods → MCP Tools **Existing Interface Mapping:** ```typescript // educational-automation.ts EducationalAPI interface // Map to AI-powered educational MCP Tools server.tool("generate-course", { topic: z.string(), gradeLevel: z.string(), duration: z.number(), learningObjectives: z.array(z.string()).optional(), difficulty: z.enum(["beginner", "intermediate", "advanced"]).optional() }, async (params) => { return await educationalAPI.generateCourse({ topic: params.topic, gradeLevel: params.gradeLevel, estimatedDuration: params.duration, learningObjectives: params.learningObjectives, difficulty: params.difficulty }); }); server.tool("create-assessment", { courseId: z.string(), assessmentType: z.enum(["quiz", "assignment", "project", "exam"]), questionCount: z.number().min(1).max(50), difficulty: z.enum(["beginner", "intermediate", "advanced"]) }, async (params) => { return await educationalAPI.createAssessment({ courseId: params.courseId, type: params.assessmentType, questionCount: params.questionCount, difficulty: params.difficulty }); }); server.tool("analyze-learning-progress", { userId: z.string(), courseId: z.string(), timeframe: z.enum(["week", "month", "semester", "year"]).optional() }, async (params) => { return await educationalAPI.analyzeLearningProgress( params.userId, params.courseId, params.timeframe ); }); ``` #### 5. Authentication System → MCP Session Management **Existing Interface Mapping:** ```typescript // authentication.ts AuthenticationManager // Maps to MCP session and security features server.tool("authenticate-user", { provider: z.enum(["google", "microsoft", "local", "ldap"]), credentials: z.object({ username: z.string().optional(), password: z.string().optional(), token: z.string().optional() }) }, async (params) => { return await authManager.authenticate( params.provider, params.credentials ); }); server.tool("validate-permissions", { userId: z.string(), action: z.string(), resource: z.string() }, async (params) => { return await authManager.checkPermission( params.userId, params.action, params.resource ); }); ``` #### 6. Educational Templates → MCP Prompts **Educational Prompt Templates:** ```typescript // Map educational workflows to reusable MCP Prompts server.prompt("lesson-plan-template", async (args) => ({ messages: [ { role: "user", content: `Create a comprehensive lesson plan for: Topic: {{topic}} Grade Level: {{gradeLevel}} Duration: {{duration}} minutes Learning Objectives: {{objectives}} Include: Introduction, main activities, assessment, and homework.` } ] })); server.prompt("quiz-generation-template", async (args) => ({ messages: [ { role: "user", content: `Generate a {{questionCount}}-question {{difficulty}} quiz for: Subject: {{subject}} Topic: {{topic}} Grade Level: {{gradeLevel}} Include multiple choice, true/false, and short answer questions.` } ] })); server.prompt("learning-analytics-template", async (args) => ({ messages: [ { role: "user", content: `Analyze learning progress and provide recommendations: Student Performance: {{performanceData}} Course Content: {{courseContent}} Time Period: {{timeframe}} Provide insights on strengths, weaknesses, and personalized recommendations.` } ] })); ``` ## šŸ“‹ MCP Integration Architecture ### Transport Layer Compliance **STDIO Transport (Required for Claude Desktop):** ```typescript import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; const server = new McpServer({ name: "euconquisto-composer", version: "0.1.1" }); // STDIO transport for local Claude Desktop integration const transport = new StdioServerTransport(); server.connect(transport); ``` ### Protocol Layer Compliance **JSON-RPC 2.0 Exact Format:** ```typescript // All MCP messages must use exact JSON-RPC 2.0 format interface MCPMessage { jsonrpc: "2.0"; // Exact string required id?: string | number; // Required for requests/responses method?: string; // Required for requests params?: any; // Optional parameters result?: any; // Present in success responses error?: { // Present in error responses code: number; message: string; data?: any; }; } ``` ### Capability Declaration **Required MCP Server Capabilities:** ```typescript // Declare all capabilities during initialization const capabilities = { resources: { subscribe: true, // Support resource subscriptions listChanged: true // Support list change notifications }, tools: { listChanged: true // Support tool list change notifications }, prompts: { listChanged: true // Support prompt list change notifications } }; ``` ## šŸ“‹ Integration Validation Requirements ### MCP Compliance Testing **Protocol Validation:** ```typescript describe('MCP Protocol Compliance', () => { it('should use exact JSON-RPC 2.0 format'); it('should implement proper initialization handshake'); it('should declare all capabilities accurately'); it('should handle all required MCP methods'); it('should use STDIO transport correctly'); }); ``` **Resource Validation:** ```typescript describe('MCP Resource Integration', () => { it('should expose content elements as MCP resources'); it('should support URI template navigation'); it('should handle resource subscription updates'); it('should validate resource access permissions'); }); ``` **Tool Integration Validation:** ```typescript describe('MCP Tool Integration', () => { it('should map ContentAPI methods to MCP tools'); it('should map EducationalAPI methods to MCP tools'); it('should validate tool parameter schemas with Zod'); it('should require user consent for all tool executions'); it('should handle tool execution errors properly'); }); ``` ## šŸ“‹ Performance & Compatibility ### Response Time Benchmarks - **Resource Access**: <100ms per resource request - **Tool Execution**: <500ms for simple operations, <5s for AI generation - **Prompt Template**: <50ms for template rendering - **Authentication**: <100ms for token validation ### Claude Desktop Integration - **STDIO Compatibility**: Full stdin/stdout JSON communication - **Session Management**: Stateful connection with proper lifecycle - **Error Handling**: Standard JSON-RPC error codes - **User Consent**: Required for all tool executions --- ## šŸ“œ Document Information **Document Version**: 1.1 **Project Version**: 0.1.0 **Revision**: MCP Compliance Integration **Scope**: Complete interface to MCP primitive mapping **Audience**: Development team, MCP implementers **Review Cycle**: Updated with each MCP integration milestone **Created**: 2025-06-08 **Last Updated**: 2025-06-08 **Next Review**: Upon Phase 2 MCP implementation completion **Maintenance**: Updated with each interface enhancement --- *EuConquisto Composer MCP Server PoC - Interface Mapping & Integration Guide v1.1* *MCP Compliance Integration Documentation*

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/rkm097git/euconquisto-composer-mcp-poc'

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