Skip to main content
Glama
server.ts1.17 kB
import { FastMCP } from "fastmcp"; import { createTools } from "./tools"; export function createServer() { // Initialize server const server = new FastMCP({ name: "flow-defi-mcp", version: "0.1.11", }); // Register all tools const tools = createTools(); for (const tool of tools) { server.addTool({ name: tool.name, description: tool.description, parameters: tool.inputSchema, execute: async (args, context) => { try { const result = await tool.handler(args); if (typeof result.content[0].text === "string") { return result.content[0].text; } return JSON.stringify(result.content[0].text); } catch (err) { console.error("Error in tool execution:", err); return "Internal server error in tool execution."; } }, }); } return server; } export function startServer(server: FastMCP, useSSE: boolean) { if (useSSE) { server.start({ transportType: "sse", sse: { endpoint: "/sse", port: 8080, }, }); } else { server.start({ transportType: "stdio", }); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Outblock/flow-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server