MCPcopy
hub / github.com/antvis/mcp-server-chart / createServer

Function createServer

src/server.ts:19–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17 * Creates and configures an MCP server for chart generation.
18 */
19export function createServer(): Server {
20 const server = new Server(
21 {
22 name: "mcp-server-chart",
23 version: "0.8.x",
24 },
25 {
26 capabilities: {
27 tools: {},
28 },
29 },
30 );
31
32 setupToolHandlers(server);
33
34 server.onerror = (e: Error) => {
35 logger.error("Server encountered an error, shutting down", e);
36 };
37
38 process.on("SIGINT", async () => {
39 logger.info("SIGINT received, shutting down server...");
40 await server.close();
41 process.exit(0);
42 });
43
44 return server;
45}
46
47/**
48 * Gets enabled tools based on environment variables.

Callers 3

runStdioServerFunction · 0.85
startSSEMcpServerFunction · 0.85

Calls 1

setupToolHandlersFunction · 0.85

Tested by

no test coverage detected