perplexity-agent-mcp CLAUDE.md

perplexity-agent-mcp CLAUDE.md is an instructions file for coding agents from zalez/perplexity-agent-mcp. It costs 5,403 tokens per session, scanned A, original, BSD-3-Clause.

A set of instructions for contributors working on the perplexity-agent-mcp repository, an MCP server that connects agents to tools. It documents important project rules, design decisions, error handling, and API-specific pitfalls.

In plain words
What is it for?
Use it when modifying, testing, or reviewing the perplexity-agent-mcp codebase, particularly changes involving dependencies, output, security, or API behavior.
Why use it?
It helps prevent changes that break the repository's zero-dependency design, corrupt its JSON-RPC communication, or expose secrets.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/zalez/perplexity-agent-mcp/claude-md
Clone the repo
git clone --depth 1 https://github.com/zalez/perplexity-agent-mcp

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

agentmods badge for perplexity-agent-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/zalez/perplexity-agent-mcp/claude-md.svg)](https://agentmods.dev/instructions/zalez/perplexity-agent-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/zalez/perplexity-agent-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/zalez/perplexity-agent-mcp/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 5,403 This file is loaded in full into every session.
When invoked 5,403 The same file — it is already loaded in full.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.05403 $0.05403
Opus 5 $0.02701 $0.02701
Sonnet 5 $0.01081 $0.01081
Haiku 4.5 $0.00540 $0.00540

Measured yesterday against content hash 5341c582f910, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

perplexity-agent-mcp 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 yesterday.

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.

ergonomic than `urllib.request`. This project's entire pitch is **zero
CLAUDE.md · 287 lines

How it starts

The opening of the file, as written. The whole thing — 287 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Working on perplexity-agent-mcp

This file is guardrails for an agent contributing to this repository, not a summary of what it does — read README.md for that. It exists because this project has a specific, easy-to-trip failure mode: a well-intentioned change that looks like an obvious improvement and quietly breaks the one property the whole repo exists to have. Two concrete examples that would each pass a casual glance:

  • Adding requests (or any other third-party package) because it's more ergonomic than urllib.request. This project's entire pitch is zero runtime dependencies — see SECURITY.md for why that's a security property, not a style preference.
  • Adding a print() for debugging and forgetting to remove it, or having any code path write to the real stdout. stdout is the JSON-RPC protocol stream; one stray line corrupts it, and the client-side symptom is a baffling parse error, not an obvious crash.

Both are mechanically caught before merge (tests/test_no_dependencies.py; the stdout-rebind + tests/test_no_secrets.py), but catching a mistake in CI is worse than not making it. This file exists so you don't make it.

Also read: CONTRIBUTING.md for the contributor workflow, SECURITY.md for the full threat model, and docs/specs/2026-07-22-perplexity-agent-mcp-design.md for the original design rationale. If any of those, or this file, disagree with perplexity_agent_mcp.py itself, the code is correct and the doc is stale — fix the doc, don't trust it over the source.

1. Hard invariants

Every one of these applies to every change, no exceptions without discussing it with the maintainer first. Quoted from the implementation plan's Global Constraints:

  • Zero third-party runtime dependencies in the server, and no extras either. stdlib only. No requirements.txt, no MCP SDK, no pip install for users. The llm adapter has dependencies, but it is a separate distribution built from llm-plugin/ — installing the server never pulls it in. Enforced by tests/test_no_dependencies.py, which allows the adapter exactly two dependencies and the server none.
  • Python floor >=3.10. No match statements requiring 3.11+, no tomllib in the server itself (3.11+), no PEP 695 generics. Develop on 3.14.6; CI matrix covers 3.10–3.14.
  • Single outbound host: https://api.perplexity.ai only. Hardcoded constant. No environment-variable base-URL override — it is an API-key exfiltration vector (SECURITY.md §Network).
  • The API key is never printed, logged, echoed, or attached to an exception. Read from PERPLEXITY_API_KEY at call time, not import time.
  • stdout is exclusively JSON-RPC. All logging goes to stderr. main() calls _claim_stdout(), which grabs the real stdout and points sys.stdout at stderr. It is deliberately NOT an import-time side effect: the llm adapter imports this module, and hijacking stdout on import would redirect that whole program's output. Don't move it back.
  • Two MCP protocol revisions, one process. Modern 2026-07-28 (stateless, no handshake) and legacy 2025-11-25 / 2025-06-18 / 2025-03-26. Era is decided per request, structurally — never by a flag, a setting, or state carried from an earlier request. The three precedence rules live above HANDLERS in the source; that comment is the authority, not this line.
  • Never error on version negotiation — in initialize only. Echo the requested legacy version on a match, else return 2025-11-25. The modern path has the opposite rule and MUST return -32022 for a revision it does not speak. Do not unify these two. They are pinned by tests from opposite sides precisely because unifying them looks like a tidy-up.
  • 2026-07-28 must never enter SUPPORTED_PROTOCOL_VERSIONS, which is the legacy-negotiable set. It is derived from the tail of ADVERTISED_PROTOCOL_VERSIONS so this is impossible rather than merely forbidden; keep the derivation.
  • Validation errors are isError: true, never JSON-RPC -32602 (SEP-1303 — see §3 below).
  • Line length 100. Ruff-formatted. mypy --strict clean. Every public function annotated.
  • Comment density is high by design. This file's product is auditability; a reader must follow it top to bottom without cross-referencing.
  • Copyright: Copyright (c) 2026, Constantin Gonzalez. License: BSD-3-Clause.
  • Never claim cancellation reduces the bill — in code comments, tool descriptions, or docs.

Read the full file on GitHub · 287 lines

Changes

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.

  1. yesterday Changed 5341c582f910
  2. 4d ago First seen · 287 lines · 5,403 tokens per session scan A 47c7d26b0e30

Subscribe to this mod's changes

perplexity-agent-mcp CLAUDE.md is an instructions file published in the GitHub repository zalez/perplexity-agent-mcp (0 stars, last pushed yesterday), licensed BSD-3-Clause. It adds 5,403 tokens to every session, about $0.0270 per session on Opus 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.