Borrowing it
Nothing to install: this file belongs to PalNilsson/panda-gateway. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/PalNilsson/panda-gateway/master/CLAUDE.mdgit clone --depth 1 https://github.com/PalNilsson/panda-gatewayWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/palnilsson/panda-gateway/claude-md)<a href="https://agentmods.dev/instructions/palnilsson/panda-gateway/claude-md"><img src="https://agentmods.dev/badge/instructions/palnilsson/panda-gateway/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/palnilsson/panda-gateway/claude-md"><img src="https://agentmods.dev/badge/instructions/palnilsson/panda-gateway/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.02824 | $0.02824 |
| Opus 5.5 | $0.01130 | $0.01130 |
| Sonnet 5.5 | $0.00565 | $0.00565 |
| Haiku 4.5 | $0.00282 | $0.00282 |
Grade A, and why
panda-gateway CLAUDE.md scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
curl http://127.0.0.1:8090/healthz How it starts
The opening of the file, as written. The whole thing — 118 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
PanDA Gateway is a thin, stateless MCP routing layer between the PanDA Monitor (or any MCP client) and upstream MCP servers (Bamboo MCP, PanDA MCP, and future additions). It exposes a single MCP endpoint (Streamable HTTP) and routes each tools/call to the correct upstream based on a namespace prefix in the tool name. It carries no LLM logic, no planning, no synthesis.
Human-facing docs live in docs/: architecture.md (components, design decisions), catalog-and-search.md (tool catalog + RAG), security-and-resilience.md (trust model, hardening, failure recovery — read before any non-local deployment change). This file is the Claude-Code-specific companion to those, not a replacement.
Commands
# Install (runtime)
pip install -e .
# Install for development
pip install -e ".[dev]"
# Install with OpenTelemetry support
pip install -e ".[observability]"
# Run tests
python -m pytest tests/
# Run a single test file
python -m pytest tests/test_registry.py -v
# Lint
flake8 panda_gateway tests
# Type check
pyright
# Run the gateway (HTTP mode)
panda-gateway --config gateway.minimal.toml
# Run in stdio mode (development)
panda-gateway --config gateway.minimal.toml --stdio
# Health check
curl http://127.0.0.1:8090/healthz
Requires Python ≥ 3.11.
Architecture
PanDA Monitor (MCP client)
│ MCP / Streamable HTTP (Bearer token)
▼
┌─────────────────────────────────────────────┐
│ PanDA Gateway │
│ GatewayServer · UpstreamRegistry · Router │
└─────────────────────────────────────────────┘
│ │ │
Bamboo MCP PanDA MCP (future)
bamboo.* panda.*
Module responsibilities
config.py— Pydantic models loaded from TOML. Config path comes from--configCLI flag orPANDA_GATEWAY_CONFIGenv var. Secrets (tokens) are never in the TOML; the file only names the env var or file path that holds them. All models setextra = "forbid": an unknown/misspelled TOML key raises at load time.auth.py— Inbound pure-ASGIBearerAuthMiddleware(constant-time compare; only/healthzis unauthenticated) and outboundTokenProviders:EnvTokenProviderandFileTokenProvider(re-reads the file on every reconnect for OIDC token renewal).registry.py— OneUpstreamHandleper upstream, each running a supervisor task: open transport, initialise aClientSession(bounded byinit_timeout), run the paginatedtools/listprobe (bounded byprobe_timeout, fully following pagination vianextCursor, bounded by_MAX_PROBE_PAGES, committed to the catalog only once all pages succeed) —stateonly becomesUPonce this first probe succeeds, not right afterinitialize()— then the two-tier health loop (liveness ping every 45 s bounded byping_timeout,tools/listprobe every 12 min). On failure — including one reported by the router viareport_failure()for a routed call that hit a broken session — reconnect with exponential backoff + jitter (consecutive-failure count resets after a reconnect completes init and its first probe, not only on clean shutdown).report_failure()is generation-guarded: a stale report about an already-replaced session is a no-op.UpstreamRegistry.start()runs each supervisor behind an outer crash boundary (_supervise) so an unexpected exception in one upstream's lifecycle can never cancel sibling upstreams or the app's own task group — they share oneanyiotask group (seeserver.py/cli.py). Outbound redirects are off by default per upstream (allow_redirects); httpx stripsAuthorizationbut not custom headers likeX-Auth-Tokenon a cross-origin redirect.router.py— Splits<namespace><sep><tool>on the first separator, looks the namespace up in the registry, forwards the call verbatim. Returns JSON-RPC-32602for unknown namespace,-32603for a configured but DOWN upstream. A transport/protocol failure observed here (not a mere call-level timeout, and not a legitimate upstream tool error — those come back as ordinaryisErrorresults, never raised) is reported to the owning handle viareport_failure(), forcing an immediate reconnect instead of waiting for the next scheduled health check.catalog.py— Per-namespace cache of probed tool lists with a SHA-256 fingerprint over the entireToolmodel (not hand-picked fields, so a change tooutputSchema/annotations/title/etc. is detected too), plus a ChromaDBRagIndex(cosine similarity over tool description embeddings) forgateway.search_tools. Reindexing embeds the replacement documents before mutating the collection, thenupserts new entries and removes only stale ones — a failed embed never empties a namespace's index.RagIndex.query(..., namespaces=...)filters results to the caller's currently-UP namespaces so search never suggests an unavailable tool.server.py— Assembles everything into a FastAPI app; registers thegateway.search_toolstool and the/healthzendpoint. Uses a rawCallToolRequesthandler (not the@server.call_tool()decorator) soMcpErrorpropagates as a genuine JSON-RPC error rather than anisErrortool result.observability.py— Optional OTel tracing; no-op when the SDK/endpoint is absent.cli.py— Entry point (panda-gatewayscript), parses--configand--stdioflags.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 118 lines · 2,824 tokens per session scan A 0feaac20cb93
panda-gateway CLAUDE.md is an instructions file published in the GitHub repository PalNilsson/panda-gateway (0 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 2,824 tokens to every session, about $0.0113 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
panda-gateway CLAUDE.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| panda-gateway CLAUDE.mdPalNilsson/panda-gateway | Instructions file | 0 | 3mo ago | Apache-2.0 | A | 2,824 | Claude Code |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | yesterday | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |