Skip to main content
Glama
index.ts1.74 kB
// Import the required MCP modules import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { v7 as uuidv7 } from 'uuid'; import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js"; // Create the server const server = new Server({ name: "uuid-mcp-provider", version: "1.0.0" }, { capabilities: { tools: {} // We're only providing tools functionality } }); // Register the tools/list endpoint to advertise our generateUuid tool server.setRequestHandler( ListToolsRequestSchema, async () => { return { tools: [ { name: "generateUuid", description: "Generate a UUID v7 that's timestamp-based and guaranteed to be unique", inputSchema: { type: "object", properties: {} } } ] }; } ); // Register the tools/call endpoint to handle tool execution server.setRequestHandler( CallToolRequestSchema, async (request) => { if (request.params.name === "generateUuid") { // UUID v7 is timestamp-based with additional random data for uniqueness const uuid = uuidv7(); return { content: [ { type: "text", text: uuid } ] }; } throw new Error(`Unknown tool: ${request.params.name}`); } ); // Start the server async function main() { try { const transport = new StdioServerTransport(); await server.connect(transport); console.error("UUID MCP Provider running on stdio..."); } catch (error) { console.error("Error starting server:", error); process.exit(1); } } main();

Implementation Reference

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/tanker327/uuid-mcp'

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