We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/bermingham85/mcp-puppet-pipeline'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
// MCP SERVER INTEGRATION FILE
// Add this to your MCP server to enable video processing tools
const WebSocket = require('ws');
const { MCPVideoProcessingTools } = require('./video_processing_tools');
/**
* MCP Server with Video Processing Extension
*/
class MCPServerWithVideoTools {
constructor(port = 3000) {
this.port = port;
this.tools = new Map();
this.videoTools = new MCPVideoProcessingTools();
// Register video processing tools
this.registerVideoTools();
// Register existing puppet tools
this.registerExistingTools();
}
registerVideoTools() {
console.log('\nπΉ Registering Video Processing Tools...\n');
this.videoTools.tools.forEach(tool => {
this.tools.set(tool.name, {
description: tool.description,
inputSchema: tool.inputSchema,
handler: tool.handler
});
console.log(` β
${tool.name}`);
});
console.log('\n Total video tools registered:', this.videoTools.tools.length);
}
registerExistingTools() {
// Register existing puppet production tools
const puppetTools = [
'puppet_production_pipeline',
'puppet_pipeline_status',
'hybrid_puppet_pipeline',
'create_scene_image',
'create_voice_video',
'gremlos_weekly_pipeline'
];
console.log('\nπ¨ Existing Puppet Tools Available:\n');
puppetTools.forEach(tool => {
console.log(` β
${tool}`);
});
}
start() {
const wss = new WebSocket.Server({ port: this.port, path: '/mcp' });
wss.on('connection', (ws) => {
console.log('π Client connected');
ws.on('message', async (message) => {
try {
const request = JSON.parse(message.toString());
console.log('π₯ Request:', request.method);
let response;
// Handle tool listing
if (request.method === 'tools/list') {
response = {
jsonrpc: '2.0',
id: request.id,
result: {
tools: Array.from(this.tools.entries()).map(([name, tool]) => ({
name,
description: tool.description,
inputSchema: tool.inputSchema
}))
}
};
}
// Handle video tool execution
else if (this.tools.has(request.method)) {
const tool = this.tools.get(request.method);
try {
const result = await tool.handler(request.params);
response = {
jsonrpc: '2.0',
id: request.id,
result
};
} catch (error) {
response = {
jsonrpc: '2.0',
id: request.id,
error: {
code: -32603,
message: error.message
}
};
}
}
// Handle existing puppet tools (pass through)
else {
// This would forward to your existing puppet pipeline handler
response = await this.handlePuppetTool(request);
}
ws.send(JSON.stringify(response));
console.log('π€ Response sent');
} catch (error) {
console.error('Error:', error);
ws.send(JSON.stringify({
jsonrpc: '2.0',
error: {
code: -32700,
message: 'Parse error'
}
}));
}
});
ws.on('close', () => {
console.log('π Client disconnected');
});
});
console.log(`\nπ MCP Server with Video Tools running on ws://localhost:${this.port}/mcp\n`);
this.printAvailableTools();
}
async handlePuppetTool(request) {
// This would integrate with your existing puppet tools
// For now, returning a placeholder response
return {
jsonrpc: '2.0',
id: request.id,
result: {
message: `Puppet tool ${request.method} would be executed here`,
params: request.params
}
};
}
printAvailableTools() {
console.log('π Available MCP Tools:\n');
console.log('Video Processing:');
this.videoTools.tools.forEach(tool => {
console.log(` β’ ${tool.name} - ${tool.description}`);
});
console.log('\nPuppet Production:');
console.log(' β’ puppet_production_pipeline - Generate puppet variations');
console.log(' β’ hybrid_puppet_pipeline - Complete puppet + scene + voice pipeline');
console.log(' β’ create_scene_image - Generate scenes with character');
console.log(' β’ create_voice_video - Create narrated videos');
console.log(' β’ gremlos_weekly_pipeline - Viral content generation');
}
}
// Export for use in existing MCP server
module.exports = {
MCPServerWithVideoTools,
// Function to add tools to existing server
addVideoToolsToServer(existingServer) {
const videoTools = new MCPVideoProcessingTools();
videoTools.tools.forEach(tool => {
if (existingServer.addTool) {
existingServer.addTool(tool.name, tool.handler, tool.description);
} else if (existingServer.registerTool) {
existingServer.registerTool({
name: tool.name,
description: tool.description,
inputSchema: tool.inputSchema,
handler: tool.handler
});
}
});
return videoTools;
}
};
// Standalone server startup
if (require.main === module) {
const server = new MCPServerWithVideoTools(3000);
server.start();
}