-
Notifications
You must be signed in to change notification settings - Fork 5
Claude Code Integration
BGP Explorer can be used as an MCP (Model Context Protocol) server with Claude Code, allowing you to use BGP investigation tools with your Claude Code subscription (Pro/Max) instead of requiring a separate Anthropic API key.
┌─────────────────────────────────────────────────────────────┐
│ Claude Code (CLI) │
│ │
│ AI Processing: Uses YOUR Claude Code subscription │
│ (Pro/Max credits - NOT a separate API key) │
│ │
└───────────────────────────┬──────────────────────────────────┘
│ MCP Protocol (stdio)
▼
┌─────────────────────────────────────────────────────────────┐
│ bgp-explorer MCP Server │
│ │
│ NO AI here - just data fetching tools: │
│ - RIPE Stat (free API) │
│ - Monocle CLI (free) │
│ - Globalping (free tier) │
│ - PeeringDB cache (free) │
│ │
└─────────────────────────────────────────────────────────────┘
Key point: The MCP server contains zero AI code. All AI reasoning happens in Claude Code using your subscription credits.
git clone https://github.com/hervehildenbrand/bgp-explorer.git
cd bgp-explorer
uv sync
uv run bgp-explorer install-deps # Installs monocle and bgp-radar
uv tool install . # Installs bgp-explorer globallyThe uv tool install . command makes bgp-explorer available system-wide, so it works from any directory.
claude mcp add bgp-explorer -- bgp-explorer mcpclaude mcp list
# Should show:
# bgp-explorer: bgp-explorer mcp - ✓ ConnectedclaudeNow you can ask BGP-related questions and Claude Code will automatically use the bgp-explorer tools:
> Search for Cloudflare's ASNs
> How many peers does AS13335 have?
> Check if 8.8.8.0/24 is being hijacked
> Ping 1.1.1.1 from Asia
> What IXPs is Google present at?
The MCP server exposes 8 composite tools. Each returns a summary by default with a sections parameter for detail:
| Tool | Purpose | Sections |
|---|---|---|
search_asn |
Find ASNs by name | — |
investigate_asn |
ASN investigation | summary, connectivity, announcements, contacts, resilience, whois |
investigate_prefix |
Prefix investigation | summary, routing, anomalies, paths, collectors, looking_glass |
check_rpki |
RPKI/ROA/ASPA | summary, roa_coverage, roa_guidance, aspa_status, aspa_guidance, rov_coverage |
get_routing_history_v2 |
History + stability | summary, origins, paths, stability, updates |
investigate_ixp |
IXP presence/details | Auto-detects: ASN → presence, name → details |
probe_network |
Ping/traceroute | type: ping or traceroute |
run_audit |
Compliance audits | framework: dora, nis2, manrs, all |
See Tools Reference for full documentation.
> Search for Google's ASNs
Claude will use search_asn to find AS15169 and related ASNs.
> Is 203.0.113.0/24 being hijacked?
Claude will use check_prefix_anomalies to check for:
- Multiple Origin AS (MOAS)
- RPKI validation status
- Recent origin changes
- Visibility anomalies
> How well connected is Cloudflare?
Claude will use get_as_connectivity_summary to show:
- Total neighbors (upstreams, peers, downstreams)
- Top providers and customers
- Visibility across BGP peers
> Ping 8.8.8.8 from Europe and show latency
Claude will use ping_from_global with location=['Europe'] to run
measurements from European vantage points.
claude mcp listclaude mcp remove bgp-explorerWhen in Claude Code, type /mcp to see connected MCP servers and their status.
This is the most common issue. It means bgp-explorer is not installed globally.
Fix: Install globally with uv tool install:
# Go to your bgp-explorer clone
cd /path/to/bgp-explorer
# Install globally
uv tool install .
# Remove broken config and re-add
claude mcp remove bgp-explorer 2>/dev/null
claude mcp add bgp-explorer -- bgp-explorer mcp
# Verify it works
claude mcp listAfter uv tool install ., the bgp-explorer command works from anywhere on your system.
The monocle binary isn't installed or not in PATH:
# Navigate to bgp-explorer directory first
cd /path/to/bgp-explorer
# Install monocle
uv run bgp-explorer install-deps
# Or manually:
cargo install monocle-
Check the MCP server is added and connected:
claude mcp list # Should show: bgp-explorer: ... - ✓ Connected -
If it shows "Not connected" or error, re-add with correct path (see above)
-
Restart Claude Code after fixing the configuration
-
Test the MCP server manually:
cd /path/to/bgp-explorer uv run bgp-explorer mcp --help
Some queries (especially AS connectivity) can take a few seconds because they:
- Query external APIs (RIPE Stat, Globalping)
- Run the monocle CLI
- Process large datasets
This is normal for BGP data analysis.
| Feature | MCP Server (bgp-explorer mcp) |
Standalone (bgp-explorer chat) |
|---|---|---|
| AI Processing | Claude Code subscription | Anthropic API key |
| Tools Available | 8 composite (no real-time monitoring) | Individual tools (includes monitoring) |
| Use Case | Quick queries in Claude Code | Dedicated BGP investigation |
| API Costs | Included in Claude Code sub | Per-token API charges |
Note: The MCP server does not include real-time monitoring tools (start_monitoring, stop_monitoring, get_anomalies) because those require a long-running bgp-radar process which doesn't fit the MCP request-response model. Use standalone mode for real-time monitoring.