Skip to main content
Glama

SpiderFoot MCP Server

test-mcp-curl.sh1.79 kB
#!/bin/bash # Test MCP server with curl to verify session handling # Base URL for the MCP server MCP_URL="http://localhost:5002/mcp" # Function to make a request and extract the session ID make_request() { local method=$1 local params=$2 local session_id=$3 echo -e "\n=== Making $method request ===" # Build the curl command local cmd="curl -i -X POST $MCP_URL \ -H 'Content-Type: application/json' \ -H 'Accept: application/json, text/event-stream' \ -H 'Cache-Control: no-cache'" # Add session ID if provided if [ -n "$session_id" ]; then cmd+=" \\ -H 'mcp-session-id: $session_id'" fi # Add request body cmd+=" \\ -d '{\"jsonrpc\":\"2.0\",\"method\":\"$method\",\"params\":$params,\"id\":1}'" # Execute the command and capture output local response=$(eval $cmd 2>/dev/null) # Print the response echo "$response" echo -e "\n=== End of $method response ===" # Extract and return the session ID from headers (case-insensitive) echo "$response" | grep -i '^mcp-session-id:' | head -1 | awk -F': ' '{print $2}' | tr -d '\r' } # Test 1: Initialize session echo "=== Testing MCP Server Session Handling ===" session_id=$(make_request "initialize" '{"protocolVersion":"1.0","clientInfo":{"name":"curl-test","version":"1.0.0"},"capabilities":{}}') if [ -z "$session_id" ]; then echo "❌ Failed to get session ID from initialization" exit 1 fi echo -e "\n✅ Session ID: $session_id" # Test 2: List tools with the session ID echo -e "\n=== Testing list_tools with session ID ===" make_request "mcp.list_tools" '{}' "$session_id" # Test 3: Test ping with the session ID echo -e "\n=== Testing ping with session ID ===" make_request "spiderfoot_ping" '{}' "$session_id" echo -e "\n=== Test complete ==="

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