Skip to main content
Glama
portel-dev

NCP - Natural Context Provider

by portel-dev
test-tools-list-performance.cjs2.19 kB
#!/usr/bin/env node /** * Quick performance test for tools/list */ const { spawn } = require('child_process'); async function testToolsListPerformance() { console.log('Testing tools/list performance...\n'); const proc = spawn('node', ['dist/index.js', '--profile', 'integration-test'], { stdio: ['pipe', 'pipe', 'ignore'], env: { ...process.env, NCP_STDIO: 'true' } }); const responses = new Map(); let buffer = ''; proc.stdout.on('data', (chunk) => { buffer += chunk.toString(); const lines = buffer.split('\n'); buffer = lines.pop() || ''; for (const line of lines) { if (!line.trim()) continue; try { const msg = JSON.parse(line); if (msg.id) responses.set(msg.id, msg); } catch (e) {} } }); // Wait for server to start await new Promise(r => setTimeout(r, 500)); // Send initialize const initMsg = { jsonrpc: '2.0', id: 1, method: 'initialize', params: { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'test', version: '1.0' } } }; proc.stdin.write(JSON.stringify(initMsg) + '\n'); // Wait for init response await new Promise(r => setTimeout(r, 1000)); // Send tools/list and measure const toolsStart = Date.now(); const toolsMsg = { jsonrpc: '2.0', id: 2, method: 'tools/list', params: {} }; proc.stdin.write(JSON.stringify(toolsMsg) + '\n'); // Wait for response return new Promise((resolve) => { const checkResponse = setInterval(() => { if (responses.has(2)) { const elapsed = Date.now() - toolsStart; console.log('✓ tools/list response time:', elapsed + 'ms'); if (elapsed < 250) { console.log('✅ PASS: Under 250ms threshold'); } else { console.log('❌ FAIL: Exceeded 250ms threshold'); } clearInterval(checkResponse); proc.kill(); resolve(); } }, 10); setTimeout(() => { console.log('❌ TIMEOUT: No response after 2000ms'); clearInterval(checkResponse); proc.kill(); resolve(); }, 2000); }); } testToolsListPerformance().then(() => process.exit(0));

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/portel-dev/ncp'

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