Skip to main content
Glama
ryddle

DateTime MCP Server

by ryddle
test-server.js1.54 kB
import { spawn } from 'child_process'; import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; async function testServer() { console.log('🚀 Starting test of the MCP server...\n'); // Start the server as a child process const serverProcess = spawn('node', ['./build/index.js'], { stdio: ['pipe', 'pipe', 'pipe'], }); // Create client transport const transport = new StdioClientTransport({ command: 'node', args: ['./build/index.js'], }); const client = new Client( { name: 'test-client', version: '1.0.0', }, { capabilities: {}, } ); try { // Connect to the server await client.connect(transport); console.log('✅ Connected to the server\n'); // List available tools console.log('📋 Listing tools...'); const toolsResponse = await client.listTools(); console.log('Available tools:', JSON.stringify(toolsResponse, null, 2)); console.log(); // Call the datetime tool console.log('🕐 Calling the datetime tool...'); const result = await client.callTool({ name: 'datetime', arguments: {}, }); console.log('Result:', JSON.stringify(result, null, 2)); console.log(); console.log('✅ Test completed successfully'); } catch (error) { console.error('❌ Error during the test:', error); } finally { await client.close(); serverProcess.kill(); } } testServer().catch(console.error);

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/ryddle/datetime-mcp'

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