import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { scrapeSchemas, scrapeDescriptions, getScrapeHandler } from './tools/scrape.js';
import { timelineSchemas, timelineDescriptions, timelineHandlers } from './tools/timeline.js';
import { analysisSchemas, analysisDescriptions, analysisHandlers } from './tools/analysis.js';
export function createServer(): McpServer {
const server = new McpServer({
name: 'social-research-mcp',
version: '0.1.0',
});
// Register scrape tools (7 platforms)
for (const [name, schema] of Object.entries(scrapeSchemas)) {
const description = scrapeDescriptions[name];
const handler = getScrapeHandler(name);
server.tool(name, description, schema.shape, async (params: Record<string, unknown>) => {
return handler(params);
});
}
// Register timeline tools
for (const [name, schema] of Object.entries(timelineSchemas)) {
const description = timelineDescriptions[name];
const handler = timelineHandlers[name as keyof typeof timelineHandlers];
server.tool(name, description, schema.shape, async (params: Record<string, unknown>) => {
return handler(params);
});
}
// Register analysis tools
for (const [name, schema] of Object.entries(analysisSchemas)) {
const description = analysisDescriptions[name];
const handler = analysisHandlers[name as keyof typeof analysisHandlers];
server.tool(name, description, schema.shape, async (params: Record<string, unknown>) => {
return handler(params);
});
}
return server;
}