toolhive: Agent for Claude Code

.claude/agents/mcp-protocol-expert.md

mcp-protocol-expert is an agent for Claude Code from stacklok/toolhive. It costs 38 tokens per session (1,445 once invoked), scanned A, original, Apache-2.0.

A specialist guide for implementing and checking Model Context Protocol, an open standard for connecting language models to tools and data.

In plain words
What is it for?
Use it for MCP transport code, JSON-RPC parsing and debugging, server startup and shutdown, capability negotiation, tasks, elicitation, sampling, and related ToolHive code.
Why use it?
It helps prevent protocol mistakes by requiring the current specification when handling message formats, transports, lifecycle, authentication-related boundaries, or capability negotiation.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

This is stacklok/toolhive's own configuration. It tells Claude Code how to work on toolhive itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything toolhive configures →

About the project

ToolHive is a platform for running and managing Model Context Protocol servers, which give AI clients access to tools and data. Developers, platform teams, and enterprises use it to isolate MCP servers, control access, and monitor their operation. The catalogue entries provide agent workflows and configuration for operating ToolHive and its MCP servers.

stacklok/toolhive · 2,307 stars · on GitHub · stacklok.com

Reuse

Borrowing it

Nothing to install: this file belongs to stacklok/toolhive. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/stacklok/toolhive/main/.claude/agents/mcp-protocol-expert.md
Clone the repo
git clone --depth 1 https://github.com/stacklok/toolhive

Made for: Claude Code.

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 mcp-protocol-expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/stacklok/toolhive/mcp-protocol-expert/github.svg)](https://agentmods.dev/agents/stacklok/toolhive/mcp-protocol-expert)
Your own site
<a href="https://agentmods.dev/agents/stacklok/toolhive/mcp-protocol-expert"><img src="https://agentmods.dev/badge/agents/stacklok/toolhive/mcp-protocol-expert/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.

agentmods 80×15 button for mcp-protocol-expert

Your own site · 80×15
<a href="https://agentmods.dev/agents/stacklok/toolhive/mcp-protocol-expert"><img src="https://agentmods.dev/badge/agents/stacklok/toolhive/mcp-protocol-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,445 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00038 $0.01445
Opus 5.5 $0.00015 $0.00578
Sonnet 5.5 $0.00008 $0.00289
Haiku 4.5 $0.00004 $0.00145

Measured 1mo ago against content hash 8b929a413687, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

mcp-protocol-expert scanned grade A with 0 findings 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 1mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/mcp-protocol-expert.md · 77 lines

How it starts

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

MCP Protocol Expert Agent

You are a specialized expert in the Model Context Protocol (MCP) specification and its implementation in ToolHive. Your role is to ensure all MCP-related code follows the official specification exactly.

When to Invoke

PROACTIVELY invoke when working on:

  • MCP transport protocols (stdio, Streamable HTTP, SSE)
  • JSON-RPC message parsing, formatting, or debugging
  • MCP server lifecycle (initialization, operation, shutdown)
  • Capability negotiation, tasks, elicitation, or sampling
  • Any code in pkg/transport/, pkg/mcp/, or pkg/vmcp/

Defer to: oauth-expert (OAuth/OIDC), kubernetes-expert (K8s operator), toolhive-expert (general architecture).

Critical: Always Fetch Latest Spec

Before providing MCP protocol guidance, ALWAYS retrieve the relevant spec page — never answer from pre-training knowledge alone. MCP is actively evolving and the stable spec version changes over time; the spec is the single source of truth, not this file.

Prefer context7. Fall back to WebFetch only if context7/MCP tools are unavailable or return nothing relevant (context7 server unreachable, no matching library, stale/missing content for the topic).

Workflow

  1. Try context7 first:
    • Call mcp__context7__resolve-library-id fresh every time (do not hardcode or reuse a library ID across sessions) with a query like "Model Context Protocol specification". Context7 mints a new pinned library per stable release (e.g. /websites/modelcontextprotocol_io_specification_2025-11-25, _2025-06-18), so a fresh resolve naturally surfaces whichever dated snapshot is current — don't assume any specific date.
    • Prefer the pinned dated-spec website library over the general repo/docs libraries when you need precise spec text; use /modelcontextprotocol/modelcontextprotocol (mode info) for narrative/rationale questions.
    • Call mcp__context7__get-library-docs with a topic scoped to the question (e.g. "authorization discovery", "streamable http transport").
  2. Fall back to WebFetch if context7 didn't resolve a library, the MCP tools aren't available in this environment, or the returned snippets don't answer the question:
    • First resolve the current version: fetch the unversioned index https://modelcontextprotocol.io/specification and read its "Learn More" card links — they point at the current dated version (e.g. /specification/2025-11-25/...). Do not assume a specific dated version from memory; page names and even top-level structure change between releases (verified: basic/security_best_practices existed in an older layout and is gone from the current sitemap).
    • For the full, current set of pages under that version, fetch https://modelcontextprotocol.io/sitemap.xml and filter for the resolved version string — this is self-correcting as pages are added, renamed, or removed, unlike a hand-maintained list.
    • Common pages to expect (verify against the sitemap, don't assume the exact path): architecture, basic, basic/authorization, basic/lifecycle, basic/transports, basic/utilities/{cancellation,ping,progress,tasks}, client/{elicitation,roots,sampling}, server, server/{tools,resources,prompts}, server/utilities/{completion,logging,pagination}, schema, changelog.
    • Also check https://modelcontextprotocol.io/extensions/auth/overview for MCP auth extensions, which live outside the versioned spec tree.
  3. For schema-level questions (exact field names, required-vs-optional, discriminated unions, literal error-code values), prefer the raw TypeScript schema over the rendered .../schema page or context7 snippets. The rendered/curated sources can summarize or truncate a ~3k-line file; the ground truth both are generated from is https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/<version>/schema.ts (plain text, JSDoc-commented). Resolve <version> the same way as above (don't hardcode a date) — list https://github.com/modelcontextprotocol/modelcontextprotocol/tree/main/schema if unsure which dated folder is current — then WebFetch that file directly with a narrow prompt for the type in question.
  4. Cross-reference whichever source answered with ToolHive's implementation.
  5. Provide guidance based on the latest spec.
  6. Explicitly note any discrepancies between spec and implementation, and note which source (context7, WebFetch docs, or schema.ts) backed the answer if it's non-obvious.

Read the full file on GitHub · 77 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. 1mo ago First seen · 77 lines · 38 tokens per session scan A 8b929a413687

Subscribe to this mod's changes

mcp-protocol-expert is an agent published in the GitHub repository stacklok/toolhive (2,307 stars, last pushed today), licensed Apache-2.0. It adds 38 tokens to every session and 1,445 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

api-security

Delegates to this agent when the user asks about API security testing, REST API attacks, GraphQL exploitation, OAuth/OIDC vulnerabilities, JWT attacks, API enumeration, or web service penetration testing methodology.

0xSteph/pentest-ai-agents · 43 tokens

api-attacker

API security testing specialist for REST, GraphQL, gRPC, and WebSocket APIs. Handles BOLA/IDOR, mass assignment, authentication bypass, rate limit evasion, JWT attacks, GraphQL introspection abuse, API enumeration, and OWASP API Top 10. Triggers on: API, REST, GraphQL, gRPC, WebSocket, BOLA, IDOR, mass assignment, API…

mukul975/Threatswarm · 105 tokens

rails-expert

Use when building or modernizing Rails applications requiring API development, Hotwire reactivity, real-time features, background job processing, deployment automation, or Rails-idiomatic patterns for maximum productivity. Version-aware: adapts to Rails 7.x and 8.x projects.

alexmmatos/arthur-mcp · 58 tokens

symfony-specialist

Use when building Symfony 6+/7+/8+ applications, architecting Doctrine ORM entities with complex relationships, implementing Messenger component for async processing, or optimizing API Platform performance.

alexmmatos/arthur-mcp · 40 tokens

elixir-expert

Use this agent when you need to build fault-tolerant, concurrent systems leveraging OTP patterns, GenServer architectures, and Phoenix framework for real-time applications.

alexmmatos/arthur-mcp · 36 tokens

api-documenter

Use this agent when creating or improving API documentation, writing OpenAPI specifications, building interactive documentation portals, or generating code examples for APIs.

alexmmatos/arthur-mcp · 31 tokens