index-fixed.tsā¢9.77 kB
#!/usr/bin/env node
/**
* EuConquisto Composer MCP Server - Fixed Build Version
*
* @version 0.1.5
* @created 2025-06-09
* @updated 2025-06-09
* @author EuConquisto Development Team
*
* @description Fixed MCP-compliant server with proper SDK integration
*/
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
/**
* Fixed MCP server that builds successfully
*/
async function main(): Promise<void> {
try {
// Set up environment
process.title = 'euconquisto-composer-mcp-server-fixed';
// Handle process events
process.on('SIGINT', () => {
console.error('Shutting down gracefully...');
process.exit(0);
});
// Create MCP server
const server = new McpServer({
name: "euconquisto-composer-fixed",
version: "0.1.5",
description: "EuConquisto Composer MCP Server - Fixed Build"
});
/**
* Test Connection Tool - Verifies MCP server functionality
*/
server.tool(
"test-connection",
"Test MCP server connectivity and functionality",
{
message: z.string().optional().describe("Test message")
},
async (params) => {
const result = {
success: true,
message: "š EuConquisto Composer MCP Server Fixed is working!",
timestamp: new Date().toISOString(),
buildStatus: "ā
FIXED - TypeScript compilation successful",
status: "Fixed and ready for widget creation implementation ā
"
};
return {
content: [{
type: "text" as const,
text: JSON.stringify(result, null, 2)
}]
};
}
);
/**
* Get Widget Info Tool - Returns detailed widget analysis
*/
server.tool(
"get-widget-info",
"Get detailed information about educational widgets",
{
widget: z.enum(["text", "image", "header", "list", "gallery", "hotspot"]).describe("Widget type to get info about")
},
async (params) => {
const widgetInfo = {
text: {
type: "texto",
status: "completed",
properties: 8,
subtypes: 9,
description: "Rich text content with formatting and layout options"
},
image: {
type: "imagem",
status: "completed",
properties: 12,
subtypes: 5,
description: "Image display with caption and zoom functionality"
},
header: {
type: "cabecalho",
status: "completed",
properties: 44,
subtypes: 6,
examples: ["template-1", "template-2", "template-3"],
special: "Template 3 includes SCORM LMS integration",
description: "Header sections with background media, categories, and author info"
},
list: {
type: "lista",
status: "completed",
properties: 10,
subtypes: 3,
description: "Lists with various formatting options and rich text per item"
},
gallery: {
type: "galeria",
status: "completed",
properties: 10,
subtypes: 1,
description: "Slideshow/gallery for displaying multiple images with navigation"
},
hotspot: {
type: "interatividade",
subtype: "hotspot-interactive",
status: "completed",
properties: 15,
icons: 25,
description: "Interactive image with clickable information points and 25+ icon options"
}
};
const info = widgetInfo[params.widget as keyof typeof widgetInfo];
if (!info) {
throw new Error(`Widget type '${params.widget}' not found`);
}
const result = {
success: true,
widget: params.widget,
...info,
message: `Widget analysis retrieved for ${params.widget}`,
analysisComplete: true
};
return {
content: [{
type: "text" as const,
text: JSON.stringify(result, null, 2)
}]
};
}
);
/**
* Get Composer URL Tool - Returns authenticated Composer access URL
*/
server.tool(
"get-composer-url",
"Get authenticated URL for EuConquisto Composer access",
{
path: z.string().optional().describe("Optional path within Composer")
},
async (params) => {
const baseURL = "https://composer.euconquisto.com/#/embed";
const orgId = "36c92686-c494-ec11-a22a-dc984041c95d";
const jwtToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImFkbWluLmRlc2Vudm9sdmltZW50b0BldWNvbnF1aXN0by5jb20iLCJuYW1lIjoiQWRtaW4gRGV2Iiwib2lkIjoiNWZiM2RlYzYtYzQ5NC1lYzExLWEyMmEtZGM5ODQwNDFjOTVkIiwiZGlyZWN0b3J5IjoiYjBmZWY4NjAtYzQ5NC1lYzExLWEyMmEtZGM5ODQwNDFjOTVkIiwiYXBpbSI6IkVFQzUzQTI0LUVDMEUtNDFCOS05NDA1LTg2QTE3NTAwREIzNCIsImRpcm4iOiJEZXNlbnZvbHZpbWVudG8iLCJyb2xlIjpbIlJldmlld0NvbnRyaWJ1dG9yIiwiQ29udHJpYnV0b3JHbG9iYWwiLCJBZG1pbmlzdHJhdG9yR2xvYmFsIl0sImRjbiI6WyJINHNJQUFBQUFBQUFBMkptWUdBd1pRQ0JaQXVqRkdNREM0dFYyMXRTRS1vZHA5NElpMnVVYTNqMXNxRXl6YWhrN3ZxWlN5MG5sL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nd1dVhaa3RzYWlrc3pMZW5NcTFUVjRUMmF5QUdyVHB3UlUzMFMwc3hfQ3pCRVlLREV0b2s4eDI5TGlnUnlHMnVfZDVpOHRyVEJ1WTNjVFdzSXVIdzRibXNVV1lkTXNwblRMMXpwNE1LWUFBQURfX3ciXSwibmJmIjoxNzQ4ODc2OTU1LCJleHAiOjE3NTE0Njg5NTUsImlhdCI6MTc0ODg3Njk1NSwiaXNzIjoiaHR0cHM6Ly9hcGkuZGlnaXRhbHBhZ2VzLmNvbS5iciIsImF1ZCI6IkV1Q29ucXVpc3RvIn0.iTUfl6-mwLwFaxYYPf6PufRSYbSJlw3tKejmbc5G42g";
const path = params?.path || 'home';
const embedURL = `${baseURL}/auth-with-token/pt_br/${path}/${orgId}/${jwtToken}`;
const result = {
success: true,
embedURL,
path,
message: "š Composer embed URL with JWT authentication",
usage: "Open this URL to access EuConquisto Composer with admin authentication",
authentication: "Admin-level access with development JWT token",
organization: "EuConquisto Development Environment",
buildStatus: "ā
FIXED - Ready for widget creation implementation"
};
return {
content: [{
type: "text" as const,
text: JSON.stringify(result, null, 2)
}]
};
}
);
// Start server with STDIO transport
const transport = new StdioServerTransport();
console.error('Starting EuConquisto Composer MCP Server (Fixed Build)...');
await server.connect(transport);
console.error('ā
Fixed MCP server started successfully');
console.error('š§ Available tools:');
console.error(' ⢠test-connection - Server connectivity test');
console.error(' ⢠get-widget-info - Widget analysis access');
console.error(' ⢠get-composer-url - Composer URL construction');
console.error('š Status:');
console.error(' ⢠ā
BUILD FIXED - TypeScript compilation successful');
console.error(' ⢠ā
MCP SDK 1.0.0 compatibility resolved');
console.error(' ⢠ā
Content format properly structured');
console.error(' ⢠šÆ NEXT: Widget creation features needed');
console.error('š Ready for widget creation implementation!');
} catch (error) {
console.error('ā Failed to start fixed MCP server:', error);
process.exit(1);
}
}
// Start the fixed server
main().catch((error) => {
console.error('š„ Fatal error:', error);
process.exit(1);
});