Skip to main content
Glama
index.ts1.31 kB
#!/usr/bin/env bun import { createGoogleMcpServer } from "./server-setup"; import { createHttpTransport } from "./transports/http"; import { createStdioTransport } from "./transports/stdio"; async function main() { // Create the MCP server instance const server = createGoogleMcpServer(); // Check transport type from environment variable const transportType = process.env.MCP_TRANSPORT || "stdio"; const port = parseInt(process.env.PORT || "3000"); if (transportType.toLowerCase() === "http") { const httpTransport = createHttpTransport(server, port); await httpTransport.start(); // Handle graceful shutdown process.on("SIGINT", async () => { await httpTransport.close(); process.exit(0); }); process.on("SIGTERM", async () => { await httpTransport.close(); process.exit(0); }); } else { // Default to stdio transport const stdioTransport = createStdioTransport(server); await stdioTransport.start(); // Handle graceful shutdown process.on("SIGINT", async () => { await stdioTransport.close(); process.exit(0); }); process.on("SIGTERM", async () => { await stdioTransport.close(); process.exit(0); }); } } // Start the server main().catch((error) => { process.exit(1); });

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/vakharwalad23/google-mcp'

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