Seth Rose

Context7 MCP

AI 智能体v1.0.3
作者:Seth Rose更新于 2026-05-11共 4 个版本 · 最新版本发布于 2026-01-21context7@clawhub_thesethrose/context7
上下文管理工具调用#Documentation

据 AlphaMoat 统计,截至 2026-10,Context7 MCP 累计下载 14,900 次、获 18 个星标,按累计下载量在本次参与排名的 10,914 个 AI 技能中排名第 1,872 位,在「AI 智能体」分类(1,632 个)中排名第 262 位。

列表默认按累计下载量排序,也可按星标排序;详情页排名按累计下载量计算。

累计下载
1.5万
星标
18
全站下载量排名
#1,872
全站前 18% · 「AI 智能体」前 17%
平台累计下载星标评论
ClawHub ↗1.2万183
SkillHub ↗1.5万18—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

技能通过 Context7 的 MCP 服务按库名检索文档,返回库标识、可信度评分与相关片段,供后续按库查资料。使用前需要把示例环境文件复制成 .env 并填入 API 密钥。 可信度评分不代表官方准确性保证;应对照该库的当前文档核实检索片段。

资料发布于 2026-10-27

可以用来做什么

  • 查某个前端框架的当前版本文档
  • 核对一个库的推荐用法与接口说明

什么时候用

  • 不确定某库当前 API 怎么写时
  • 需要带来源评分的文档片段而不是搜索摘要时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

帮我查这个框架最新的路由配置文档,给出库标识和可信度
这个库的鉴权该怎么写,按文档片段整理一份示例

月度数据趋势

累计下载1.5万
6,9061.1万1.5万2026-03 · 累计下载 7,4982026-05 · 累计下载 9,2812026-06 · 累计下载 9,6932026-07 · 累计下载 1.0万2026-08 · 累计下载 1.1万2026-09 · 累计下载 1.2万2026-10 · 累计下载 1.5万26-0326-0926-10
星标18
1517182026-03 · 星标 152026-05 · 星标 182026-06 · 星标 182026-07 · 星标 182026-08 · 星标 182026-09 · 星标 182026-10 · 星标 1826-0326-0926-10

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。 该技能有同名的其他版本,调整前的数据归属当前下载量最大的这一个。

月份累计下载环比星标
2026-101.5万—18
2026-091.2万—18
2026-081.1万+2.4%18
2026-071.0万+7.8%18
2026-069,693+4.4%18
2026-059,281—18
2026-037,498—15

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

4.6 KB · ClawHub v1.0.3
---
name: context7
description: Context7 MCP - Intelligent documentation search and context for any library
metadata:
  version: 1.0.3
  tags: ["documentation", "search", "context", "mcp", "llm"]
  clawdbot:
    requires:
      bins: ["node"]
      npm: true
展开全部(共 174 行)
    install:
      - id: "skill-install"
        kind: "skill"
        source: "clawdhub"
        slug: "context7"
        label: "Install Context7 skill"
---

# Context7 MCP

Context7 provides intelligent documentation search and context for any library, powered by LLMs.

## Setup

1. Copy `.env.example` to `.env` and add your Context7 API key:
   ```bash
   cp .env.example .env
   ```

   Add your API key to `.env`:
   ```
   CONTEXT7_API_KEY=your-api-key-here
   ```

   Get your key from [context7.com/dashboard](https://context7.com/dashboard)

2. Install dependencies:
   ```bash
   npm install
   ```

## Usage

Context7 provides two main commands:

### Search Command

Search for libraries by name with intelligent LLM-powered ranking:

```bash
npx tsx query.ts search <library_name> <query>

# Examples:
npx tsx query.ts search "nextjs" "setup ssr"
npx tsx query.ts search "react" "useEffect cleanup"
npx tsx query.ts search "better-auth" "authentication flow"
```

This calls the Context7 Search API:
```
GET https://context7.com/api/v2/libs/search?libraryName=<name>&query=<query>
```

**Response includes:**
- id: Library ID (e.g., `/vercel/next.js`)
- name: Display name
- trustScore: Source reputation (0-100)
- benchmarkScore: Quality indicator (0-100)
- versions: Available version tags

### Context Command

Retrieve intelligent, LLM-reranked documentation context:

```bash
npx tsx query.ts context <owner/repo> <query>

# Examples:
npx tsx query.ts context "vercel/next.js" "setup ssr"
npx tsx query.ts context "facebook/react" "useState hook"
```

This calls the Context7 Context API:
```
GET https://context7.com/api/v2/context?libraryId=<repo>&query=<query>&type=txt
```

**Response includes:**
- title: Documentation section title
- content: Documentation text/snippet
- source: URL to source page

### Quick Reference

```bash
# Search for documentation
npx tsx query.ts search "library-name" "your search query"

# Get context from a specific repo
npx tsx query.ts context "owner/repo" "your question"
```

## Best Practices

Get the most out of the Context7 API with these best practices:

### Optimize Search Relevance

When using the `/libs/search` endpoint, always include the user's original question in the query parameter. This allows the API to use LLM-powered ranking to find the most relevant library for the specific task, rather than relying on a simple name match.

**Example:** If a user asks about SSR in Next.js, search with:
- `libraryName=nextjs`
- `query=setup+ssr`

This ensures the best ranking for the specific task.

### Use Specific Library IDs

For the fastest and most accurate results with the `/context` endpoint, provide the full libraryId (e.g., `/vercel/next.js`). If you already know the library the user is asking about, skipping the search step and calling the context endpoint directly reduces latency.

### Leverage Versioning

To ensure documentation accuracy for older or specific project requirements, include the version in the libraryId using the `/owner/repo/version` format. You can find available version tags in the response from the search endpoint.

### Choose the Right Response Type

Tailor the `/context` response to your needs using the `type` parameter:
- Use `type=json` when you need to programmatically handle titles, content snippets, and source URLs (ideal for UI display).
- Use `type=txt` when you want to pipe the documentation directly into an LLM prompt as plain text.

### Filter by Quality Scores

When programmatically selecting a library from search results, use the `trustScore` and `benchmarkScore` to prioritize high-quality, reputable documentation sources for your users.

### Find Navigation Pages

Find navigation and other pages in this documentation by fetching the `llms.txt` file at:
```
https://context7.com/docs/llms.txt
```

## API Reference

### Context7 REST API

**Search Endpoint:**
```
GET https://context7.com/api/v2/libs/search
  ?libraryName=<library_name>
  &query=<user_query>
```

**Context Endpoint:**
```
GET https://context7.com/api/v2/context
  ?libraryId=<owner/repo>
  &query=<user_query>
  &type=txt|json
```

## Troubleshooting

**No results found?**
- Check your API key is valid
- Verify the library name is correct (e.g., 'react' not 'React')

**Authentication errors?**
- Ensure CONTEXT7_API_KEY is set in `.env`
- Check your key hasn't expired at context7.com/dashboard

## License

MIT

「AI 智能体」分类下的热门技能

Seth Rose 的其他技能

数据月份:2026-10 · 下载/星标数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。