home / skills / vaayne / agent-kit / mcp-context7-docs
This skill retrieves up-to-date documentation and code examples for libraries and frameworks by querying Context7 with a resolved library ID.
npx playbooks add skill vaayne/agent-kit --skill mcp-context7-docsReview the files below or copy the command above to add this skill to your agents.
---
name: mcp-context7-docs
description: Query up-to-date documentation and code examples for any programming library or framework. Use when looking up API docs, finding code examples, or checking library usage. Triggers on "how to use [library]", "docs for [package]", "show me examples of [framework]", "Context7 lookup".
---
# Context7 Documentation
MCP service at `https://mcp.context7.com/mcp` (http) with 2 tools.
## Requirements
- `mh` CLI must be installed. If not available, install with:
```bash
curl -fsSL https://raw.githubusercontent.com/vaayne/mcphub/main/scripts/install.sh | sh
```
## Usage
```
List tools: `mh list -u https://mcp.context7.com/mcp -t http`
Get tool details: `mh inspect -u https://mcp.context7.com/mcp -t http <tool-name>`
Invoke tool: `mh invoke -u https://mcp.context7.com/mcp -t http <tool-name> '{"param": "value"}'`
```
## Notes
- Run `inspect` before invoking unfamiliar tools to get full parameter schema
- Timeout: 30s default, use `--timeout <seconds>` to adjust
- **Important**: Always call `resolveLibraryId` first to get the Context7-compatible library ID before calling `queryDocs`, unless user provides ID in `/org/project` format
- Do not call either tool more than 3 times per question
## Tools
| Tool | Description |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `resolveLibraryId` | Resolves a package/product name to a Context7-compatible library ID. Must be called before `queryDocs` to get a valid library ID. |
| `queryDocs` | Retrieves and queries up-to-date documentation and code examples from Context7 for any programming library or framework. Requires a Context7-compatible library ID. |
## Tool Parameters
### `resolveLibraryId`
```
Required:
libraryName (string) — library name to search for, e.g. "react", "nextjs"
query (string) — the question or task you need help with (used for ranking)
```
### `queryDocs`
```
Required:
libraryId (string) — exact Context7 ID, e.g. "/vercel/next.js" or "/vercel/next.js/v14"
query (string) — specific question, e.g. "How to set up JWT authentication in Express.js"
```
## Workflow
1. **Resolve library ID** — get the Context7-compatible ID for the library:
```bash
mh invoke -u https://mcp.context7.com/mcp -t http resolveLibraryId '{"libraryName": "react", "query": "useState hook examples"}'
```
2. **Query documentation** — use the resolved ID to fetch docs:
```bash
mh invoke -u https://mcp.context7.com/mcp -t http queryDocs '{"libraryId": "/facebook/react", "query": "how to use useState hook"}'
```
This skill lets you query up-to-date documentation and code examples for any programming library or framework using the Context7 MCP service. It resolves package names to Context7-compatible IDs and fetches targeted docs or example snippets. Use it when you need authoritative API references, sample code, or usage patterns quickly.
First, call resolveLibraryId to convert a package or product name into a Context7-compatible library ID. Then call queryDocs with that ID and a topic or query string to retrieve relevant documentation and code examples. The service returns structured docs; inspect the tool schema before invoking unfamiliar parameters and adjust timeouts as needed.
Do I always need resolveLibraryId before queryDocs?
Yes, unless you already provide a Context7-compatible ID in /org/project format. resolveLibraryId ensures queryDocs receives a valid ID.
What if a query returns too much content or irrelevant results?
Narrow the topic string, inspect the tool schema to refine parameters, or add filters in your query to target specific sections or versions.