Skip to main content
Glama
index.ts2.47 kB
#!/usr/bin/env node /* This file provides essential functions and tools for MCP servers, serving as a library. The ActorsMcpServer should be the only class exported from the package */ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { z } from 'zod'; export { ActorsMcpServer } from './mcp/server.js'; // Optional: If you have user-level config, define it here // This should map to the config in your smithery.yaml file export const configSchema = z.object({ debug: z.boolean().default(false).describe('Enable debug logging'), }); export default function createServer({ config, }: { config: z.infer<typeof configSchema> // Define your config in smithery.yaml }) { const server = new McpServer({ name: 'Say Hello', version: '1.0.0', }); console.log('Config:', config); // Add a tool server.registerTool( 'hello', { title: 'Hello Tool', description: 'Say hello to someone', inputSchema: { name: z.string().describe('Name to greet') }, }, async ({ name }) => ({ content: [{ type: 'text', text: `Hello, ${name}!` }], }), ); // Add a resource server.registerResource( 'hello-world-history', 'history://hello-world', { title: 'Hello World History', description: "The origin story of the famous 'Hello, World' program", }, async (uri: URL) => ({ contents: [ { uri: uri.href, text: '"Hello, World" first appeared in a 1972 Bell Labs memo by Brian Kernighan and later became', mimeType: 'text/plain', }, ], }), ); // Add a prompt server.registerPrompt( 'greet', { title: 'Hello Prompt', description: 'Say hello to someone', argsSchema: { name: z.string().describe('Name of the person to greet'), }, }, async ({ name }) => { return { messages: [ { role: 'user', content: { type: 'text', text: `Say hello to ${name}`, }, }, ], }; }, ); return server.server; }

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/jirispilka/actors-mcp-server'

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