Skip to main content
Glama

Worksona MCP Server

Official
by worksona
test-tools.jsโ€ข6.34 kB
#!/usr/bin/env node // Comprehensive tool testing for Worksona MCP Server const { spawn } = require('child_process'); const path = require('path'); console.log('๐Ÿ”ง Testing Worksona MCP Server Tools...\n'); const serverPath = path.join(__dirname, 'dist', 'index.js'); const server = spawn('node', [serverPath], { stdio: ['pipe', 'pipe', 'pipe'] }); let responses = []; let requestId = 1; server.stdout.on('data', (data) => { const lines = data.toString().split('\n').filter(line => line.trim()); lines.forEach(line => { try { const response = JSON.parse(line); if (response.jsonrpc) { responses.push(response); } } catch (e) { // Not JSON, probably server logs console.log('Server:', line); } }); }); server.stderr.on('data', (data) => { console.log('Server Error:', data.toString().trim()); }); // Wait for server to initialize setTimeout(async () => { console.log('๐Ÿš€ Server initialized, starting tool tests...\n'); try { // Test 1: Initialize console.log('๐Ÿ“‹ Test 1: Initialize Protocol'); await sendRequest({ jsonrpc: '2.0', id: requestId++, method: 'initialize', params: {} }); // Test 2: List Tools console.log('๐Ÿ“‹ Test 2: List Available Tools'); await sendRequest({ jsonrpc: '2.0', id: requestId++, method: 'tools/list', params: {} }); // Test 3: List Agents console.log('๐Ÿ“‹ Test 3: List Agents Tool'); await sendRequest({ jsonrpc: '2.0', id: requestId++, method: 'tools/call', params: { name: 'list_agents', arguments: { category: 'software-engineering' } } }); // Test 4: Suggest Agents console.log('๐Ÿ“‹ Test 4: Suggest Agents Tool'); await sendRequest({ jsonrpc: '2.0', id: requestId++, method: 'tools/call', params: { name: 'suggest_agents', arguments: { request: 'help with React development', max_suggestions: 3 } } }); // Test 5: Activate Agent console.log('๐Ÿ“‹ Test 5: Activate Agent Tool'); await sendRequest({ jsonrpc: '2.0', id: requestId++, method: 'tools/call', params: { name: 'activate_agent', arguments: { agent_name: 'frontend-developer', request: 'Create a simple React button component' } } }); // Wait for all responses and analyze setTimeout(() => { analyzeResults(); }, 2000); } catch (error) { console.error('โŒ Test error:', error); server.kill(); } }, 3000); function sendRequest(request) { return new Promise((resolve) => { server.stdin.write(JSON.stringify(request) + '\n'); setTimeout(resolve, 500); // Give time for response }); } function analyzeResults() { console.log('\n' + '='.repeat(60)); console.log('๐Ÿ” Analyzing Test Results...\n'); let testsPassed = 0; let totalTests = 5; // Check initialize response const initResponse = responses.find(r => r.id === 1); if (initResponse && initResponse.result && initResponse.result.serverInfo) { console.log('โœ… Test 1 - Initialize: PASSED'); console.log(` Server: ${initResponse.result.serverInfo.name} v${initResponse.result.serverInfo.version}`); testsPassed++; } else { console.log('โŒ Test 1 - Initialize: FAILED'); } // Check tools list response const toolsResponse = responses.find(r => r.id === 2); if (toolsResponse && toolsResponse.result && toolsResponse.result.tools) { const tools = toolsResponse.result.tools; console.log(`โœ… Test 2 - List Tools: PASSED (${tools.length} tools available)`); tools.forEach(tool => console.log(` - ${tool.name}: ${tool.description}`)); testsPassed++; } else { console.log('โŒ Test 2 - List Tools: FAILED'); } // Check list agents response const listAgentsResponse = responses.find(r => r.id === 3); if (listAgentsResponse && listAgentsResponse.result && listAgentsResponse.result.content) { console.log('โœ… Test 3 - List Agents: PASSED'); testsPassed++; } else { console.log('โŒ Test 3 - List Agents: FAILED'); } // Check suggest agents response const suggestResponse = responses.find(r => r.id === 4); if (suggestResponse && suggestResponse.result && suggestResponse.result.content) { console.log('โœ… Test 4 - Suggest Agents: PASSED'); testsPassed++; } else { console.log('โŒ Test 4 - Suggest Agents: FAILED'); } // Check activate agent response const activateResponse = responses.find(r => r.id === 5); if (activateResponse && activateResponse.result && activateResponse.result.content) { console.log('โœ… Test 5 - Activate Agent: PASSED'); const content = activateResponse.result.content[0].text; if (content.includes('Frontend Developer') || content.includes('frontend-developer')) { console.log(' Agent activation working correctly'); } testsPassed++; } else { console.log('โŒ Test 5 - Activate Agent: FAILED'); } // Final results console.log('\n' + '='.repeat(60)); console.log('๐Ÿงช Tool Test Results:'); console.log(`โœ… Passed: ${testsPassed}/${totalTests} tests`); console.log(`๐Ÿ“Š Success Rate: ${Math.round((testsPassed/totalTests) * 100)}%`); if (testsPassed === totalTests) { console.log('\n๐ŸŽ‰ All tool tests passed! MCP server is fully functional.'); console.log('\n๐Ÿ“ Claude Desktop Configuration:'); console.log('Add this to ~/.claude-desktop/config.json:'); console.log(JSON.stringify({ "mcpServers": { "worksona-agents": { "command": "node", "args": [`${__dirname}/dist/index.js`], "cwd": __dirname } } }, null, 2)); } else { console.log('\nโš ๏ธ Some tests failed. Check the MCP protocol implementation.'); } server.kill(); process.exit(testsPassed === totalTests ? 0 : 1); } // Handle server exit server.on('close', (code) => { if (code !== null && code !== 0 && code !== 143) { // 143 is SIGTERM console.log(`โŒ Server exited with code ${code}`); } }); // Cleanup on script exit process.on('SIGINT', () => { console.log('\nโš ๏ธ Test interrupted'); server.kill(); process.exit(1); });

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

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