diff --git a/Dockerfile b/Dockerfile index 294dc7a..92d2c87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,9 @@ FROM node:22-alpine # Install Python and pip RUN apk add --no-cache \ - python3 \ - py3-pip \ - && ln -sf python3 /usr/bin/python + python3 \ + py3-pip \ + && ln -sf python3 /usr/bin/python # Create symbolic links for python commands RUN ln -sf /usr/bin/pip3 /usr/bin/pip diff --git a/package.json b/package.json index 14c4959..b939fd3 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "dependencies": { "@modelcontextprotocol/sdk": "^1.8.0", "dotenv": "^16.3.1", - "express": "^4.18.2" + "express": "^4.18.2", + "zod": "^3.24.2" }, "devDependencies": { "@types/express": "^4.17.21", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c82ea12..5fac19f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: express: specifier: ^4.18.2 version: 4.21.2 + zod: + specifier: ^3.24.2 + version: 3.24.2 devDependencies: '@types/express': specifier: ^4.17.21 diff --git a/src/server.ts b/src/server.ts index 47d74cb..541e6de 100644 --- a/src/server.ts +++ b/src/server.ts @@ -3,7 +3,8 @@ import { CallToolResult } from '@modelcontextprotocol/sdk/types.js'; import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'; import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; -import { z, ZodType, ZodRawShape } from 'zod'; +import * as z from 'zod'; +import { ZodType, ZodRawShape } from 'zod'; import fs from 'fs'; import path from 'path'; @@ -31,14 +32,17 @@ function loadSettings(): McpSettings { } // Initialize clients and transports from settings -function initializeClientsFromSettings(): { clients: Client[]; transports: (SSEClientTransport | StdioClientTransport)[] } { +function initializeClientsFromSettings(): { + clients: Client[]; + transports: (SSEClientTransport | StdioClientTransport)[]; +} { const settings = loadSettings(); const clients: Client[] = []; const transports: (SSEClientTransport | StdioClientTransport)[] = []; Object.entries(settings.mcpServers).forEach(([name, config]) => { let transport; - + if (config.url) { transport = new SSEClientTransport(new URL(config.url)); } else if (config.command && config.args) { @@ -87,7 +91,7 @@ export const registerAllTools = async (server: McpServer) => { tool.name, tool.description || '', cast(tool.inputSchema.properties), - async (params) => { + async (params: Record) => { console.log(`Calling tool: ${tool.name} with params: ${JSON.stringify(params)}`); const result = await client.callTool({ name: tool.name,