Skip to main content
Glama

MCP Shamash

test-client.js•5.24 kB
#!/usr/bin/env node const { spawn } = require('child_process'); const { Client } = require('@modelcontextprotocol/sdk/client/index.js'); const { StdioClientTransport } = require('@modelcontextprotocol/sdk/client/stdio.js'); async function testMCPServer() { console.log('šŸš€ Testing MCP Shamash Server...\n'); // Start the server const serverProcess = spawn('npx', ['tsx', 'src/index.ts'], { stdio: 'pipe', cwd: process.cwd(), }); // Set up transport const transport = new StdioClientTransport(); transport.setChildProcess(serverProcess); // Initialize client const client = new Client( { name: 'test-client', version: '1.0.0', }, { capabilities: {}, } ); try { // Connect to server await client.connect(transport); console.log('āœ… Connected to Shamash server'); // Test 1: List tools console.log('\nšŸ“‹ Testing tools/list...'); const toolsResult = await client.request( { method: 'tools/list', params: {} }, { method: 'tools/list', params: {} } ); console.log(`āœ… Found ${toolsResult.tools.length} tools:`); toolsResult.tools.forEach(tool => { console.log(` • ${tool.name}: ${tool.description}`); }); // Test 2: Test project scan (should work) console.log('\nšŸ” Testing project scan (valid path)...'); try { const scanResult = await client.request( { method: 'tools/call', params: { name: 'scan_project', arguments: { path: process.cwd(), profile: 'quick' } } }, { method: 'tools/call', params: { name: 'scan_project', arguments: { path: process.cwd(), profile: 'quick' } } } ); console.log('āœ… Project scan completed successfully'); const result = JSON.parse(scanResult.content[0].text); console.log(` • Scan ID: ${result.scanId}`); console.log(` • Token usage: ${result.tokenUsage}`); } catch (error) { console.log(`āŒ Project scan failed: ${error.message}`); } // Test 3: Test boundary enforcement (should fail) console.log('\n🚫 Testing boundary enforcement (/etc access)...'); try { await client.request( { method: 'tools/call', params: { name: 'scan_project', arguments: { path: '/etc' } } }, { method: 'tools/call', params: { name: 'scan_project', arguments: { path: '/etc' } } } ); console.log('āŒ Boundary enforcement failed - scan should have been blocked'); } catch (error) { console.log('āœ… Boundary enforcement working - access blocked'); console.log(` • Reason: ${error.message}`); } // Test 4: Test network scan console.log('\n🌐 Testing network scan (localhost)...'); try { const networkResult = await client.request( { method: 'tools/call', params: { name: 'scan_network', arguments: { target: '127.0.0.1', ports: '80,443' } } }, { method: 'tools/call', params: { name: 'scan_network', arguments: { target: '127.0.0.1', ports: '80,443' } } } ); console.log('āœ… Network scan completed successfully'); const result = JSON.parse(networkResult.content[0].text); console.log(` • Scan ID: ${result.scanId}`); console.log(` • Findings: ${result.findings.length}`); } catch (error) { console.log(`āŒ Network scan failed: ${error.message}`); } // Test 5: Test compliance check console.log('\nšŸ“Š Testing compliance check...'); try { const complianceResult = await client.request( { method: 'tools/call', params: { name: 'check_compliance', arguments: { path: process.cwd(), frameworks: ['OWASP', 'CIS'] } } }, { method: 'tools/call', params: { name: 'check_compliance', arguments: { path: process.cwd(), frameworks: ['OWASP', 'CIS'] } } } ); console.log('āœ… Compliance check completed successfully'); const result = JSON.parse(complianceResult.content[0].text); console.log(` • OWASP coverage: ${result.compliance.OWASP_Top_10.coverage}`); console.log(` • CIS coverage: ${result.compliance.CIS_Controls.coverage}`); } catch (error) { console.log(`āŒ Compliance check failed: ${error.message}`); } console.log('\nšŸŽ‰ All tests completed!'); } catch (error) { console.error('āŒ Test failed:', error.message); } finally { // Clean up await client.close(); serverProcess.kill(); } } // Run tests testMCPServer().catch(console.error);

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/NeoTecDigital/mcp_shamash'

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