New to Claude Skills? Learn how to install them →

Iposthog on GitHub

Improving MCP Tools

Free

Enhance your MCP agent's performance through data-driven improvements.

by posthog37.6k stars on posthog/posthog
2 views
Updated Aug 11, 2026
Get this skill

Free · Opens the source repo

What Improving MCP Tools does

The Improving MCP Tools skill is designed to systematically enhance the performance of an MCP server by leveraging a structured campaign approach. This skill operates through a loop that begins with measuring the current agent experience using a predefined evaluation harness. By analyzing production data, it identifies the most impactful tool problems and implements targeted fixes. Each change is validated based on evidence, ensuring that only those improvements that yield measurable benefits are deployed. This methodical approach is particularly beneficial for developers and designers looking to optimize their MCP tools without introducing unverified changes.

The core of this skill is the objective function that relies on a set of benchmarks defined in benchmark/tasks.yaml. These benchmarks allow for consistent scoring across different iterations, ensuring that improvements can be accurately tracked and validated. The skill supports both probe mode, which provides deterministic evaluations of tool discoverability and performance, and agent mode, which assesses task success and tool-selection accuracy. This dual approach allows for comprehensive insights into tool effectiveness and user experience.

When using this skill, practitioners can expect a clear, iterative process that includes measuring baseline performance, identifying a single issue to address, implementing a bounded fix, validating the change, and finally shipping the improvement if it meets the established criteria. The skill emphasizes the importance of documentation and evidence, as every change must be accompanied by before-and-after scores to ensure accountability and traceability in the improvement process.

This skill is ideal for teams focused on enhancing their MCP tools based on empirical evidence, ensuring that each iteration leads to tangible improvements in agent performance. However, it requires a commitment to following the outlined guardrails and processes to maintain the integrity of the improvement campaign.

When to use it

Use this skill when you need to enhance the performance of your MCP tools based on measurable metrics and evidence.

When not to use it

This skill is not suitable for rapid, unverified changes or when immediate fixes are required without data validation.

What you can build with it

Improving Tool Discoverability

Run a campaign to enhance how easily agents can find the right tools by adjusting descriptions based on user feedback.

Validating Performance Changes

Measure the impact of recent changes to the MCP tools by comparing before-and-after scores to ensure improvements are effective.

Documenting Improvement Iterations

Keep a detailed journal of each improvement iteration to provide transparency and accountability for changes made to the MCP tools.

How to install Improving MCP Tools

View source

1. Install with the skills CLI

npx skills add posthog/posthog/improving-mcp-tools --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by posthog

Improving MCP tools

An MCP server gets better only in ways you can measure. This skill is the campaign procedure: score the current agent experience, fix the biggest problem, re-score, and only ship changes the numbers justify. It is the operating manual for the "improve my MCP" loop — one iteration per pass, journaled so a later iteration (or a different agent) can resume without repeating work.

The objective function

services/mcp/evals/ is the harness. benchmark/tasks.yaml is a fixed set of agent tasks with expected_tools and success_criteria; scores are only comparable across runs of the same benchmark version.

  • Probe mode (deterministic, no LLM): LIVE_MCP_URL=... LIVE_MCP_TOKEN=... pnpm exec tsx evals/runner/probe.ts --out score.json from services/mcp/. Reports tool-presence misses (discoverability), probe failures, and latency p50/p95. Non-zero exit = regression.
  • Agent mode (LLM replay + judge): scores task success and tool-selection accuracy. Use it for description/discoverability changes — probes cannot detect that an agent picks the wrong tool.

Run the harness against a seeded local or devbox stack, never against a customer project. Local recipe: NODE_ENV=development PORT=9876 POSTHOG_API_BASE_URL=http://localhost:8000 pnpm dev:hono, personal API key as LIVE_MCP_TOKEN.

One iteration

  1. Measure. Run the harness for a baseline. Pull production evidence with the MCP analytics tools (query-mcp-tool-stats, query-mcp-tool-failures, query-mcp-tool-descriptions, query-mcp-tool-sample-intents) and the lenses in the signals scout cookbook (products/signals/skills/signals-scout-mcp-tool-calls/references/queries.md): failure leaderboard, retry/struggle, latency, intents that matched no tool.
  2. Pick one issue. Rank by reach × severity. Skip anything the journal shows with two failed attempts. One issue per iteration — a PR that fixes three things can't be attributed to any of them when scores move.
  3. Fix, bounded. Only files inside the allowlist (below). Typical fixes: sharpen a tool description so the right intent finds it, tighten an input schema that agents keep getting wrong, fix an annotation, update a skill.
  4. Validate. Re-run the affected benchmark slice plus a no-regression sample. Keep the change only if the target metric improves and nothing else degrades. A discarded change is a normal outcome — journal it and move on.
  5. Ship. One PR per iteration with before/after scores in the body (format in references/campaign-journal.md). Keep it stampable: ≤400 changed lines, only files inside the allowlist below, apply the stamphog label. Autonomy level comes from the campaign config — default is draft PR for human review; only arm auto-merge when the operator has explicitly enabled the self-driving experiment (see guardrails).
  6. Journal. Append the iteration record before ending the pass.

Hard guardrails

These are not suggestions; violating any of them ends the campaign pass.

  • Allowlist — a campaign PR may only touch: products/*/mcp/tools.yaml, products/*/skills/**, services/mcp/evals/**, the codegen outputs of pnpm generate-tools / scaffold-yaml (services/mcp/src/tools/generated/** and services/mcp/schema/generated-tool-definitions.json), and docs. Anything else (handler code, package manifests, workflows, migrations, auth paths) → stop and hand the finding to a human as a draft PR or report instead.
  • Read-only against data. The harness and all production queries are read-only. Never create, mutate, or delete customer-visible objects while measuring.
  • Evidence or it didn't happen. No PR without a baseline score, an after score, and the exact harness commands used.
  • Benchmark integrity. Never edit benchmark/tasks.yaml in the same PR as a fix it validates — changing the exam and the answer together proves nothing. Benchmark changes are their own PR and bump version.
  • Budgets. Respect the operator's iteration/token/PR caps (default: stop after 3 open unmerged campaign PRs). Two failed attempts on an issue parks it permanently.
  • Kill switch. If the campaign config, its feature flag, or the operator says stop — stop mid-iteration, journal state, end cleanly.

Failure modes to expect

  • A description change that helps one intent can steal traffic from the right tool for another — that's why the no-regression sample is mandatory. The intent-cluster snapshot's tool_overlaps (see exploring-mcp-intent-clusters) lists exactly which pairs compete for which intents: snapshot it before a description rewrite and recompute after, and treat a capture shift in an overlapping pair as the regression signal.
  • Probe latency varies with stack warmth; compare medians across ≥3 runs before attributing a latency change to your fix.
  • Tool-presence misses can be feature-flag gating, not catalog absence — check getToolsForFeatures gating before "fixing" discoverability.

Frequently asked questions about Improving MCP Tools

Similar skills