mcp-patterns

mcp-patterns is a skill for Claude Code from softspark/ai-toolkit. It costs 44 tokens per session (2,343 once invoked), scanned A, original, Apache-2.0.

A reference guide for designing MCP servers, which let AI clients use tools and read data through a standard protocol.

In plain words
What is it for?
Use it when defining tool inputs, exposing read-only resources, choosing between local and remote communication, or handling MCP capability negotiation.
Why use it?
It explains the parts and communication methods involved, reducing guesswork when connecting an AI client to your own tools or data.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the ai-toolkit plugin — 115 skills, 44 agents, 14 hooks shipped together

Good fit Use it when defining tool inputs, exposing read-only resources, choosing between local and remote communication, or handling MCP capability negotiation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/softspark/ai-toolkit/mcp-patterns
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.

Any agent
npx skills add softspark/ai-toolkit --skill mcp-patterns
Clone the repo
git clone --depth 1 https://github.com/softspark/ai-toolkit

Made for: Claude Code.

Or install ai-toolkit, the plugin that ships this one along with the rest of its 115 skills, 44 agents, 14 hooks.

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-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/softspark/ai-toolkit/mcp-patterns/github.svg)](https://agentmods.dev/skills/softspark/ai-toolkit/mcp-patterns)
Your own site
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/mcp-patterns"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/mcp-patterns/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-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/mcp-patterns"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/mcp-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,343 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00044 $0.02343
Opus 5.5 $0.00018 $0.00937
Sonnet 5.5 $0.00009 $0.00469
Haiku 4.5 $0.00004 $0.00234

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

Security

Grade A, and why

mcp-patterns 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.

app/skills/mcp-patterns/SKILL.md · 330 lines

How it starts

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

MCP Patterns Skill

MCP Specification (2025-06-18)

Core Concepts

Concept Description
Server Exposes tools, resources, prompts to clients
Client Connects to servers, invokes tools
Transport Communication layer (stdio, HTTP, SSE)
Tool Executable function with JSON Schema
Resource Read-only data (files, URLs)
Prompt Reusable prompt template

Tool Definition Pattern

// TypeScript with @modelcontextprotocol/sdk
server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [{
    name: "search_kb",
    description: "Search the knowledge base",
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "Search query"
        },
        limit: {
          type: "number",
          description: "Max results",
          default: 10
        }
      },
      required: ["query"]
    },
    annotations: {
      readOnlyHint: true,      // Doesn't modify state
      idempotentHint: true,    // Same input = same output
      openWorldHint: false     // Bounded result set
    }
  }]
}));

Tool Annotations

Annotation Meaning Use When
readOnlyHint No side effects Read operations
destructiveHint Deletes/modifies data Write operations
idempotentHint Safe to retry GET-like operations
openWorldHint Results may change External API calls

How to Write a Tool Description

The description is the only signal the model uses to route a request. The schema constrains the call; the description decides whether the call happens at all. Treat it as a routing contract, not API prose. A good one has five parts, in this order:

  1. One-line purpose — what the tool does, in plain terms. Lead with a verb. Search indexed knowledge-base documents and return ranked passages. Skip the HTTP verb and endpoint; calls GET /v2/search tells the model nothing about intent.
  2. WHEN TO USE — concrete trigger phrasings the user might say, not abstract categories. List the actual shapes: "find docs about X", "what does the KB say about Y", "look up the runbook for Z". Models match on surface form, so give them surface forms.
  3. WHEN NOT TO USE — the section that does most of the disambiguation work. Name the near-miss tools and the boundary that separates them. This is where you prevent the model from firing the wrong tool on a request that looks similar. Empty WHEN NOT TO USE = the tool is under-specified.
  4. CRITICAL — one line for the single non-obvious failure mode. The constraint a reader would not guess from the schema: a required ordering, an ID that must come from another call, a cost/irreversibility warning. One line, not a checklist.
  5. Self-test — close with a question the model can apply to itself to decide fit. Ask: is the user looking up existing content, or asking me to create new content? This tool is read-only — if they want to create, stop.

Read the full file on GitHub · 330 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 · 330 lines · 44 tokens per session scan A 5c36b8f7c17c

Subscribe to this mod's changes

mcp-patterns is a skill published in the GitHub repository softspark/ai-toolkit (180 stars, last pushed yesterday), licensed Apache-2.0. It adds 44 tokens to every session and 2,343 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-09-03.