chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "context7",
|
||||
"description": "Upstash Context7 MCP server for up-to-date documentation lookup. Pull version-specific documentation and code examples directly from source repositories into your LLM context.",
|
||||
"author": {
|
||||
"name": "Upstash"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"type": "http",
|
||||
"url": "https://mcp.context7.com/mcp",
|
||||
"headers": {
|
||||
"CONTEXT7_API_KEY": "${CONTEXT7_API_KEY:-}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
# Context7 Plugin for Claude Code
|
||||
|
||||
Context7 solves a common problem with AI coding assistants: outdated training data and hallucinated APIs. Instead of relying on stale knowledge, Context7 fetches current documentation directly from source repositories.
|
||||
|
||||
## What's Included
|
||||
|
||||
This plugin provides:
|
||||
|
||||
- **MCP Server** - Connects Claude Code to Context7's documentation service
|
||||
- **Skills** - Auto-triggers documentation lookups when you ask about libraries
|
||||
- **Agents** - A dedicated `docs-researcher` agent for focused lookups
|
||||
- **Commands** - `/context7:docs` for manual documentation queries
|
||||
|
||||
## Installation
|
||||
|
||||
Add the marketplace and install the plugin:
|
||||
|
||||
```bash
|
||||
claude plugin marketplace add upstash/context7
|
||||
claude plugin install context7@context7-marketplace
|
||||
```
|
||||
|
||||
## API Key (Recommended)
|
||||
|
||||
Without an API key, the plugin connects anonymously and shares the anonymous rate limits. To use your own plan, create an API key in the [Context7 dashboard](https://context7.com/dashboard) and export it as an environment variable before launching Claude Code:
|
||||
|
||||
```bash
|
||||
# e.g. in ~/.zshrc or ~/.bashrc
|
||||
export CONTEXT7_API_KEY="your-api-key"
|
||||
```
|
||||
|
||||
The plugin's MCP server configuration picks up `CONTEXT7_API_KEY` automatically. Restart Claude Code after setting it, then verify the key is being used by checking your usage in the [dashboard](https://context7.com/dashboard).
|
||||
|
||||
## Available Tools
|
||||
|
||||
### resolve-library-id
|
||||
|
||||
Searches for libraries and returns Context7-compatible identifiers.
|
||||
|
||||
```
|
||||
Input: "next.js"
|
||||
Output: { id: "/vercel/next.js", name: "Next.js", versions: ["v15.1.8", "v14.2.0", ...] }
|
||||
```
|
||||
|
||||
### query-docs
|
||||
|
||||
Fetches documentation for a specific library, ranked by relevance to your question.
|
||||
|
||||
```
|
||||
Input: { libraryId: "/vercel/next.js", query: "app router middleware" }
|
||||
Output: Relevant documentation snippets with code examples
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
The plugin works automatically when you ask about libraries:
|
||||
|
||||
- "How do I set up authentication in Next.js 15?"
|
||||
- "Show me React Server Components examples"
|
||||
- "What's the Prisma syntax for relations?"
|
||||
|
||||
For manual lookups, use the command:
|
||||
|
||||
```
|
||||
/context7:docs next.js app router
|
||||
/context7:docs /vercel/next.js/v15.1.8 middleware
|
||||
```
|
||||
|
||||
Or spawn the docs-researcher agent when you want to keep your main context clean:
|
||||
|
||||
```
|
||||
spawn docs-researcher to look up Supabase auth methods
|
||||
```
|
||||
|
||||
## Version Pinning
|
||||
|
||||
To get documentation for a specific version, include the version in the library ID:
|
||||
|
||||
```
|
||||
/vercel/next.js/v15.1.8
|
||||
/supabase/supabase/v2.45.0
|
||||
```
|
||||
|
||||
The `resolve-library-id` tool returns available versions, so you can pick the one that matches your project.
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
name: docs-researcher
|
||||
description: Lightweight agent for fetching library documentation without cluttering your main conversation context.
|
||||
model: sonnet
|
||||
---
|
||||
|
||||
You are a documentation researcher specializing in fetching up-to-date library and framework documentation from Context7.
|
||||
|
||||
## Your Task
|
||||
|
||||
When given a question about a library or framework, fetch the relevant documentation and return a concise, actionable answer with code examples.
|
||||
|
||||
## Process
|
||||
|
||||
1. **Identify the library**: Extract the library/framework name from the user's question.
|
||||
|
||||
2. **Resolve the library ID**: Call `resolve-library-id` with:
|
||||
- `libraryName`: The library name (e.g., "react", "next.js", "prisma")
|
||||
- `query`: The user's full question for relevance ranking
|
||||
|
||||
3. **Select the best match**: From the results, pick the library with:
|
||||
- Exact or closest name match
|
||||
- Highest benchmark score
|
||||
- Appropriate version if the user specified one (e.g., "React 19" → look for v19.x)
|
||||
|
||||
4. **Fetch documentation**: Call `query-docs` with:
|
||||
- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)
|
||||
- `query`: The user's specific question for targeted results, scoped to a single concept
|
||||
|
||||
5. **Return a focused answer**: Summarize the relevant documentation with:
|
||||
- Direct answer to the question
|
||||
- Code examples from the docs
|
||||
- Links or references if available
|
||||
|
||||
## Guidelines
|
||||
|
||||
- Pass the user's full question as the query parameter for better relevance, but keep each query to a single concept
|
||||
- If the question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate `query-docs` call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic
|
||||
- When the user mentions a version (e.g., "Next.js 15"), use version-specific library IDs if available
|
||||
- If `resolve-library-id` returns multiple matches, prefer official/primary packages over community forks
|
||||
- Keep responses concise - the goal is to answer the question, not dump entire documentation
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
description: Look up documentation for any library
|
||||
argument-hint: <library> [query]
|
||||
---
|
||||
|
||||
# /context7:docs
|
||||
|
||||
Fetches up-to-date documentation and code examples for a library.
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/context7:docs <library> [query]
|
||||
```
|
||||
|
||||
- **library**: The library name, or a Context7 ID starting with `/`
|
||||
- **query**: What you're looking for (optional but recommended; run the command once per distinct concept, unless asking how they interact)
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
/context7:docs react hooks
|
||||
/context7:docs next.js authentication
|
||||
/context7:docs prisma relations
|
||||
/context7:docs /vercel/next.js/v15.1.8 app router
|
||||
/context7:docs /supabase/supabase row level security
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
1. If the library starts with `/`, it's used directly as the Context7 ID
|
||||
2. Otherwise, `resolve-library-id` finds the best matching library
|
||||
3. `query-docs` fetches documentation relevant to your query
|
||||
4. Results include code examples and explanations
|
||||
|
||||
## Version-Specific Lookups
|
||||
|
||||
Include the version in the library ID for pinned documentation:
|
||||
|
||||
```
|
||||
/context7:docs /vercel/next.js/v15.1.8 middleware
|
||||
/context7:docs /facebook/react/v19.0.0 use hook
|
||||
```
|
||||
|
||||
This is useful when you're working with a specific version and want docs that match exactly.
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: context7-mcp
|
||||
description: This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
|
||||
---
|
||||
|
||||
When the user asks about libraries, frameworks, or needs code examples, use Context7 to fetch current documentation instead of relying on training data.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Activate this skill when the user:
|
||||
|
||||
- Asks setup or configuration questions ("How do I configure Next.js middleware?")
|
||||
- Requests code involving libraries ("Write a Prisma query for...")
|
||||
- Needs API references ("What are the Supabase auth methods?")
|
||||
- Mentions specific frameworks (React, Vue, Svelte, Express, Tailwind, etc.)
|
||||
|
||||
## How to Fetch Documentation
|
||||
|
||||
### Step 1: Resolve the Library ID
|
||||
|
||||
Call `resolve-library-id` with:
|
||||
|
||||
- `libraryName`: The library name extracted from the user's question
|
||||
- `query`: The user's full question (improves relevance ranking)
|
||||
|
||||
### Step 2: Select the Best Match
|
||||
|
||||
From the resolution results, choose based on:
|
||||
|
||||
- Exact or closest name match to what the user asked for
|
||||
- Higher benchmark scores indicate better documentation quality
|
||||
- If the user mentioned a version (e.g., "React 19"), prefer version-specific IDs
|
||||
|
||||
### Step 3: Fetch the Documentation
|
||||
|
||||
Call `query-docs` with:
|
||||
|
||||
- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)
|
||||
- `query`: The user's specific question, scoped to a single concept
|
||||
|
||||
If the user's question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate `query-docs` call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic.
|
||||
|
||||
### Step 4: Use the Documentation
|
||||
|
||||
Incorporate the fetched documentation into your response:
|
||||
|
||||
- Answer the user's question using current, accurate information
|
||||
- Include relevant code examples from the docs
|
||||
- Cite the library version when relevant
|
||||
|
||||
## Guidelines
|
||||
|
||||
- **Be specific**: Pass the user's full question as the query for better results, but keep each query to a single concept
|
||||
- **One topic per query**: Split multi-topic questions into separate `query-docs` calls — resolve the library ID once, then query per concept, unless the question is about how the concepts interact
|
||||
- **Version awareness**: When users mention versions ("Next.js 15", "React 19"), use version-specific library IDs if available from the resolution step
|
||||
- **Prefer official sources**: When multiple matches exist, prefer official/primary packages over community forks
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "context7",
|
||||
"version": "1.0.1",
|
||||
"description": "Upstash Context7 MCP server for up-to-date documentation lookup. Pull version-specific documentation and code examples directly from source repositories into your LLM context.",
|
||||
"author": {
|
||||
"name": "Upstash",
|
||||
"email": "context7@upstash.com",
|
||||
"url": "https://upstash.com"
|
||||
},
|
||||
"homepage": "https://context7.com",
|
||||
"repository": "https://github.com/upstash/context7",
|
||||
"license": "MIT",
|
||||
"keywords": ["documentation", "context", "mcp", "library-docs"],
|
||||
"skills": "./skills/",
|
||||
"mcpServers": "./.mcp.json",
|
||||
"interface": {
|
||||
"displayName": "Context7",
|
||||
"shortDescription": "Fetch current library documentation in Codex",
|
||||
"longDescription": "Context7 adds current, version-aware library documentation and code examples to Codex through the Context7 MCP server.",
|
||||
"developerName": "Upstash",
|
||||
"category": "Developer Tools",
|
||||
"capabilities": ["Read"],
|
||||
"websiteURL": "https://context7.com",
|
||||
"privacyPolicyURL": "https://upstash.com/privacy",
|
||||
"termsOfServiceURL": "https://upstash.com/terms",
|
||||
"defaultPrompt": [
|
||||
"Use Context7 for Next.js middleware docs.",
|
||||
"Find current Prisma relation query examples."
|
||||
],
|
||||
"brandColor": "#059669"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"type": "http",
|
||||
"url": "https://mcp.context7.com/mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
# Context7 Plugin for Codex
|
||||
|
||||
Context7 solves a common problem with AI coding assistants: outdated training data and hallucinated APIs. Instead of relying on stale knowledge, Context7 fetches current documentation directly from source repositories.
|
||||
|
||||
## Installation
|
||||
|
||||
Add the Context7 marketplace and install the plugin:
|
||||
|
||||
```bash
|
||||
codex plugin marketplace add upstash/context7
|
||||
codex plugin add context7@context7-marketplace
|
||||
```
|
||||
|
||||
After adding the plugin, a browser window opens so you can log in to Context7 via OAuth. Start a new Codex thread after installation so Codex can load the plugin's skill and MCP tools.
|
||||
|
||||
## What's Included
|
||||
|
||||
This plugin provides:
|
||||
|
||||
- **MCP Server** - Connects Codex to Context7's documentation service
|
||||
- **Skills** - Auto-triggers documentation lookups when you ask about libraries
|
||||
|
||||
## Authentication
|
||||
|
||||
The plugin connects to the hosted Context7 MCP server:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "http",
|
||||
"url": "https://mcp.context7.com/mcp"
|
||||
}
|
||||
```
|
||||
|
||||
When you add the plugin, a browser window opens to log in to Context7 via OAuth, so your requests use your account's authenticated rate limits. On remote or headless machines where a browser can't open, run `npx ctx7 setup --codex` instead — it uses the OAuth device flow and writes an API-key-backed configuration to `~/.codex/config.toml`. Create or manage API keys in the [Context7 dashboard](https://context7.com/dashboard).
|
||||
|
||||
## Available Tools
|
||||
|
||||
### resolve-library-id
|
||||
|
||||
Searches for libraries and returns Context7-compatible identifiers.
|
||||
|
||||
```text
|
||||
Input: "next.js"
|
||||
Output: { id: "/vercel/next.js", name: "Next.js", versions: ["v15.1.8", "v14.2.0", ...] }
|
||||
```
|
||||
|
||||
### query-docs
|
||||
|
||||
Fetches documentation for a specific library, ranked by relevance to your question.
|
||||
|
||||
```text
|
||||
Input: { libraryId: "/vercel/next.js", query: "app router middleware" }
|
||||
Output: Relevant documentation snippets with code examples
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
The bundled skill works automatically when you ask about libraries:
|
||||
|
||||
- "How do I set up authentication in Next.js 15?"
|
||||
- "Show me React Server Components examples"
|
||||
- "What's the Prisma syntax for relations?"
|
||||
|
||||
You can also invoke it explicitly:
|
||||
|
||||
```text
|
||||
use context7 for Next.js middleware docs
|
||||
use context7 for Prisma query examples with relations
|
||||
use context7 for the Supabase syntax for row-level security
|
||||
```
|
||||
|
||||
To get documentation for a specific version, include the version in the library ID:
|
||||
|
||||
```text
|
||||
/vercel/next.js/v15.1.8
|
||||
/supabase/supabase/v2.45.0
|
||||
```
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: context7-mcp
|
||||
description: This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
|
||||
---
|
||||
|
||||
When the user asks about libraries, frameworks, or needs code examples, use Context7 to fetch current documentation instead of relying on training data.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Activate this skill when the user:
|
||||
|
||||
- Asks setup or configuration questions ("How do I configure Next.js middleware?")
|
||||
- Requests code involving libraries ("Write a Prisma query for...")
|
||||
- Needs API references ("What are the Supabase auth methods?")
|
||||
- Mentions specific frameworks (React, Vue, Svelte, Express, Tailwind, etc.)
|
||||
|
||||
## How to Fetch Documentation
|
||||
|
||||
### Step 1: Resolve the Library ID
|
||||
|
||||
Call `resolve-library-id` with:
|
||||
|
||||
- `libraryName`: The library name extracted from the user's question
|
||||
- `query`: The user's full question (improves relevance ranking)
|
||||
|
||||
### Step 2: Select the Best Match
|
||||
|
||||
From the resolution results, choose based on:
|
||||
|
||||
- Exact or closest name match to what the user asked for
|
||||
- Higher benchmark scores indicate better documentation quality
|
||||
- If the user mentioned a version (e.g., "React 19"), prefer version-specific IDs
|
||||
|
||||
### Step 3: Fetch the Documentation
|
||||
|
||||
Call `query-docs` with:
|
||||
|
||||
- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)
|
||||
- `query`: The user's specific question, scoped to a single concept
|
||||
|
||||
If the user's question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate `query-docs` call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic.
|
||||
|
||||
### Step 4: Use the Documentation
|
||||
|
||||
Incorporate the fetched documentation into your response:
|
||||
|
||||
- Answer the user's question using current, accurate information
|
||||
- Include relevant code examples from the docs
|
||||
- Cite the library version when relevant
|
||||
|
||||
## Guidelines
|
||||
|
||||
- **Be specific**: Pass the user's full question as the query for better results, but keep each query to a single concept
|
||||
- **One topic per query**: Split multi-topic questions into separate `query-docs` calls — resolve the library ID once, then query per concept, unless the question is about how the concepts interact
|
||||
- **Version awareness**: When users mention versions ("Next.js 15", "React 19"), use version-specific library IDs if available from the resolution step
|
||||
- **Prefer official sources**: When multiple matches exist, prefer official/primary packages over community forks
|
||||
@@ -0,0 +1,78 @@
|
||||
---
|
||||
name: "context7"
|
||||
displayName: "Context7"
|
||||
description: "Find up-to-date documentation, API references, and code examples for libraries, frameworks, SDKs, and developer tools using Context7."
|
||||
keywords: ["context7", "library docs", "framework docs", "sdk docs", "api reference", "code examples", "package docs"]
|
||||
author: "Context7"
|
||||
---
|
||||
|
||||
# Context7
|
||||
|
||||
## Overview
|
||||
|
||||
Context7 is a documentation power for libraries, frameworks, SDKs, APIs, and developer tools. It retrieves up-to-date documentation to ground code generation.
|
||||
|
||||
## When to Use This Power
|
||||
|
||||
Use this Power when the user:
|
||||
|
||||
- Asks setup or configuration questions about a library, framework, SDK, API, CLI tool, or cloud service
|
||||
- Requests code involving a specific library or framework
|
||||
- Needs API references or current documentation
|
||||
- Mentions a framework, SDK, or developer tool by name
|
||||
- Needs help with version migrations, library-specific debugging, or CLI usage
|
||||
|
||||
Do not use this Power for refactoring, writing scripts from scratch, debugging business logic, code review, or general programming concepts.
|
||||
|
||||
## Usage
|
||||
|
||||
### Step 1: Resolve the Library ID
|
||||
|
||||
Call `resolve-library-id` with:
|
||||
|
||||
- `libraryName`: The library name extracted from the user's question
|
||||
- `query`: The user's full question (improves relevance ranking)
|
||||
|
||||
Always start with `resolve-library-id` using the library name and the user's question, unless the user provides an exact library ID in `/org/project` format
|
||||
|
||||
### Step 2: Select the Best Match
|
||||
|
||||
From the resolution results, choose based on:
|
||||
|
||||
- Exact or closest name match to what the user asked for
|
||||
- Higher benchmark scores indicate better documentation quality
|
||||
- If the user mentioned a version (e.g., "React 19"), prefer version-specific IDs
|
||||
- If the results do not look right, try alternate names or rephrase the query
|
||||
|
||||
### Step 3: Fetch the Documentation
|
||||
|
||||
Call `query-docs` with:
|
||||
|
||||
- `libraryId`: The selected Context7 library ID (e.g., /vercel/next.js)
|
||||
- `query`: The user's full, specific question rather than a single word, scoped to a single concept
|
||||
|
||||
If the user's question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate `query-docs` call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic.
|
||||
|
||||
### Step 4: Use the Documentation
|
||||
|
||||
Incorporate the fetched documentation into your response:
|
||||
|
||||
- Answer the user's question using current, accurate information
|
||||
- Include relevant code examples from the docs
|
||||
- Cite the library version when relevant
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Pass the user's full question as the query for better results, but keep each query to a single concept
|
||||
- Keep each query to one topic; split multi-topic questions into separate `query-docs` calls, unless the question is about how the concepts interact
|
||||
- When users mention versions ("Next.js 15", "React 19"), use version-specific library IDs if available from the resolution step
|
||||
- When multiple matches exist, prefer official/primary packages over community forks
|
||||
- Use this Power for API syntax, configuration, setup instructions, version migration, library-specific debugging, and CLI tool usage
|
||||
- Use Context7 even when you think you know the answer — your training data may not reflect recent changes. Prefer this over web search for library docs.
|
||||
- Do not use Context7 for refactoring, writing scripts from scratch, debugging business logic, code review, or general programming concepts.
|
||||
|
||||
## License and Support
|
||||
|
||||
This power integrates with the Context7 MCP Server (MIT License).
|
||||
- [Privacy Policy](https://upstash.com/trust/context7addendum.pdf)
|
||||
- [Support](mailto:context7@upstash.com)
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"url": "https://mcp.context7.com/mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"context7": {
|
||||
"type": "http",
|
||||
"url": "https://mcp.context7.com/mcp",
|
||||
"headers": {
|
||||
"CONTEXT7_API_KEY": "${CONTEXT7_API_KEY:-}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
# Context7 Plugin for GitHub Copilot CLI
|
||||
|
||||
Context7 solves a common problem with AI coding assistants: outdated training data and hallucinated APIs. Instead of relying on stale knowledge, Context7 fetches current documentation directly from source repositories.
|
||||
|
||||
## What's Included
|
||||
|
||||
This plugin provides:
|
||||
|
||||
- **MCP Server** - Connects Copilot CLI to Context7's documentation service
|
||||
- **Skills** - Auto-triggers documentation lookups when you ask about libraries
|
||||
- **Agents** - A dedicated `docs-researcher` agent for focused lookups
|
||||
- **Commands** - `/context7:docs` for manual documentation queries
|
||||
|
||||
## Installation
|
||||
|
||||
Add the marketplace and install the plugin:
|
||||
|
||||
```bash
|
||||
copilot plugin marketplace add upstash/context7
|
||||
copilot plugin install context7@context7-marketplace
|
||||
```
|
||||
|
||||
## API Key (Recommended)
|
||||
|
||||
Without an API key, the plugin connects anonymously and shares the anonymous rate limits. To use your own plan, create an API key in the [Context7 dashboard](https://context7.com/dashboard) and export it as an environment variable before launching Copilot CLI:
|
||||
|
||||
```bash
|
||||
# e.g. in ~/.zshrc or ~/.bashrc
|
||||
export CONTEXT7_API_KEY="your-api-key"
|
||||
```
|
||||
|
||||
The plugin's MCP server configuration picks up `CONTEXT7_API_KEY` automatically. Restart Copilot CLI after setting it, then verify the key is being used by checking your usage in the [dashboard](https://context7.com/dashboard).
|
||||
|
||||
## Available Tools
|
||||
|
||||
### resolve-library-id
|
||||
|
||||
Searches for libraries and returns Context7-compatible identifiers.
|
||||
|
||||
```
|
||||
Input: "next.js"
|
||||
Output: { id: "/vercel/next.js", name: "Next.js", versions: ["v15.1.8", "v14.2.0", ...] }
|
||||
```
|
||||
|
||||
### query-docs
|
||||
|
||||
Fetches documentation for a specific library, ranked by relevance to your question.
|
||||
|
||||
```
|
||||
Input: { libraryId: "/vercel/next.js", query: "app router middleware" }
|
||||
Output: Relevant documentation snippets with code examples
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
The plugin works automatically when you ask about libraries:
|
||||
|
||||
- "How do I set up authentication in Next.js 15?"
|
||||
- "Show me React Server Components examples"
|
||||
- "What's the Prisma syntax for relations?"
|
||||
|
||||
For manual lookups, use the command:
|
||||
|
||||
```
|
||||
/context7:docs next.js app router
|
||||
/context7:docs /vercel/next.js/v15.1.8 middleware
|
||||
```
|
||||
|
||||
Or use the docs-researcher agent when you want to keep your main context clean:
|
||||
|
||||
```bash
|
||||
copilot --agent docs-researcher -p "look up Supabase auth methods"
|
||||
```
|
||||
|
||||
## Version Pinning
|
||||
|
||||
To get documentation for a specific version, include the version in the library ID:
|
||||
|
||||
```
|
||||
/vercel/next.js/v15.1.8
|
||||
/supabase/supabase/v2.45.0
|
||||
```
|
||||
|
||||
The `resolve-library-id` tool returns available versions, so you can pick the one that matches your project.
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: docs-researcher
|
||||
description: Lightweight agent for fetching library documentation without cluttering your main conversation context.
|
||||
---
|
||||
|
||||
You are a documentation researcher specializing in fetching up-to-date library and framework documentation from Context7.
|
||||
|
||||
## Your Task
|
||||
|
||||
When given a question about a library or framework, fetch the relevant documentation and return a concise, actionable answer with code examples.
|
||||
|
||||
## Process
|
||||
|
||||
1. **Identify the library**: Extract the library/framework name from the user's question.
|
||||
|
||||
2. **Resolve the library ID**: Call `resolve-library-id` with:
|
||||
- `libraryName`: The library name (e.g., "react", "next.js", "prisma")
|
||||
- `query`: The user's full question for relevance ranking
|
||||
|
||||
3. **Select the best match**: From the results, pick the library with:
|
||||
- Exact or closest name match
|
||||
- Highest benchmark score
|
||||
- Appropriate version if the user specified one (e.g., "React 19" → look for v19.x)
|
||||
|
||||
4. **Fetch documentation**: Call `query-docs` with:
|
||||
- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)
|
||||
- `query`: The user's specific question for targeted results, scoped to a single concept
|
||||
|
||||
5. **Return a focused answer**: Summarize the relevant documentation with:
|
||||
- Direct answer to the question
|
||||
- Code examples from the docs
|
||||
- Links or references if available
|
||||
|
||||
## Guidelines
|
||||
|
||||
- Pass the user's full question as the query parameter for better relevance, but keep each query to a single concept
|
||||
- If the question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate `query-docs` call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic
|
||||
- When the user mentions a version (e.g., "Next.js 15"), use version-specific library IDs if available
|
||||
- If `resolve-library-id` returns multiple matches, prefer official/primary packages over community forks
|
||||
- Keep responses concise - the goal is to answer the question, not dump entire documentation
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
description: Look up documentation for any library
|
||||
---
|
||||
|
||||
# /context7:docs
|
||||
|
||||
Fetches up-to-date documentation and code examples for a library.
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/context7:docs <library> [query]
|
||||
```
|
||||
|
||||
- **library**: The library name, or a Context7 ID starting with `/`
|
||||
- **query**: What you're looking for (optional but recommended; run the command once per distinct concept, unless asking how they interact)
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
/context7:docs react hooks
|
||||
/context7:docs next.js authentication
|
||||
/context7:docs prisma relations
|
||||
/context7:docs /vercel/next.js/v15.1.8 app router
|
||||
/context7:docs /supabase/supabase row level security
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
1. If the library starts with `/`, it's used directly as the Context7 ID
|
||||
2. Otherwise, `resolve-library-id` finds the best matching library
|
||||
3. `query-docs` fetches documentation relevant to your query
|
||||
4. Results include code examples and explanations
|
||||
|
||||
## Version-Specific Lookups
|
||||
|
||||
Include the version in the library ID for pinned documentation:
|
||||
|
||||
```
|
||||
/context7:docs /vercel/next.js/v15.1.8 middleware
|
||||
/context7:docs /facebook/react/v19.0.0 use hook
|
||||
```
|
||||
|
||||
This is useful when you're working with a specific version and want docs that match exactly.
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "context7",
|
||||
"description": "Upstash Context7 MCP server for up-to-date documentation lookup. Pull version-specific documentation and code examples directly from source repositories into your LLM context.",
|
||||
"version": "1.0.2",
|
||||
"author": {
|
||||
"name": "Upstash"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": ["documentation", "context", "mcp", "library-docs"],
|
||||
"repository": "https://github.com/upstash/context7",
|
||||
"agents": "agents/",
|
||||
"skills": "skills/",
|
||||
"commands": "commands/",
|
||||
"mcpServers": ".mcp.json"
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: context7-mcp
|
||||
description: This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
|
||||
---
|
||||
|
||||
When the user asks about libraries, frameworks, or needs code examples, use Context7 to fetch current documentation instead of relying on training data.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Activate this skill when the user:
|
||||
|
||||
- Asks setup or configuration questions ("How do I configure Next.js middleware?")
|
||||
- Requests code involving libraries ("Write a Prisma query for...")
|
||||
- Needs API references ("What are the Supabase auth methods?")
|
||||
- Mentions specific frameworks (React, Vue, Svelte, Express, Tailwind, etc.)
|
||||
|
||||
## How to Fetch Documentation
|
||||
|
||||
### Step 1: Resolve the Library ID
|
||||
|
||||
Call `resolve-library-id` with:
|
||||
|
||||
- `libraryName`: The library name extracted from the user's question
|
||||
- `query`: The user's full question (improves relevance ranking)
|
||||
|
||||
### Step 2: Select the Best Match
|
||||
|
||||
From the resolution results, choose based on:
|
||||
|
||||
- Exact or closest name match to what the user asked for
|
||||
- Higher benchmark scores indicate better documentation quality
|
||||
- If the user mentioned a version (e.g., "React 19"), prefer version-specific IDs
|
||||
|
||||
### Step 3: Fetch the Documentation
|
||||
|
||||
Call `query-docs` with:
|
||||
|
||||
- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)
|
||||
- `query`: The user's specific question, scoped to a single concept
|
||||
|
||||
If the user's question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate `query-docs` call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic.
|
||||
|
||||
### Step 4: Use the Documentation
|
||||
|
||||
Incorporate the fetched documentation into your response:
|
||||
|
||||
- Answer the user's question using current, accurate information
|
||||
- Include relevant code examples from the docs
|
||||
- Cite the library version when relevant
|
||||
|
||||
## Guidelines
|
||||
|
||||
- **Be specific**: Pass the user's full question as the query for better results, but keep each query to a single concept
|
||||
- **One topic per query**: Split multi-topic questions into separate `query-docs` calls — resolve the library ID once, then query per concept, unless the question is about how the concepts interact
|
||||
- **Version awareness**: When users mention versions ("Next.js 15", "React 19"), use version-specific library IDs if available from the resolution step
|
||||
- **Prefer official sources**: When multiple matches exist, prefer official/primary packages over community forks
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "context7",
|
||||
"version": "1.0.0",
|
||||
"description": "Upstash Context7 MCP server for up-to-date documentation lookup. Pull version-specific documentation and code examples directly from source repositories into your LLM context.",
|
||||
"author": {
|
||||
"name": "Context7",
|
||||
"email": "context7@upstash.com",
|
||||
"url": "https://context7.com"
|
||||
},
|
||||
"keywords": ["documentation", "mcp", "context7", "libraries", "frameworks"],
|
||||
"logo": "https://context7.com/brand/context7-icon-green.svg",
|
||||
"primaryColor": "#059669"
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
# Context7 Plugin for Cursor
|
||||
|
||||
Context7 solves a common problem with AI coding assistants: outdated training data and hallucinated APIs. Instead of relying on stale knowledge, Context7 fetches current documentation directly from source repositories.
|
||||
|
||||
## What's Included
|
||||
|
||||
This plugin provides:
|
||||
|
||||
- **MCP Server** — Connects Cursor to Context7's documentation service
|
||||
- **Rules** — An always-on `use-context7` rule that nudges the agent to fetch docs when unsure about library APIs
|
||||
- **Skills** — A `context7-docs-lookup` skill with detailed instructions on resolving libraries and fetching documentation
|
||||
- **Agents** — A dedicated `docs-researcher` agent for focused lookups
|
||||
|
||||
## Available Tools
|
||||
|
||||
### resolve-library-id
|
||||
|
||||
Searches for libraries and returns Context7-compatible identifiers.
|
||||
|
||||
```
|
||||
Input: "next.js"
|
||||
Output: { id: "/vercel/next.js", name: "Next.js", versions: ["v15.1.8", "v14.2.0", ...] }
|
||||
```
|
||||
|
||||
### query-docs
|
||||
|
||||
Fetches documentation for a specific library, ranked by relevance to your question.
|
||||
|
||||
```
|
||||
Input: { libraryId: "/vercel/next.js", query: "app router middleware" }
|
||||
Output: Relevant documentation snippets with code examples
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
The plugin works automatically when you ask about libraries:
|
||||
|
||||
- "How do I set up authentication in Next.js 15?"
|
||||
- "Show me React Server Components examples"
|
||||
- "What's the Prisma syntax for relations?"
|
||||
|
||||
Or use the docs-researcher agent when you want to keep your main context clean.
|
||||
|
||||
## Version Pinning
|
||||
|
||||
To get documentation for a specific version, include the version in the library ID:
|
||||
|
||||
```
|
||||
/vercel/next.js/v15.1.8
|
||||
/supabase/supabase/v2.45.0
|
||||
```
|
||||
|
||||
The `resolve-library-id` tool returns available versions, so you can pick the one that matches your project.
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: docs-researcher
|
||||
description: Lightweight agent for fetching library documentation without cluttering your main conversation context.
|
||||
---
|
||||
|
||||
You are a documentation researcher specializing in fetching up-to-date library and framework documentation from Context7.
|
||||
|
||||
## Your Task
|
||||
|
||||
When given a question about a library or framework, fetch the relevant documentation and return a concise, actionable answer with code examples.
|
||||
|
||||
## Process
|
||||
|
||||
1. **Identify the library**: Extract the library/framework name from the user's question.
|
||||
|
||||
2. **Resolve the library ID**: Call `resolve-library-id` with:
|
||||
- `libraryName`: The library name (e.g., "react", "next.js", "prisma")
|
||||
- `query`: The user's full question for relevance ranking
|
||||
|
||||
3. **Select the best match**: From the results, pick the library with:
|
||||
- Exact or closest name match
|
||||
- Highest benchmark score
|
||||
- Appropriate version if the user specified one (e.g., "React 19" → look for v19.x)
|
||||
|
||||
4. **Fetch documentation**: Call `query-docs` with:
|
||||
- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)
|
||||
- `query`: The user's specific question for targeted results, scoped to a single concept
|
||||
|
||||
5. **Return a focused answer**: Summarize the relevant documentation with:
|
||||
- Direct answer to the question
|
||||
- Code examples from the docs
|
||||
- Links or references if available
|
||||
|
||||
## Guidelines
|
||||
|
||||
- Pass the user's full question as the query parameter for better relevance, but keep each query to a single concept
|
||||
- If the question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate `query-docs` call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic
|
||||
- When the user mentions a version (e.g., "Next.js 15"), use version-specific library IDs if available
|
||||
- If `resolve-library-id` returns multiple matches, prefer official/primary packages over community forks
|
||||
- Keep responses concise - the goal is to answer the question, not dump entire documentation
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"context7": {
|
||||
"url": "https://mcp.context7.com/mcp/oauth"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
description: Use Context7 MCP to fetch up-to-date documentation when unsure about library APIs, syntax, or behavior instead of guessing from training data.
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
When you're unsure about a library's API, syntax, configuration, or behavior, use Context7 to fetch current documentation rather than guessing from training data that may be outdated.
|
||||
|
||||
Use Context7 when:
|
||||
- You're not confident about the exact API or syntax for a library
|
||||
- The user asks about a specific version (e.g., "Next.js 15", "React 19")
|
||||
- The library or framework has had recent major changes
|
||||
- You need accurate code examples for a specific use case
|
||||
|
||||
You don't need to use Context7 for:
|
||||
- Well-established language features (e.g., JavaScript array methods, Python builtins)
|
||||
- Conversations where the user has already provided the relevant code or docs
|
||||
|
||||
See the `context7-docs-lookup` skill for detailed instructions on how to resolve libraries and fetch documentation.
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: context7-mcp
|
||||
description: This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
|
||||
---
|
||||
|
||||
When the user asks about libraries, frameworks, or needs code examples, use Context7 to fetch current documentation instead of relying on training data.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Activate this skill when the user:
|
||||
|
||||
- Asks setup or configuration questions ("How do I configure Next.js middleware?")
|
||||
- Requests code involving libraries ("Write a Prisma query for...")
|
||||
- Needs API references ("What are the Supabase auth methods?")
|
||||
- Mentions specific frameworks (React, Vue, Svelte, Express, Tailwind, etc.)
|
||||
|
||||
## How to Fetch Documentation
|
||||
|
||||
### Step 1: Resolve the Library ID
|
||||
|
||||
Call `resolve-library-id` with:
|
||||
|
||||
- `libraryName`: The library name extracted from the user's question
|
||||
- `query`: The user's full question (improves relevance ranking)
|
||||
|
||||
### Step 2: Select the Best Match
|
||||
|
||||
From the resolution results, choose based on:
|
||||
|
||||
- Exact or closest name match to what the user asked for
|
||||
- Higher benchmark scores indicate better documentation quality
|
||||
- If the user mentioned a version (e.g., "React 19"), prefer version-specific IDs
|
||||
|
||||
### Step 3: Fetch the Documentation
|
||||
|
||||
Call `query-docs` with:
|
||||
|
||||
- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)
|
||||
- `query`: The user's specific question, scoped to a single concept
|
||||
|
||||
If the user's question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate `query-docs` call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic.
|
||||
|
||||
### Step 4: Use the Documentation
|
||||
|
||||
Incorporate the fetched documentation into your response:
|
||||
|
||||
- Answer the user's question using current, accurate information
|
||||
- Include relevant code examples from the docs
|
||||
- Cite the library version when relevant
|
||||
|
||||
## Guidelines
|
||||
|
||||
- **Be specific**: Pass the user's full question as the query for better results, but keep each query to a single concept
|
||||
- **One topic per query**: Split multi-topic questions into separate `query-docs` calls — resolve the library ID once, then query per concept, unless the question is about how the concepts interact
|
||||
- **Version awareness**: When users mention versions ("Next.js 15", "React 19"), use version-specific library IDs if available from the resolution step
|
||||
- **Prefer official sources**: When multiple matches exist, prefer official/primary packages over community forks
|
||||
Reference in New Issue
Block a user