Skip to main content
Glama
bgphorizon-mcp

bgphorizon-mcp

Official
by bgphorizon

bgphorizon-mcp

An MCP server that exposes BGPHorizon BGP routing data to any MCP-capable LLM client (Claude Code, Claude Desktop, Cursor, Gemini CLI, OpenAI Agents, …).

It is not a thin wrapper over the REST API. The surface is 26 task-shaped tools built around the operations investigators and operators perform, each returning aggregates plus warnings[] so a model cannot silently misread the data (persistence, single-vantage-point concentration, censored first_seen, …).

LLM client ──stdio│http──► bgphorizon-mcp ──► BGPHorizon /api/v1 ──► ClickHouse
                            (key auth, metering, tier entitlements inherited)

Install & run

The server needs a BGPHorizon API key (create one in your account's API panel), passed as BGPHORIZON_API_KEY.

From source, with uv:

git clone https://github.com/bgphorizon/bgphorizon-mcp.git && cd bgphorizon-mcp
uv sync
export BGPHORIZON_API_KEY=bgps_xxx
uv run bgphorizon-mcp --selftest   # ✓ API reachable ✓ key valid ✓ 26 tools ✓ 9 resources ✓ 8 prompts

The selftest prints a line per check, so a wrong key or an unreachable API shows up before you wire the server into a client.

Not on PyPI yet. Once it is released there, uvx bgphorizon-mcp will run it with nothing to install, and uv tool install bgphorizon-mcp or pipx install bgphorizon-mcp will install it. Until then use the source install above, or the hosted endpoint, which needs no install at all.

Related MCP server: PeerGlass

Connect it

You can either use the hosted endpoint (nothing to install) or self-host (this repo). Both authenticate with the same bgps_ API key and go through the same metered /api/v1.

Hosted endpoint, with sign-in (no install, no key)

Clients that support MCP sign-in (OAuth) only need the URL; they open a BGPHorizon page where you sign in and click Allow.

  • Claude Desktop and claude.ai: Settings → Connectors → Add custom connector → https://bgphorizon.com/mcp.

  • Claude Code: claude mcp add --transport http bgphorizon https://bgphorizon.com/mcp, then /mcp → bgphorizon → Authenticate.

  • Cursor, VS Code and others: { "mcpServers": { "bgphorizon": { "url": "https://bgphorizon.com/mcp" } } }

Access lasts 90 days and shows up as a key in your API tab, where you can revoke it.

Hosted endpoint, with an API key

claude mcp add --transport http bgphorizon https://bgphorizon.com/mcp \
  --header "Authorization: Bearer bgps_xxx"

Cursor, and other clients whose config accepts a remote url:

{
  "mcpServers": {
    "bgphorizon": {
      "url": "https://bgphorizon.com/mcp",
      "headers": { "Authorization": "Bearer bgps_xxx" }
    }
  }
}

Claude Desktop does not accept a url entry in its config file. Use the connector above, or, to use a fixed key, bridge to the hosted endpoint with mcp-remote, which needs Node.js:

{
  "mcpServers": {
    "bgphorizon": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote",
        "https://bgphorizon.com/mcp",
        "--header", "Authorization:${BGPHORIZON_AUTH}"
      ],
      "env": { "BGPHORIZON_AUTH": "Bearer bgps_xxx" }
    }
  }
}

Keep the key in env with no space after Authorization:; Claude Desktop on Windows breaks arguments that contain spaces. See docs/SETUP.md for troubleshooting.

Self-hosted with Claude Code

claude mcp add bgphorizon --env BGPHORIZON_API_KEY=bgps_xxx \\
  -- uv run --directory /path/to/bgphorizon-mcp bgphorizon-mcp

Self-hosted with Claude Desktop / Cursor (mcpServers block)

{
  "mcpServers": {
    "bgphorizon": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/bgphorizon-mcp", "bgphorizon-mcp"],
      "env": { "BGPHORIZON_API_KEY": "bgps_xxx" }
    }
  }
}

The package is not on PyPI yet, so uvx bgphorizon-mcp will not resolve. On Windows, write the directory with doubled backslashes ("C:\\Users\\you\\bgphorizon-mcp").

Point at a non-production API with "BGPHORIZON_API_URL" in the same env block.

Hosted / HTTP transport

bgphorizon-mcp --transport http --port 8931 --require-auth

Put it behind TLS with proxy_buffering off for streaming. See docs/SETUP.md for every client (Gemini CLI, OpenAI Agents SDK, LangChain, n8n, VS Code) and reverse-proxy config.

What's in the box

Investigation tools (21): identify, inventory, timeline, origin_history, reachability, global_reach, detections, paths, relationships, path_diversity, translate_communities, compare_windows, locate, subprefixes, events_sample, platform_baseline, notable_events, origin_episode, origin_reach, bulk_registry, irr_history.

Operator tools (3): health_check, validate_announcement, visibility.

Alert tools (2): my_alerts, my_monitors. Your own monitoring rather than the global table. my_alerts(window="today") returns every alert your monitors fired over a window, with totals by detection type, severity and monitor, ready to write up. my_monitors lists your watchlist with each monitor's alert volume for the same window, so coverage and noise come back in one call.

Resources (9): bgphorizon://reference/{detection-types, collectors, glossary, data-horizon, report-template, writing-guide, qa-checklist, methodology, report-examples}: reference the model can pull without a tool call. report-template ships with the house CSS already inlined, and the full report standards are here, so a hosted client that never clones the repo still writes house-style reports. Only the local enforcement scripts (style-lint.py, build-report.sh) need the repo, and they check work the standards already describe.

Prompts (8): investigate_entity, write_report, alert_report, triage_incident, locate_infrastructure, audit_my_network, preflight_change, explain_incident. The methodology lives here. In Claude Code they surface as /bgphorizon:audit_my_network, etc. write_report asks first whether you want to review its findings before it writes them up.

Full tool contracts, with a worked example per tool: docs/TOOLS.md.

Writing investigative reports

The server ships a complete report kit and a write_report prompt so you can generate BGP routing reports from any client: Claude Code, Claude Desktop, OpenAI (Codex / Agents / ChatGPT), Gemini CLI, Cursor, and more.

Connect the server, then ask for a report. The write_report prompt carries the whole procedure: it reads the standards, runs the investigation, asks whether you want to review the findings before it writes, and fills the template. Nothing has to be cloned for that. Cloning adds build-report.sh, which validates the HTML, fails on a style violation, and renders a PDF and PNG.

The per-client, copy-paste guide is in reporting/README.md.

Configuration

Env var

Default

Purpose

BGPHORIZON_API_KEY

(none)

API key, forwarded as Authorization: Bearer.

BGPHORIZON_API_URL

https://bgphorizon.com

BGPHorizon base URL.

BGPHORIZON_TIMEOUT

35

Per-request timeout (seconds). Above the API's 30 s query limit so its own error arrives first.

BGPHORIZON_LOG_LEVEL

INFO

DEBUG surfaces every upstream request.

Develop

uv sync --group dev
uv run pytest            # deterministic reshaping logic (transitions, direction, …)
uv run bgphorizon-mcp --selftest
npx @modelcontextprotocol/inspector uv run bgphorizon-mcp   # raw protocol inspection

Layout: client.py (one method per /api/v1 endpoint) · tools/ (analytical operations + _shape.py pure helpers) · resources.py + reference/ (bundled docs) · prompts.py (methodology). Adding a tool = one function under tools/ with an @mcp.tool() decorator; the input schema comes from its type hints.

License

MIT.

Available Tools

18 tools
compare_windowsA

Baseline (window_a) vs event (window_b) for a target. Each window is {from, to}. dimension=volume compares totals; origin/collector compares the per-group breakdown so a new origin or a shifted collector mix is obvious. (upstream/paths comparison is not available via the rollup — use paths.)

Inputs: target (required), window_a (required), window_b (required), dimension.

detectionsB

Platform findings for an ASN or prefix, with direction made explicit. direction (queried_entity_is_invalid_party | queried_entity_is_baseline | third_party) tells you whether the queried entity is the offender or the victim — reading actor_as against baseline_asns by hand inverts conclusions.

Inputs: asn, end, start, prefix, +2 more.

events_sampleA

Bounded raw events for a NARROW window — last resort. Capped at 500 events; rejects windows over ~24h. Use only after timeline/reachability/origin_history have localised what you need to see at the message level.

Inputs: end (required), start (required), prefix (required), limit, +4 more.

health_checkA

Full hygiene + exposure audit for an ASN you control — the single most valuable operator call. Checks RPKI/IRR coverage, MOAS, ROA max-length exposure, transit diversity and visibility, each with remediation. Sampling bounds the per-prefix checks to keep it fast.

Inputs: asn (required), checks, window.

identifyA

Who is this ASN or prefix? Registry, RPKI, IRR and PeeringDB in one call.

The right first step in almost any investigation. Give either asn or prefix. include may list rdap, rpki, irr, peeringdb (whois is not yet available through the API).

Inputs: asn, prefix, include.

inventoryA

What does this ASN announce, and does it stick?

Returns each prefix with a server-computed persistence classification (persistent | intermittent | transient). Do not infer persistence from first_seen — use this.

Inputs: asn (required), end, start, classify, +1 more.

locateA

Facility/IX intersection across an entity's upstreams — routing-only geolocation. Finds cities common to all upstreams' PeeringDB presence, which is far more reliable than GeoIP for leased/anycast space. Give a prefix (or an ASN, whose top prefix is used to derive upstreams).

Inputs: asn, prefix.

origin_historyA

Day-by-day origins for a prefix — THE persistence check. Returns each day's origin set, MOAS days, and classified transitions (handover vs episode vs intermittent). This is the direct fix for mistaking a transient blip for a migration.

Inputs: prefix (required), end, start.

path_diversityA

How an origin's announcements FAN OUT through its upstreams toward our collectors — the observed propagation / path-diversity tree, weighted by how many vantage points take each branch.

Built ONLY from real observed AS paths (no inference), so it answers with high confidence: which upstreams actually carry this network's routes, and how lopsided that is. Each level-1 branch's share is the fraction of vantage points (of the total_vantage_points that see the origin) that reach it via that upstream, counted as DISTINCT collector+peer feeds. Shares are per-upstream coverage, not a partition — a network reached through several upstreams will have several high shares, so they can sum past 1.0. One dominant upstream with the rest low = effectively single-threaded; several high shares = redundant transit. is_tier1 marks where a branch reaches the Tier-1 core.

Pass prefix (a CIDR the ASN originates) to scope the tree to ONE prefix — useful for a MOAS prefix or to check a specific route's redundancy; the % then reflects just that prefix's paths.

NOT a traceroute: this is the control-plane spread of routes across upstreams as seen from route collectors, not the data-plane path a packet takes (peering and IXP handoffs are invisible to collectors). diverse=false means the origin is single-threaded or too thinly observed for a meaningful diversity view — read reason. Default window is 14 days (current routing); widen it for more history.

Inputs: asn (required), end, start, prefix.

pathsC

Transit structure for a prefix with prepending resolved: immediate upstreams and their share, plus top paths with collapsed_path / prepend_count.

Inputs: prefix (required), end, start.

platform_baselineA

Is today unusual, platform-wide? Aggregates recent anomalous detections so you can tell an ordinary busy day from a real event. Call this BEFORE describing anything as anomalous — an apparent spike is often just the platform's normal volume.

Inputs: by, window.

reachabilityA

How many observing peers had no route, and when. Returns an event-driven series plus server-computed outage windows (>=5% of peers routeless). Accepts multiple prefixes so a multi-prefix event resolves in one call. Keep the window tight — this reads raw events.

Inputs: prefixes (required), end, start.

relationshipsA

An ASN's transit hierarchy over a window: upstreams (its providers) and downstreams (its customers), plus observed neighbours whose relationship is unknown.

Relationships are inferred provider->customer, Tier-1-anchored (~94% agreement with CAIDA). Peering is NOT inferred: other_connections are adjacencies we observed but cannot classify — do not present them as confirmed peers. Results reflect the requested date window; relationships change over time.

This is the transit TOPOLOGY (who provides transit to whom). For observed USAGE — which of those upstreams actually carry the network's routes and how lopsided that is — use path_diversity; the two are complementary.

Inputs: asn (required), end, start.

subprefixesC

Announced more-specifics inside a block, plus an estimate of unrouted space — allocated addresses never seen in the table, the easiest kind to announce unnoticed.

Inputs: prefix (required), end, start.

timelineA

Counts over time for target (asn:13335 or prefix:1.1.1.0/24). Replaces bulk event downloads. group_by=origin at daily granularity is the handover chart. Hour granularity and peer/event_type grouping are not available (the underlying rollup is daily).

Inputs: target (required), end, start, group_by, +1 more.

translate_communitiesA

Translate raw BGP community strings (e.g. "3356:2065", "1299:2731") into their meaning, from a dictionary harvested from operators' own IRR objects, NLNOG, and the IANA/RFC well-knowns.

Each result carries: known (false = no published definition — don't guess a meaning), category (informational | action), subtype (geo | prepend | localpref | blackhole | no-export | relationship | …), description, optional geo, and the OWNER AS (the left side) with its resolved name — which is useful even when the community itself is unknown ("it's AS3356/Lumen's community"). inferred=true marks a meaning taken from a near-universal CONVENTION (e.g. any :666/:9999 = blackhole) rather than something the owner published — present those as conventional, not authoritative. matched_by shows the wildcard pattern that matched, when it wasn't an exact literal.

Inputs: communities (required).

validate_announcementA

Pre-flight: will announcing prefix from origin_asn validate? Checks the covering ROA (and max-length), IRR route objects, who announces it today, and — because freshly transferred space keeps the old holder's ROAs — whether the registration changed recently. Returns verdict clear | warn | blocked.

Inputs: prefix (required), origin_asn (required), check_holder.

visibilityA

Where can the internet see this prefix, and where can it not? Peer and collector reach, upstreams, and — the useful part — a ratio against sibling prefixes. Absolute peer counts mean little; a prefix seen by 40 peers when its siblings are seen by 330 is being filtered.

Inputs: prefix (required), window, compare_to.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 18 tools

    Disambiguation4/5

    Most tools target clearly distinct aspects of BGP analysis, from identity lookup to path diversity to community translation. The only real risk is among the topology-related tools (paths, relationships, path_diversity), but their descriptions explicitly differentiate inferred hierarchy from observed propagation, so an agent reading carefully should select correctly.

    Naming Consistency3/5

    All names are lowercase and multi-word names use snake_case consistently, but the set mixes verb-led names (identify, locate, translate_communities, validate_announcement) with noun/resource names (inventory, timeline, detections, visibility). This is readable but does not follow a single verb_noun pattern.

    Tool Count4/5

    18 tools is slightly above the typical 3-15 well-scoped range, but each tool maps to a meaningful analytical function in the BGP domain. The count feels heavy at first glance, yet there is little redundancy.

    Completeness5/5

    The surface covers the BGP investigation workflow thoroughly: identification, inventory, historical origin, reachability, detections, topology, validation, health audit, and visibility. No obvious dead-end remains for the stated purpose, and even raw-event access exists as a last resort.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides LLMs with network intelligence capabilities including PTR record lookups, ASN analysis, traceroute enrichment, and real-time network monitoring through The Aleph API.
      13
      6 npm
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Provides global internet resource intelligence by querying RIRs for IP and ASN data, routing visibility, and network health. It enables users to perform RPKI validation, BGP inspection, and historical allocation analysis through natural language or a REST API.
      42
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to query IP intelligence tools such as geolocation, VPN/security checks, ASN, timezone, astronomy, user-agent parsing, abuse contacts, and bulk lookups via natural language.
      4 npm
      MIT