From 20c1a88f491f7a47b309ee9eb07baffdde5450f9 Mon Sep 17 00:00:00 2001 From: Laurynas Keturakis Date: Wed, 11 Dec 2024 14:17:57 +0100 Subject: [PATCH] simplify file structure --- packages/mcp-server/{src => }/index.ts | 51 +++++++++++++++++++++++--- packages/mcp-server/package.json | 2 +- packages/mcp-server/src/tools.ts | 44 ---------------------- packages/mcp-server/tsconfig.json | 2 +- 4 files changed, 47 insertions(+), 52 deletions(-) rename packages/mcp-server/{src => }/index.ts (80%) delete mode 100644 packages/mcp-server/src/tools.ts diff --git a/packages/mcp-server/src/index.ts b/packages/mcp-server/index.ts similarity index 80% rename from packages/mcp-server/src/index.ts rename to packages/mcp-server/index.ts index 258605d83..8ffe46f2c 100644 --- a/packages/mcp-server/src/index.ts +++ b/packages/mcp-server/index.ts @@ -4,16 +4,55 @@ import { type CallToolRequest, CallToolRequestSchema, ListToolsRequestSchema, + type Tool, } from "@modelcontextprotocol/sdk/types.js"; -import { - getSpansForTraceTool, - listAllRegisteredRoutesTool, - listAllRequestsTool, - listTracesTool, -} from "./tools.js"; const DEFAULT_FIBERPLANE_STUDIO_URL = "http://localhost:8788"; +// Tool definitions +const listTracesTool: Tool = { + name: "fiberplane_list_traces", + description: + "Retrieves a list of all traces, showing the root spans for each trace", + inputSchema: { + type: "object", + properties: {}, + }, +}; + +const getSpansForTraceTool: Tool = { + name: "fiberplane_get_spans_for_trace", + description: "Retrieves all spans for a specific trace ID", + inputSchema: { + type: "object", + properties: { + traceId: { + type: "string", + description: "The ID of the trace to fetch spans for", + }, + }, + required: ["traceId"], + }, +}; + +const listAllRegisteredRoutesTool: Tool = { + name: "fiberplane_list_all_registered_routes", + description: "Lists all registered routes in the studio", + inputSchema: { + type: "object", + properties: {}, + }, +}; + +const listAllRequestsTool: Tool = { + name: "fiberplane_list_all_requests", + description: "Lists all requests, logged in the studio", + inputSchema: { + type: "object", + properties: {}, + }, +}; + async function main() { console.log("Starting Fiberplane MCP Server ..."); diff --git a/packages/mcp-server/package.json b/packages/mcp-server/package.json index 6a3c8ba7b..c1a12f502 100644 --- a/packages/mcp-server/package.json +++ b/packages/mcp-server/package.json @@ -1,7 +1,7 @@ { "name": "@fiberplane/mcp-server-fiberplane", "type": "module", - "version": "0.1.0", + "version": "0.1.1", "access": "public", "description": "MCP server for Fiberplane Studio", "main": "dist/index.js", diff --git a/packages/mcp-server/src/tools.ts b/packages/mcp-server/src/tools.ts deleted file mode 100644 index f04e651ff..000000000 --- a/packages/mcp-server/src/tools.ts +++ /dev/null @@ -1,44 +0,0 @@ -import type { Tool } from "@modelcontextprotocol/sdk/types.js"; - -export const listTracesTool: Tool = { - name: "fiberplane_list_traces", - description: - "Retrieves a list of all traces, showing the root spans for each trace", - inputSchema: { - type: "object", - properties: {}, - }, -}; - -export const getSpansForTraceTool: Tool = { - name: "fiberplane_get_spans_for_trace", - description: "Retrieves all spans for a specific trace ID", - inputSchema: { - type: "object", - properties: { - traceId: { - type: "string", - description: "The ID of the trace to fetch spans for", - }, - }, - required: ["traceId"], - }, -}; - -export const listAllRegisteredRoutesTool: Tool = { - name: "fiberplane_list_all_registered_routes", - description: "Lists all registered routes in the studio", - inputSchema: { - type: "object", - properties: {}, - }, -}; - -export const listAllRequestsTool: Tool = { - name: "fiberplane_list_all_requests", - description: "Lists all requests, logged in the studio", - inputSchema: { - type: "object", - properties: {}, - }, -}; diff --git a/packages/mcp-server/tsconfig.json b/packages/mcp-server/tsconfig.json index 8c52d05af..17c953d5b 100644 --- a/packages/mcp-server/tsconfig.json +++ b/packages/mcp-server/tsconfig.json @@ -15,7 +15,7 @@ "skipLibCheck": true }, "include": [ - "src/**/*.ts" + "index.ts", ], "exclude": [ "node_modules",