Context7 MCP
Context7 MCP - あらゆるプロンプトに対応する最新のコードドキュメント
❌ 文脈なし7
LLMは、使用するライブラリに関する古い情報や一般的な情報に依存しています。これにより、以下のメリットが得られます。
❌ コード例は古く、1年前のトレーニングデータに基づいています
❌ 幻覚的なAPIは存在しない
❌ 古いパッケージバージョンに対する一般的な回答
Related MCP server: docs-mcp-server
✅ コンテキスト7付き
Context7 MCP は、最新のバージョン固有のドキュメントとコード例をソースから直接取得し、プロンプトに直接配置します。
カーソルのプロンプトにuse context7を追加します。
Create a basic Next.js project with app router. use context7Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7Context7 は、最新のコード例とドキュメントを LLM のコンテキストに直接取得します。
1️⃣ プロンプトを自然に書く
2️⃣ LLM に
use context7ように指示する3️⃣ 動作するコードの回答を取得する
タブの切り替え、存在しない幻覚的な API、古いコード生成はありません。
🛠️ はじめに
要件
Node.js >= v18.0.0
カーソル、ウィンドサーフ、クロードデスクトップ、またはその他のMCPクライアント
Smithery経由でインストール
Smithery経由で Claude Desktop 用の Context7 MCP Server を自動的にインストールするには:
npx -y @smithery/cli install @upstash/context7-mcp --client claudeカーソルにインストール
Settings -> Cursor Settings -> MCP -> Add new global MCP serverに移動します。
以下の設定をCursorの~/.cursor/mcp.jsonファイルに貼り付けることをお勧めします。プロジェクトフォルダに.cursor/mcp.jsonを作成して、特定のプロジェクトにインストールすることもできます。詳しくはCursor MCPのドキュメントをご覧ください。
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}{
"mcpServers": {
"context7": {
"command": "deno",
"args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"]
}
}
}Windsurfにインストール
Windsurf MCPの設定ファイルに以下を追加してください。詳しくはWindsurf MCPのドキュメントをご覧ください。
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}VS Codeにインストール
VS Code MCP 設定ファイルに以下を追加してください。詳しくはVS Code MCP ドキュメントをご覧ください。
{
"servers": {
"Context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}Zedにインストール
Zed Extensions経由でインストールするか、Zed のsettings.jsonに追加することもできます。詳しくはZed Context Server のドキュメントをご覧ください。
{
"context_servers": {
"Context7": {
"command": {
"path": "npx",
"args": ["-y", "@upstash/context7-mcp"]
},
"settings": {}
}
}
}Claude Codeにインストール
このコマンドを実行してください。詳細については、Claude Code MCP のドキュメントを参照してください。
claude mcp add context7 -- npx -y @upstash/context7-mcpClaude Desktopにインストール
Claude Desktopのclaude_desktop_config.jsonファイルに以下を追加してください。詳細はClaude Desktop MCPのドキュメントをご覧ください。
{
"mcpServers": {
"Context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}BoltAIにインストール
アプリの「設定」ページを開き、「プラグイン」に移動して、次の JSON を入力します。
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}保存したら、チャットにget-library-docsと入力し、続けてContext7のドキュメントID(例: get-library-docs /nuxt/ui )を入力してください。BoltAIのドキュメントサイトで詳細情報をご覧いただけます。iOS版BoltAIについては、こちらのガイド をご覧ください。
Dockerの使用
MCP サーバーを Docker コンテナで実行する場合:
Docker イメージをビルドします。
まず、プロジェクト ルート (または任意の場所) に
Dockerfileを作成します。FROM node:18-alpine WORKDIR /app # Install the latest version globally RUN npm install -g @upstash/context7-mcp # Expose default port if needed (optional, depends on MCP client interaction) # EXPOSE 3000 # Default command to run the server CMD ["context7-mcp"]次に、タグ(例:
context7-mcp)を使用してイメージをビルドします。Docker Desktop(またはDockerデーモン)が実行中であることを確認してください。DockerfileDockerfile保存したディレクトリで、以下のコマンドを実行してください。docker build -t context7-mcp .MCP クライアントを構成します。
Docker コマンドを使用するように MCP クライアントの構成を更新します。
cline_mcp_settings.json の例:
{ "mcpServers": { "Сontext7": { "autoApprove": [], "disabled": false, "timeout": 60, "command": "docker", "args": ["run", "-i", "--rm", "context7-mcp"], "transportType": "stdio" } } }注: これは設定例です。このREADMEの前半に記載されているMCPクライアント(Cursor、VS Codeなど)の具体的な例を参考に、構成を調整してください(例:
mcpServersとservers)。また、argsのイメージ名がdocker buildコマンドで使用したタグと一致していることを確認してください。
Windowsにインストールする
Windowsでの設定は、LinuxやmacOS(例ではClineを使用しています)と若干異なります。他のエディタでも同様の設定が可能です。 commandとargsの設定を参照してください。
{
"mcpServers": {
"github.com/upstash/context7-mcp": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@upstash/context7-mcp"
],
"disabled": false,
"autoApprove": []
}
}
}環境変数
DEFAULT_MINIMUM_TOKENS: ドキュメント取得の最小トークン数を設定します (デフォルト: 10000)。
例:
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"],
"env": {
"DEFAULT_MINIMUM_TOKENS": "10000"
}
}
}
}利用可能なツール
resolve-library-id: 一般的なライブラリ名を Context7 互換のライブラリ ID に解決します。libraryName(必須)
get-library-docs: Context7 互換のライブラリ ID を使用してライブラリのドキュメントを取得します。context7CompatibleLibraryID(必須)topic(オプション): ドキュメントを特定のトピック(例:「ルーティング」、「フック」)に焦点を当てますtokens(オプション、デフォルトは10000):返されるトークンの最大数。設定されたDEFAULT_MINIMUM_TOKENS値またはデフォルト値の10000より小さい値は、自動的にその値まで増加されます。
発達
プロジェクトを複製し、依存関係をインストールします。
bun i建てる:
bun run buildローカル構成の例
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
}
}
}MCP Inspectorによるテスト
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcpトラブルシューティング
ERR_モジュールが見つかりません
このエラーが表示された場合には、 npxの代わりにbunxを使用してみてください。
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}これにより、特にnpxパッケージを適切にインストールまたは解決しない環境では、モジュール解決の問題が解決されることがよくあります。
ESM解決問題
次のようなエラーが発生した場合: Error: Cannot find module 'uriTemplate.js' --experimental-vm-modulesフラグを付けて実行してみてください:
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"--node-options=--experimental-vm-modules",
"@upstash/context7-mcp"
]
}
}
}TLS/証明書の問題
TLS 関連の問題を回避するには、 npxで--experimental-fetchフラグを使用します。
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"--node-options=--experimental-fetch",
"@upstash/context7-mcp"
]
}
}
}MCP クライアント エラー
パッケージ名に
@latestを追加してみてください。代わりに
bunxを使用してみてください。代わりに
denoを使用してみてください。npxによるネイティブ フェッチ サポートを利用するには、Node v18 以上を使用していることを確認してください。
免責事項
Context7プロジェクトはコミュニティの貢献によって成り立っており、高品質を維持するよう努めておりますが、すべてのライブラリドキュメントの正確性、完全性、セキュリティを保証することはできません。Context7に掲載されているプロジェクトは、Context7ではなく、それぞれの所有者によって開発および保守されています。疑わしい、不適切、または潜在的に有害なコンテンツに遭遇した場合は、プロジェクトページの「報告」ボタンを使用して直ちにご連絡ください。私たちはすべての報告を真摯に受け止め、プラットフォームの完全性と安全性を維持するために、フラグが付けられたコンテンツを速やかに確認いたします。Context7をご利用いただくことで、お客様はご自身の判断と責任においてご利用いただくことに同意するものとします。
私たちとつながる
最新情報を入手し、コミュニティに参加してください:
📢 最新ニュースやアップデートについては、 Xをフォローしてください
🌐ウェブサイトをご覧ください
💬 Discordコミュニティに参加する(該当する場合)
コンテキスト7 メディア
AICodeKing: 「Context7 + Cline & RooCode: この MCP サーバーにより、CLINE の効率が 100 倍向上します!」
Sean Kochel: 「Vibe Coding の成功のための 5 つの MCP サーバー (プラグインするだけで使用可能)」
スターの歴史
ライセンス
マサチューセッツ工科大学
Available Tools
2 toolsquery-docsQuery DocumentationARead-onlyInspect
Retrieves and queries up-to-date documentation and code examples from Context7 for any programming library or framework.
You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool, UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.
IMPORTANT: Do not call this tool more than 3 times per question. If you cannot find what you need after 3 calls, use the best information you have.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The question or task you need help with. Be specific and include relevant details. Good: 'How to set up authentication with JWT in Express.js' or 'React useEffect cleanup function examples'. Bad: 'auth' or 'hooks'. IMPORTANT: Do not include any sensitive or confidential information such as API keys, passwords, credentials, or personal data in your query. | |
| libraryId | Yes | Exact Context7-compatible library ID (e.g., '/mongodb/docs', '/vercel/next.js', '/supabase/supabase', '/vercel/next.js/v14.3.0-canary.87') retrieved from 'resolve-library-id' or directly from user query in the format '/org/project' or '/org/project/version'. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Adds behavioral context beyond the readOnlyHint annotation: the 3-call limit, prerequisite step, and warning against sensitive data. No contradiction with annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three short paragraphs each serving a distinct purpose: purpose, prerequisite, limitation. Front-loaded with the core action, no redundant information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers prerequisite, usage limit, and parameter guidance. Lacks explicit description of output format, but since the tool retrieves documentation and code examples, the output type is reasonably inferable.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema provides 100% coverage with detailed descriptions for both parameters. The tool description reinforces the relationship between libraryId and resolve-library-id but adds little semantic meaning beyond what's already in the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it retrieves and queries documentation and code examples from Context7 for any library, distinguishing it from the sibling 'resolve-library-id' tool which is for obtaining library IDs.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly instructs to use 'resolve-library-id' first unless user provides library ID, and imposes a 3-call limit per question, providing clear guidance on when and how many times to use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
resolve-library-idResolve Context7 Library IDARead-onlyInspect
Resolves a package/product name to a Context7-compatible library ID and returns matching libraries.
You MUST call this function before 'query-docs' to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.
Selection Process:
Analyze the query to understand what library/package the user is looking for
Return the most relevant match based on:
Name similarity to the query (exact matches prioritized)
Description relevance to the query's intent
Documentation coverage (prioritize libraries with higher Code Snippet counts)
Source reputation (consider libraries with High or Medium reputation more authoritative)
Benchmark Score: Quality indicator (100 is the highest score)
Response Format:
Return the selected library ID in a clearly marked section
Provide a brief explanation for why this library was chosen
If multiple good matches exist, acknowledge this but proceed with the most relevant one
If no good matches exist, clearly state this and suggest query refinements
For ambiguous queries, request clarification before proceeding with a best-guess match.
IMPORTANT: Do not call this tool more than 3 times per question. If you cannot find what you need after 3 calls, use the best result you have.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The user's original question or task. This is used to rank library results by relevance to what the user is trying to accomplish. IMPORTANT: Do not include any sensitive or confidential information such as API keys, passwords, credentials, or personal data in your query. | |
| libraryName | Yes | Library name to search for and retrieve a Context7-compatible library ID. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations indicate readOnlyHint=true, which is consistent with the tool's purpose. The description adds important behavioral details beyond annotations, such as a 3-call limit per question, handling of ambiguous queries, and a warning not to include sensitive information in the 'query' parameter.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections, but it is somewhat lengthy. It front-loads the essential purpose and usage note, but the selection process details could be more succinct. Still, it remains clear and organized.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given there is no output schema, the description adequately explains the response format. It covers edge cases like multiple matches, no matches, and ambiguous queries, providing complete guidance for the agent to handle various scenarios.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds value by explaining the role of each parameter: 'libraryName' is the name to search for, and 'query' is the user's original question used for ranking. It also includes a critical warning about sensitive data in 'query', which enhances understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states that the tool resolves a package/product name to a Context7-compatible library ID. It distinguishes itself from the sibling tool 'query-docs' by noting it must be called first, and includes specific details about selection criteria and response format.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly specifies when to call this tool: before 'query-docs' unless the user provides a library ID in a specific format. It also provides a detailed selection process and response format, guiding the agent on how to use the tool correctly.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
2 tool updates
v1.0.8- Added
query-docs - Added
resolve-library-id
2 tool updates
v1.0.6- Removed
query-docs - Removed
resolve-library-id
3 tool updates
v1.0.1- Removed
get-library-docs - Added
query-docs - Changed
resolve-library-id2 fields changed- added
Input schema / properties / queryAdded value: +{ + "description": "The user's original question or task. This is used to rank library results by relevance to what the user is trying to accomplish. IMPORTANT: Do not include any sensitive or confidential information such as API keys, passwords, credentials, or personal data in your query.", + "type": "string" +} - changed
Input schema / requiredPrevious value: -[ - "libraryName" -]New value: +[ + "query", + "libraryName" +]
2 tool updates
v1.0.0- First observed
get-library-docs - First observed
resolve-library-id
TDQS
Each tool has a distinct and complementary purpose: one resolves library names to IDs, the other queries documentation using that ID. There is no overlap.
Both tools follow the same verb_noun pattern with snake_case: 'resolve-library-id' and 'query-docs'. Consistent and predictable.
With only two tools, the surface is minimal but still covers the core workflow for querying documentation. It is slightly thin but appropriate for a focused server.
The two tools form a complete workflow: resolve then query. No obvious gaps for the stated purpose, though additional tools like list_libraries could enhance completeness.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.
A Model Context Protocol server for Wix AI tools
The AWS Knowledge MCP server is a fully managed remote Model Context Protocol server that provides real-time access to official AWS content in an LLM-compatible format. It offers structured access to AWS documentation, code samples, blog posts, What's New announcements, Well-Architected best practices, and regional availability information for AWS APIs and CloudFormation resources. Key capabilities include searching and reading documentation in markdown format, getting content recommendations, listing AWS regions, and checking regional availability for services and features.
Related MCP Servers
- FlicenseBqualityDmaintenanceAn MCP server that fetches real-time documentation for popular libraries like Langchain, Llama-Index, MCP, and OpenAI, allowing LLMs to access updated library information beyond their knowledge cut-off dates.13-
- AlicenseNot gradedqualityAmaintenanceA Model Context Protocol (MCP) server that scrapes, indexes, and searches documentation for third-party software libraries and packages, supporting versioning and hybrid search.3,2621,711MIT
- AlicenseNot gradedqualityDmaintenanceA server that provides organized documentation content for various applications using the Model Context Protocol, enabling AI assistants to access quickstart guides and code examples.MIT
- AlicenseCqualityCmaintenanceA Model Context Protocol server that enables intelligent searching across documentation for 30+ programming libraries and frameworks, fetching relevant information from official sources.238MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/upstash/context7'
If you have feedback or need assistance with the MCP directory API, please join our Discord server