Skip to main content
Glama

Cloudflare Remote PostgreSQL Database MCP Server

index.ts2.87 kB
import { McpAgent } from "agents/mcp"; import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; import { withDatabase } from "./database/utils"; import { closeDb } from "./database/connection"; // Simple MCP server for speedrunethereum.com build discovery export class SpeedrunMCP extends McpAgent<Env, Record<string, never>, Record<string, never>> { server = new McpServer({ name: "SpeedRunEthereum Build Discovery", version: "1.0.0", }); /** * Cleanup database connections when Durable Object is shutting down */ async cleanup(): Promise<void> { try { await closeDb(); console.log("Database connections closed successfully"); } catch (error) { console.error("Error during database cleanup:", error); } } /** * Durable Objects alarm handler - used for cleanup */ async alarm(): Promise<void> { await this.cleanup(); } async init() { // Register speedrun build search tool this.server.tool( "searchBuilds", "Search for Scaffold-ETH 2 builds on speedrunethereum.com similar to your project idea", { query: z.string().min(1).describe("Description of what you want to build (e.g., 'DEX', 'NFT marketplace', 'voting system')"), limit: z.number().optional().default(5).describe("Maximum number of builds to return (default: 5)"), }, async ({ query, limit = 5 }) => { try { // TODO: Implement actual search logic // For now, return a placeholder response return { content: [ { type: "text", text: `🏗️ **SpeedRunEthereum Build Search**\n\n**Query:** "${query}"\n\n**Placeholder Response:**\nSearch functionality will be implemented to find Scaffold-ETH 2 builds similar to: "${query}"\n\n**Limit:** ${limit} builds\n\n*This will connect to the speedrunethereum.com database to find relevant builds...*`, }, ], }; } catch (error) { console.error("searchBuilds error:", error); return { content: [ { type: "text", text: `Error searching builds: ${error instanceof Error ? error.message : String(error)}`, isError: true, }, ], }; } }, ); } } export default { fetch(request: Request, env: Env, ctx: ExecutionContext) { const url = new URL(request.url); if (url.pathname === "/sse" || url.pathname === "/sse/message") { return SpeedrunMCP.serveSSE("/sse").fetch(request, env, ctx); } if (url.pathname === "/mcp") { return SpeedrunMCP.serve("/mcp").fetch(request, env, ctx); } return new Response("SpeedRunEthereum MCP Server - Use /mcp or /sse endpoints", { status: 200 }); }, };

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/technophile-04/sre-mcp'

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