Skip to content

Commit 2542c9c

Browse files
authored
feat: add mcp documentation skill for spec-aware development (#609)
Add a Claude Code skill (`.claude/skills/mcp-docs/`) that provides live MCP documentation and specification context ## Motivation and Context The modelcontextprotocol.io site provides both an [MCP server](https://modelcontextprotocol.io/mcp) and an [llms.txt](https://modelcontextprotocol.io/llms.txt) index for machine-readable access to the documentation. This skill leverages both to give Claude live access to the current spec during development. ## How Has This Been Tested? The skill was evaluated on 3 realistic scenarios (implementation, code review, spec question) comparing with-skill vs without-skill baseline: - **Pass rate**: 100% vs 67% — skill consistently cites spec sources and uses RFC 2119 language - **Token efficiency**: 41% fewer tokens on average (44k vs 75k) — goes directly to spec instead of reverse-engineering from codebase - **Accuracy**: with-skill discovered URL mode elicitation (new in spec 2025-11-25) that baseline missed entirely - **Description triggering**: optimized through 5 iterations of automated trigger evaluation against 20 test prompts ## Breaking Changes None ## Types of changes - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [x] Documentation update ## Checklist - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [x] I have added appropriate error handling - [x] I have added or updated documentation as needed
1 parent c136ad9 commit 2542c9c

2 files changed

Lines changed: 77 additions & 1 deletion

File tree

.claude/skills/mcp-docs/SKILL.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
name: mcp-docs
3+
description: >
4+
Fetch live MCP specification and docs from modelcontextprotocol.io. Training data may be
5+
outdated — default to using this skill when the query touches MCP protocol in any way.
6+
Trigger for: implementing or debugging MCP features (sampling, elicitation, completion, tools,
7+
resources, prompts, transports); SEPs or spec requirements; MCP transport behavior (SSE,
8+
Streamable HTTP, reconnection, retry); authorization/OAuth; conformance test failures;
9+
capability negotiation; message schemas. Skip only for pure Kotlin, build system, or
10+
refactoring tasks with zero MCP protocol dependency. When in doubt, trigger.
11+
user_invocable: true
12+
---
13+
14+
# MCP Documentation Skill
15+
16+
Provides access to the official MCP specification and docs from modelcontextprotocol.io. The spec evolves faster than training data — always consult live documentation for protocol specifics like message schemas, required fields, capability negotiation, error handling, and transport requirements.
17+
18+
## When to use
19+
20+
**Proactively** (without being asked):
21+
- Implementing a feature defined in the MCP spec
22+
- Reviewing code that implements MCP protocol behavior
23+
- Fixing conformance test failures
24+
25+
**On demand** (user asks or invokes `/mcp-docs`):
26+
- Questions about how a specific MCP feature works
27+
- Clarifying spec ambiguities
28+
- Looking up SEPs (Specification Enhancement Proposals)
29+
30+
## How to fetch documentation
31+
32+
### Strategy: MCP tool first, llms.txt fallback
33+
34+
**Step 1 — Try the MCP search tool.** If `search_model_context_protocol` is available, use it:
35+
36+
```
37+
search_model_context_protocol(query: "<your search query>")
38+
```
39+
40+
One call, semantically ranked results. Fastest path.
41+
42+
**Step 2 — Fallback to llms.txt + WebFetch.** If the MCP tool is not available:
43+
44+
1. Fetch the documentation index:
45+
```
46+
WebFetch("https://modelcontextprotocol.io/llms.txt", "Return the full content as-is")
47+
```
48+
49+
2. Identify the relevant page URL(s) from the index. Key sections:
50+
- **Specification**: `specification/...` — protocol details, message formats, transports, lifecycle
51+
- **SEPs**: `seps/...` — specification enhancement proposals
52+
- **Learning**: `docs/learn/...` — architecture, concepts
53+
- **Development**: `docs/develop/...` — building clients/servers
54+
55+
3. Fetch the specific page:
56+
```
57+
WebFetch("<page-url>", "Return the full content of this documentation page")
58+
```
59+
60+
### Version handling
61+
62+
Always use the latest spec version by default. Only use a specific version or draft when the user explicitly requests it (e.g., "check the 2025-03-26 spec" or "what does the draft say").
63+
64+
### Search guidance
65+
66+
- Protocol message formats, required fields, capability negotiation → **Specification** section
67+
- Feature motivation, design rationale → relevant **SEP**
68+
- High-level concepts and architecture → **Learning** resources
69+
- Use your judgment on query count. A field-level question may need one page; implementing a feature may need 2-3.
70+
71+
## Presenting information
72+
73+
- **Always cite sources.** Include links to spec pages used: `(source: <url>)`
74+
- **Spec over training data** for specific protocol details (schemas, fields, error codes, capabilities). Training data is fine for general MCP concepts.
75+
- **Preserve RFC 2119 language.** The spec uses MUST/SHOULD/MAY — keep this distinction when explaining requirements.
76+
- **Be concise.** Focus on the details relevant to the user's task. Avoid dumping entire spec pages — extract what matters for the specific question or implementation at hand.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ node_modules
5656
dist
5757

5858
### SWE agents ###
59-
.claude/
59+
.claude/settings.local.json
6060
.junie/
6161

6262
### Conformance test results ###

0 commit comments

Comments
 (0)