usage-examples.sh•3.19 kB
#!/bin/bash
# Usage Examples for Multi-Transport Pentest MCP Server
echo "=== Pentest MCP Server - Multi-Transport Usage Examples ==="
# 1. STDIO Transport (Default - for local MCP clients)
echo -e "\n1. STDIO Transport (subprocess mode):"
echo "# Run directly with Node.js:"
echo "npm run build && node dist/index.js"
echo ""
echo "# Run with Docker (interactive):"
echo "docker run -it --rm --privileged pentest-mcp:latest"
echo ""
echo "# Run with docker-compose:"
echo "docker-compose --profile stdio up"
echo ""
echo "# Test with MCP Inspector:"
echo "npx @modelcontextprotocol/inspector node dist/index.js"
# 2. HTTP/Streamable Transport (Modern network mode)
echo -e "\n2. HTTP/Streamable Transport (network mode):"
echo "# Run directly with Node.js:"
echo "MCP_TRANSPORT=http npm start"
echo ""
echo "# Run with Docker:"
echo "docker run -p 8000:8000 -e MCP_TRANSPORT=http --privileged pentest-mcp:latest"
echo ""
echo "# Run with docker-compose:"
echo "docker-compose --profile http up"
echo ""
echo "# Test endpoints:"
echo "curl http://localhost:8000/health"
echo "# Connect with MCP client to http://localhost:8000/mcp"
# 3. SSE Transport (Legacy backward compatibility)
echo -e "\n3. SSE Transport (legacy mode):"
echo "# Run directly with Node.js:"
echo "MCP_TRANSPORT=sse MCP_SERVER_PORT=8001 npm start"
echo ""
echo "# Run with Docker:"
echo "docker run -p 8001:8001 -e MCP_TRANSPORT=sse -e MCP_SERVER_PORT=8001 --privileged pentest-mcp:latest"
echo ""
echo "# Run with docker-compose:"
echo "docker-compose --profile sse up"
echo ""
echo "# Test endpoints:"
echo "curl http://localhost:8001/health"
echo "# SSE endpoint: http://localhost:8001/sse"
echo "# Messages endpoint: http://localhost:8001/messages"
# 4. All-in-one flexible mode
echo -e "\n4. Flexible mode (configured via .env):"
echo "# Create .env file:"
echo "cp .env.example .env"
echo "# Edit .env to set MCP_TRANSPORT to desired mode"
echo ""
echo "# Run with docker-compose (uses .env):"
echo "docker-compose up pentest-mcp"
# 5. Running multiple transports simultaneously
echo -e "\n5. Run multiple transports at once:"
echo "# Start all services:"
echo "docker-compose --profile stdio --profile http --profile sse up"
echo ""
echo "# This will run:"
echo "# - STDIO on container stdin/stdout"
echo "# - HTTP on port 8000"
echo "# - SSE on port 8001"
# 6. Integration examples
echo -e "\n6. Integration with MCP clients:"
echo ""
echo "# Claude Desktop config for stdio:"
echo '{"pentest-mcp": {'
echo ' "command": "docker",'
echo ' "args": ["run", "-i", "--rm", "--privileged", "pentest-mcp:latest"]'
echo '}}'
echo ""
echo "# Claude Desktop config for HTTP:"
echo '{"pentest-mcp": {'
echo ' "url": "http://localhost:8000/mcp"'
echo '}}'
echo ""
echo "# Cursor config for SSE:"
echo '{"pentest-mcp": {'
echo ' "url": "http://localhost:8001/sse"'
echo '}}'
# 7. Testing with curl
echo -e "\n7. Testing with curl:"
echo "# Test HTTP health endpoint:"
echo "curl http://localhost:8000/health"
echo ""
echo "# Test SSE connection:"
echo "curl -N -H 'Accept: text/event-stream' http://localhost:8001/sse"
echo -e "\n=== Note: Remember to use --privileged flag for SYN scans and OS detection ==="