Skip to content

Claude Code Integration

Herve Hildenbrand edited this page Jan 25, 2026 · 7 revisions

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.

Overview

┌─────────────────────────────────────────────────────────────┐
│                     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.

Setup

1. Install BGP Explorer

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

2. Add to Claude Code

# One-liner to add bgp-explorer as an MCP server
claude mcp add bgp-explorer -- bgp-explorer mcp

This tells Claude Code to spawn bgp-explorer mcp when it needs BGP tools.

3. Use Claude Code

claude

Now 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?

Available Tools (24)

The MCP server exposes 24 BGP investigation tools with security-first methodology (proactive RPKI checks) and IPv4/IPv6 awareness (separate reporting by address family):

RIPE Stat Tools (Core Routing Data)

Tool Description
search_asn Search for ASNs by organization name
lookup_prefix Get origin ASN, AS paths, visibility for a prefix
get_asn_announcements List all prefixes announced by an ASN
get_routing_history Historical routing data for a resource
get_rpki_status RPKI validation (valid/invalid/not-found)
analyze_as_path Path diversity, transit ASNs, prepending detection
get_asn_details Detailed ASN analysis
check_prefix_anomalies On-demand hijack detection (MOAS, RPKI, origin changes)

Monocle Tools (AS Relationships)

Tool Description
get_as_peers Get all peers for an AS
get_as_upstreams Get upstream transit providers
get_as_downstreams Get downstream customers
check_as_relationship Check relationship between two ASes
get_as_connectivity_summary Overview of AS's network position

Globalping Tools (Network Probing)

Tool Description
ping_from_global Ping from worldwide vantage points
traceroute_from_global Traceroute from multiple locations

PeeringDB Tools (Network Info)

Tool Description
get_ixps_for_asn Get IXP presence for an ASN
get_network_contacts Get NOC/abuse contacts

Resilience Tools

Tool Description
assess_network_resilience Score network resilience (1-10) with transit, peering, IXP analysis

Example Queries

Finding an ASN

> Search for Google's ASNs

Claude will use search_asn to find AS15169 and related ASNs.

Investigating a Prefix

> 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

Network Connectivity

> 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

Global Reachability

> 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.

Managing the MCP Server

List MCP Servers

claude mcp list

Remove bgp-explorer

claude mcp remove bgp-explorer

Check Server Status

When in Claude Code, type /mcp to see connected MCP servers and their status.

Troubleshooting

"Monocle is not configured"

The monocle binary isn't installed or not in PATH:

# Install monocle
cargo install monocle

# Or run install-deps
uv run bgp-explorer install-deps

Tools Not Appearing

  1. Check the MCP server is added:

    claude mcp list
  2. Restart Claude Code after adding the server

  3. Check bgp-explorer runs correctly:

    bgp-explorer mcp --help

Slow Responses

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.

Comparison: MCP Server vs Standalone Mode

Feature MCP Server (bgp-explorer mcp) Standalone (bgp-explorer chat)
AI Processing Claude Code subscription Anthropic API key
Tools Available 18 (no real-time monitoring) 24 (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.

Clone this wiki locally