Skip to main content
Glama
pshempel

MCP Time Server Node

by pshempel
mcp-server-behaviors.md1.11 kB
# MCP SDK Server Behaviors (Verified 2025-07-19) ## Server Creation ```typescript const server = new Server({ name: 'server-name', version: '1.0.0', }, { capabilities: { tools: {}, }, }); ``` ## Request Handler Registration 1. **ListToolsRequestSchema**: method is `tools/list` 2. **CallToolRequestSchema**: method is `tools/call` 3. Handlers are async functions 4. SDK validates requests automatically ## Tool Response Format ```typescript // Success response { content: [ { type: 'text', text: 'result string' } ] } // Error response (throw error or return) { error: { code: 'ERROR_CODE', message: 'Error message', details: { /* optional */ } } } ``` ## Tool Input Schema - Uses JSON Schema format - Properties: type, properties, required, description - SDK validates tool arguments automatically ## Transport - StdioServerTransport for CLI usage - Connect with `server.connect(transport)` - Starts JSON-RPC message loop ## Testing Approach - Can test handlers directly without transport - Create mock request objects - Test tool registration separately from execution

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/pshempel/mcp-time-server-node'

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