Skip to main content
Glama

SpiderFoot MCP Server

test-mcp-raw.js2.47 kB
// Test script for raw MCP server interaction import axios from 'axios'; const MCP_SERVER_URL = 'http://localhost:5002/mcp'; async function testMCP() { try { // 1. Initialize session console.log('1. Initializing MCP session...'); const initResponse = await axios.post(MCP_SERVER_URL, { jsonrpc: '2.0', method: 'initialize', params: { protocolVersion: '1.0', clientInfo: { name: 'test-client', version: '1.0.0' }, capabilities: {} }, id: 1 }, { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json, text/event-stream' }, responseType: 'text' }); // Extract session ID from response headers const sessionId = initResponse.headers['mcp-session-id']; if (!sessionId) { throw new Error('No session ID received in initialization response'); } console.log('Session ID:', sessionId); console.log('Initialization response:', initResponse.data); // 2. List tools using the session ID console.log('\n2. Listing tools...'); const toolsResponse = await axios.post(MCP_SERVER_URL, { jsonrpc: '2.0', method: 'mcp.list_tools', params: {}, id: 2 }, { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json, text/event-stream', 'mcp-session-id': sessionId }, responseType: 'text' }); console.log('Tools response:', toolsResponse.data); // 3. Try to call a specific tool console.log('\n3. Calling spiderfoot_ping...'); const pingResponse = await axios.post(MCP_SERVER_URL, { jsonrpc: '2.0', method: 'spiderfoot_ping', params: {}, id: 3 }, { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json, text/event-stream', 'mcp-session-id': sessionId }, responseType: 'text' }); console.log('Ping response:', pingResponse.data); } catch (error) { console.error('\n=== Error ==='); console.error('Message:', error.message); if (error.response) { console.error('Status:', error.response.status); console.error('Headers:', error.response.headers); console.error('Data:', error.response.data); } else if (error.request) { console.error('No response received:', error.request); } process.exit(1); } } testMCP();

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/CorbettCajun/Spiderfoot-MCP-Server'

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