renCosta2025-context7fork について
Context7 MCPは、コーディングアシスタントに最新かつバージョン別のライブラリドキュメントとコード例を提供します。プロンプトに `use context7` と記述すると、ソースに基づく情報を取得してLLMのコンテキストに加えます。
主な機能
- 01最新のライブラリドキュメント取得
- 02バージョン別コード例の提供
- 03LLMコンテキストへの参照追加
- 04ローカル実行とリモート接続
活用シーン
- 01特定バージョン向けコードの生成
- 02機能実装中のAPI確認
- 03古いドキュメントへの依存軽減
MCP 対応
MCPサーバーは、Cursor、Claude Code、VS CodeなどのMCPクライアントにドキュメントとコード例を提供します。ローカルstdio接続とリモートHTTP接続に対応します。
設定
リモートサーバーはインストール不要です。クライアントを選んで設定をコピーするか、ワンクリックで導入できます。
https://server.smithery.ai/@renCosta2025/context7fork/mcpclaude mcp add --transport http ai-smithery-rencosta2025-context7fork https://server.smithery.ai/@renCosta2025/context7fork/mcp{"mcpServers":{"ai-smithery-rencosta2025-context7fork":{"type":"http","url":"https://server.smithery.ai/@renCosta2025/context7fork/mcp"}}}Cursor で開く{"servers":{"ai-smithery-rencosta2025-context7fork":{"type":"http","url":"https://server.smithery.ai/@renCosta2025/context7fork/mcp"}}}VS Code で開く{"mcpServers":{"ai-smithery-rencosta2025-context7fork":{"type":"http","url":"https://server.smithery.ai/@renCosta2025/context7fork/mcp"}}}{"mcpServers":{"ai-smithery-rencosta2025-context7fork":{"serverUrl":"https://server.smithery.ai/@renCosta2025/context7fork/mcp"}}}コマンドはターミナルで実行し、JSON は各クライアントの MCP 設定に貼り付けて再起動します。認可が必要なサーバーは初回接続時にログインを求めます。
https://server.smithery.ai/@renCosta2025/context7fork/mcp認証が必要ツール
詳細

Context7 MCP - あらゆるプロンプトに最新のコードドキュメントを
❌ Context7 を使わない場合
LLM は、使用しているライブラリについて古い情報や一般的な情報に頼ります。その結果、次のような問題が起こります。
- ❌ コード例が古く、何年も前のトレーニングデータに基づいている
- ❌ 実在しない API を幻覚する
- ❌ 古いパッケージバージョン向けの一般的な回答になる
✅ Context7 を使う場合
Context7 MCP は、最新かつバージョン固有のドキュメントとコード例をソースから直接取得し、プロンプトに挿入します。
Cursor のプロンプトに use context7 を追加します。
Create a Next.js middleware that checks for a valid JWT in cookies and redirects unauthenticated users to `/login`. use context7
Configure a Cloudflare Worker script to cache JSON API responses for five minutes. use context7
Context7 は、最新のコード例とドキュメントを LLM のコンテキストに直接取り込みます。
- 1️⃣ プロンプトを自然な言葉で書きます
- 2️⃣ LLM に
use context7を使うよう伝えます - 3️⃣ 動作するコードの回答を得ます
タブを切り替える必要も、実在しない API の幻覚も、古いコード生成もありません。
📚 プロジェクトの追加
お気に入りのライブラリを Context7 に追加(または更新)する方法については、プロジェクト追加ガイドをご覧ください。
🛠️ インストール
要件
- Node.js >= v18.0.0
- Cursor、Claude Code、VSCode、Windsurf、またはその他の MCP クライアント
- Context7 API Key(レート制限の引き上げを希望する場合は任意)(context7.com/dashboardでアカウントを作成して取得してください)
警告
SSE プロトコルの廃止に関するお知らせ
Server-Sent Events(SSE)トランスポートプロトコルは廃止予定であり、今後のリリースでエンドポイントが削除されます。代わりに HTTP または stdio トランスポート方式を使用してください。
Smithery 経由でインストール
Smithery を介して、任意のクライアントに Context7 MCP Server を自動インストールするには:
npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY>
Smithery キーは、Smithery.ai のウェブページで確認できます。
Cursor にインストール
Settings -> Cursor Settings -> MCP -> Add new global MCP server に移動します。
次の設定を Cursor の ~/.cursor/mcp.json ファイルに貼り付ける方法を推奨します。プロジェクトフォルダーに .cursor/mcp.json を作成して、特定のプロジェクトにインストールすることもできます。詳細は Cursor MCP のドキュメントを参照してください。
Cursor 1.0 以降では、下のインストールボタンをクリックすると、ワンクリックですぐにインストールできます。
Cursor リモートサーバー接続
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "YOUR_API_KEY"
}
}
}
}
Cursor ローカルサーバー接続
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Claude Code にインストール
このコマンドを実行します。詳細は Claude Code MCP のドキュメントを参照してください。
Claude Code リモートサーバー接続
claude mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: YOUR_API_KEY"
Claude Code ローカルサーバー接続
claude mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY
Windsurf にインストール
これを Windsurf MCP 設定ファイルに追加します。詳細は Windsurf MCP のドキュメントを参照してください。
Windsurf リモートサーバー接続
{
"mcpServers": {
"context7": {
"serverUrl": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "YOUR_API_KEY"
}
}
}
}
Windsurf ローカルサーバー接続
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
VS Code にインストール
これを VS Code MCP 設定ファイルに追加します。詳細は VS Code MCP のドキュメントを参照してください。
VS Code リモートサーバー接続
"mcp": {
"servers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "YOUR_API_KEY"
}
}
}
}
VS Code ローカルサーバー接続
"mcp": {
"servers": {
"context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Cline にインストール
以下の手順に従うと、Cline MCP Server Marketplace から Context7 を簡単にインストールできます。
- Cline を開きます。
- ハンバーガーメニューアイコン(☰)をクリックして、MCP Servers セクションに移動します。
- Marketplace タブの検索バーで Context7 を検索します。
- Install ボタンをクリックします。
または、MCP サーバーの設定を直接編集することもできます。
- Cline を開きます。
- ハンバーガーメニューアイコン(☰)をクリックして、MCP Servers セクションに移動します。
- Remote Servers タブを選択します。
- Edit Configuration ボタンをクリックします。
mcpServersに context7 を追加します。
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp",
"type": "streamableHttp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Zed にインストール
Zed Extensions からインストールするか、Zed の settings.json に以下を追加できます。詳しくは、Zed Context Server docs をご覧ください。
{
"context_servers": {
"Context7": {
"command": {
"path": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
},
"settings": {}
}
}
}
Augment Code にインストール
Augment Code で Context7 MCP を設定するには、グラフィカルインターフェイスまたは手動設定を使用できます。
A. Augment Code UI を使用する
-
ハンバーガーメニューをクリックします。
-
Settings を選択します。
-
Tools セクションに移動します。
-
+ Add MCP ボタンをクリックします。
-
以下のコマンドを入力します。
npx -y @upstash/context7-mcp@latest -
MCP の名前を Context7 にします。
-
Add ボタンをクリックします。
MCP サーバーを追加すると、Augment Code 内で Context7 の最新のコードドキュメント機能を直接利用できるようになります。
B. 手動設定
- Cmd/Ctrl Shift P を押すか、Augment パネルのハンバーガーメニューを開きます。
- Edit Settings を選択します。
- Advanced の下にある Edit in settings.json をクリックします。
augment.advancedオブジェクトのmcpServers配列にサーバー設定を追加します。
"augment.advanced": {
"mcpServers": [
{
"name": "context7",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
]
}
MCP サーバーを追加したら、エディターを再起動してください。エラーが発生した場合は、閉じ括弧やカンマが不足していないか、構文を確認してください。
Roo Code にインストール
これを Roo Code の MCP 設定ファイルに追加します。詳しくは、Roo Code MCP docs をご覧ください。
Roo Code リモートサーバー接続
{
"mcpServers": {
"context7": {
"type": "streamable-http",
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "YOUR_API_KEY"
}
}
}
}
Roo Code ローカルサーバー接続
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Gemini CLI にインストール
詳しくは、Gemini CLI Configuration をご覧ください。
- Gemini CLI の設定ファイルを開きます。場所は
~/.gemini/settings.jsonです(~はホームディレクトリを表します)。 settings.jsonファイル内のmcpServersオブジェクトに、以下を追加します。
{
"mcpServers": {
"context7": {
"httpUrl": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "YOUR_API_KEY",
"Accept": "application/json, text/event-stream"
}
}
}
}
または、ローカルサーバーの場合:
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
mcpServers オブジェクトが存在しない場合は、作成してください。
Claude Desktop にインストール
リモートサーバー接続
Claude Desktop を開き、Settings > Connectors > Add Custom Connector に移動します。名前に Context7、リモート MCP サーバーの URL に https://mcp.context7.com/mcp を入力します。
ローカルサーバー接続
Claude Desktop の開発者設定を開き、claude_desktop_config.json ファイルを編集して以下の設定を追加します。詳しくは、Claude Desktop MCP docs をご覧ください。
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Opencode にインストール
これを Opencode の設定ファイルに追加します。詳しくは、Opencode MCP docs をご覧ください。
Opencode リモートサーバー接続
"mcp": {
"context7": {
"type": "remote",
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "YOUR_API_KEY"
},
"enabled": true
}
}
Opencode ローカルサーバー接続
{
"mcp": {
"context7": {
"type": "local",
"command": ["npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
"enabled": true
}
}
}
OpenAI Codex にインストール
詳しくはOpenAI Codexをご覧ください。
OpenAI Codex の MCP サーバー設定に、次の設定を追加します。
[mcp_servers.context7]
args = ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
command = "npx"
⚠️ Windows に関する注意
Windows では、デフォルト設定でリクエストがタイムアウトするエラーが発生する場合があります。 その場合は、Node.js とインストール済みパッケージへのフルパスを指定して、MCP サーバーを明示的に設定してください。
[mcp_servers.context7]
command = "C:\\Program Files\\nodejs\\node.exe"
args = [
"C:\\Users\\yourname\\AppData\\Roaming\\npm\\node_modules\\@upstash\\context7-mcp\\dist\\index.js",
"--transport",
"stdio",
"--api-key",
"YOUR_API_KEY"
]
または、次の設定を使用できます。
[mcp_servers.context7]
command = "cmd"
args = [
"/c",
"npx",
"-y",
"@upstash/context7-mcp",
"--api-key",
"YOUR_API_KEY"
]
env = { SystemRoot="C:\\Windows" }
startup_timeout_ms = 20_000
これにより、Codex CLI が Windows で安定して動作します。
JetBrains AI Assistant にインストール
詳しくはJetBrains AI Assistant のドキュメントをご覧ください。
- JetBrains IDE で、
Settings->Tools->AI Assistant->Model Context Protocol (MCP)に移動します + Addをクリックします。- ダイアログの左上にある
Commandをクリックし、一覧から As JSON オプションを選択します - この設定を追加し、
OKをクリックします
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Applyをクリックして変更を保存します。- 同様に、
Settings->Tools->Junie->MCP Settingsで、JetBrains Junie に context7 を追加できます
Kiro にインストール
詳しくはKiro Model Context Protocol のドキュメントをご覧ください。
Kiro>MCP Serversに移動します+ Addボタンをクリックして、新しい MCP サーバーを追加します。- 以下の設定を貼り付けます。
{
"mcpServers": {
"Context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}
Saveをクリックして変更を適用します。
Trae にインストール
「手動で追加」機能を使用し、その MCP サーバーの JSON 設定情報を入力します。 詳しくはTrae のドキュメントをご覧ください。
Trae リモートサーバー接続
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}
Trae ローカルサーバー接続
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Bun または Deno を使用
これらの代替手段を使うと、別のランタイムでローカル Context7 MCP サーバーを実行できます。これらの例は、コマンドと引数を指定してローカル MCP サーバーを起動できるすべてのクライアントで使用できます。
Bun
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Deno
{
"mcpServers": {
"context7": {
"command": "deno",
"args": [
"run",
"--allow-env=NO_DEPRECATION,TRACE_DEPRECATION",
"--allow-net",
"npm:@upstash/context7-mcp"
]
}
}
}
Docker を使用する
MCP サーバーを Docker コンテナで実行する場合は、次の手順に従ってください。
-
Docker イメージをビルドする:
まず、プロジェクトのルート(または任意の場所)に
Dockerfileを作成します。クリックして 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 デーモン)が起動していることを確認してください。Dockerfileを保存したディレクトリで、次のコマンドを実行します。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" } } }注:これは設定例です。構造(例:
mcpServersとservers)を調整するには、この README の前半にある、お使いの MCP クライアント(Cursor、VS Code など)に対応する具体的な例を参照してください。また、argsのイメージ名がdocker buildコマンドで使用したタグと一致していることを確認してください。
デスクトップ拡張機能を使用してインストールする
mcpb フォルダー内の context7.mcpb ファイルをインストールし、クライアントに追加します。詳しくは、MCP バンドルのドキュメントをご覧ください。
Windows にインストールする
Windows での設定は Linux や macOS とは少し異なります(この例では Cline を使用しています)。他のエディターでも基本的な考え方は同じです。command と args の設定を参照してください。
{
"mcpServers": {
"github.com/upstash/context7-mcp": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
"disabled": false,
"autoApprove": []
}
}
}
Amazon Q Developer CLI にインストールする
Amazon Q Developer CLI の設定ファイルに次の内容を追加します。詳しくは、Amazon Q Developer CLI のドキュメントをご覧ください。
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Warp にインストールする
詳しくは、Warp Model Context Protocol のドキュメントをご覧ください。
Settings>AI>Manage MCP serversに移動します。+ Addボタンをクリックして、新しい MCP サーバーを追加します。- 以下の設定を貼り付けます。
{
"Context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
"env": {},
"working_directory": null,
"start_on_launch": true
}
}
Saveをクリックして変更を適用します。
Copilot Coding Agent にインストールする
Copilot Coding Agent で Context7 を使用する
Copilot Coding Agent の設定ファイルの mcp セクション(Repository->Settings->Copilot->Coding agent->MCP configuration)に、次の設定を追加します。
{
"mcpServers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "YOUR_API_KEY"
},
"tools": ["get-library-docs", "resolve-library-id"]
}
}
}
詳しくは、GitHub の公式ドキュメントをご覧ください。
LM Studio にインストールする
詳しくは、LM Studio の MCP サポートをご覧ください。
ワンクリックでインストール:
手動でのセットアップ:
Program(右側)>Install>Edit mcp.jsonに移動します。- 以下の設定を貼り付けます。
{
"mcpServers": {
"Context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Saveをクリックして変更を適用します。- 右側の
Programの下で MCP サーバーのオン/オフを切り替えるか、チャットボックスの下部にあるプラグアイコンをクリックします。
Visual Studio 2022 にインストール
Visual Studio MCP サーバーのドキュメントに従って、Visual Studio 2022 で Context7 MCP を設定できます。
以下を Visual Studio の MCP 設定ファイルに追加します(詳細はVisual Studio のドキュメントを参照してください)。
{
"inputs": [],
"servers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "YOUR_API_KEY"
}
}
}
}
または、ローカルサーバーの場合:
{
"mcp": {
"servers": {
"context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
}
詳細およびトラブルシューティングについては、Visual Studio MCP サーバーのドキュメントを参照してください。
Crush にインストール
以下を Crush の設定ファイルに追加します。詳細はCrush MCP のドキュメントを参照してください。
Crush のリモートサーバー接続(HTTP)
{
"$schema": "https://charm.land/crush.json",
"mcp": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "YOUR_API_KEY"
}
}
}
}
Crush のローカルサーバー接続
{
"$schema": "https://charm.land/crush.json",
"mcp": {
"context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
BoltAI にインストール
アプリの「Settings」ページを開き、「Plugins」に移動して、以下の JSON を入力します。
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
保存したら、チャットで get-library-docs に続けて Context7 のドキュメント ID(例:get-library-docs /nuxt/ui)を入力します。詳しくはBoltAI のドキュメントサイトをご覧ください。iOS 版 BoltAI については、こちらのガイドをご覧ください。
Rovo Dev CLI にインストール
以下のコマンドを実行して、Rovo Dev CLI の MCP 設定を編集します。
acli rovodev mcp
設定例:
リモートサーバー接続
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}
ローカルサーバー接続
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Zencoder にインストール
Zencoder で Context7 MCP を設定するには、以下の手順に従います。
- Zencoder メニュー(...)に移動します
- ドロップダウンメニューから Agent tools を選択します
- Add custom MCP をクリックします
- 以下の名前とサーバー設定を追加し、Install ボタンをクリックします
{
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
MCP サーバーを追加すると、そのまま簡単に使い続けることができます。
Qodo Gen にインストール
詳しくはQodo Gen のドキュメントを参照してください。
- VSCode または IntelliJ で Qodo Gen のチャットパネルを開きます。
- Connect more tools をクリックします。
-
- Add new MCP をクリックします。
- 以下の設定を追加します。
Qodo Gen のローカルサーバー接続
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Qodo Gen のリモートサーバー接続
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}
Perplexity Desktop にインストール
詳しくはPerplexity のローカルおよびリモート MCPを参照してください。
Perplexity>Settingsに移動しますConnectorsを選択します。Add Connectorをクリックします。Advancedを選択します。- サーバー名に
Context7を入力します - 以下の JSON をテキストエリアに貼り付けます。
{
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
"command": "npx",
"env": {}
}
Saveをクリックします。
Context7 MCP は、LLM が使用できる以下のツールを提供します。
-
resolve-library-id:一般的なライブラリ名を Context7 互換のライブラリ ID に解決します。libraryName(必須):検索するライブラリの名前
-
get-library-docs:Context7 互換のライブラリ ID を使用して、ライブラリのドキュメントを取得します。context7CompatibleLibraryID(必須):正確な Context7 互換のライブラリ ID(例:/mongodb/docs、/vercel/next.js)topic(任意):ドキュメントの対象を特定のトピックに絞り込みます(例:「routing」、「hooks」)tokens(任意、デフォルト 5000):返すトークンの最大数です。1000 未満の値は自動的に 1000 に引き上げられます。
🛟 ヒント
ルールを追加する
すべてのプロンプトに use context7 を追加したくない場合は、MCP クライアントのルールセクションで簡単なルールを定義できます。
- Windsurf の場合は、
.windsurfrulesファイルに記述します - Cursor の場合は、
Cursor Settings > Rulesセクションから設定します - Claude Code の場合は、
CLAUDE.mdファイルに記述します
または、MCP クライアントで同等の設定を行うと、コードに関する質問で Context7 を自動的に呼び出せます。
ルールの例
Always use context7 when I need code generation, setup or configuration steps, or
library/API documentation. This means you should automatically use the Context7 MCP
tools to resolve library id and get library docs without me having to explicitly ask.
これ以降は、追加で入力しなくても、関連する会話で Context7 のドキュメントを参照できます。用途に合わせてルールを変更できます。
ライブラリ ID を使用する
使用するライブラリがすでに正確にわかっている場合は、Context7 の ID をプロンプトに追加します。そうすると、Context7 MCP サーバーはライブラリの照合手順を省略し、ドキュメントの取得を直接開始できます。
Implement basic authentication with Supabase. use library /supabase/supabase for API and docs.
スラッシュ構文を使うと、ドキュメントを読み込むライブラリを MCP ツールに正確に指定できます。
HTTPS プロキシ
HTTP プロキシを使用している場合、Context7 は標準の https_proxy / HTTPS_PROXY 環境変数を使用します。
💻 開発
プロジェクトをクローンし、依存関係をインストールします。
bun i
ビルドします。
bun run build
サーバーを実行します。
bun run dist/index.js
CLI 引数
context7-mcp は、以下の CLI フラグを受け付けます。
--transport <stdio|http>– 使用するトランスポートです(デフォルトはstdio)。HTTP トランスポートでは、HTTP エンドポイントと SSE エンドポイントの両方が自動的に提供されます。--port <number>–httpトランスポート使用時にリッスンするポートです(デフォルトは3000)。--api-key <key>– 認証用の API キーです。context7.com/dashboard でアカウントを作成すると、API キーを取得できます。
HTTP トランスポートとポート 8080 を使用する例:
bun run dist/index.js --transport http --port 8080
stdio トランスポートを使用する別の例:
bun run dist/index.js --transport stdio --api-key YOUR_API_KEY
ローカル設定の例
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["tsx", "/path/to/folder/context7/src/index.ts", "--api-key", "YOUR_API_KEY"]
}
}
}
MCP Inspector を使用したテスト
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp
🚨 トラブルシューティング
モジュールが見つからないエラー
ERR_MODULE_NOT_FOUND が発生した場合は、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/[email protected]"]
}
}
}
TLS/証明書に関する問題
TLS 関連の問題を回避するには、--experimental-fetch フラグを使用してください。
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]
}
}
}
一般的な MCP クライアントのエラー
- パッケージ名に
@latestを追加してみてください npxの代わりにbunxを使用してください- 別の方法として
denoの使用を検討してください - ネイティブの fetch をサポートする Node.js v18 以降を使用していることを確認してください
Context7 のプロジェクトはコミュニティによって投稿されています。高い品質を維持できるよう努めていますが、すべてのライブラリドキュメントの正確性、完全性、安全性を保証することはできません。Context7 に掲載されているプロジェクトは、Context7 ではなく、それぞれの所有者が開発・保守しています。不審、不適切、または潜在的に有害なコンテンツを見つけた場合は、プロジェクトページの「Report」ボタンから、すぐにお知らせください。プラットフォームの健全性と安全性を維持するため、すべての報告を真摯に受け止め、報告されたコンテンツを速やかに確認します。Context7 を利用することで、ご自身の判断と責任において利用することに同意したものとみなされます。
🤝 交流しましょう
最新情報を確認し、コミュニティに参加しましょう。
- 📢 最新ニュースや更新情報は、X をフォローしてください
- 🌐 ウェブサイトをご覧ください
- 💬 Discord コミュニティに参加してください
📺 メディアでの Context7
- Better Stack:「無料ツールで Cursor が 10 倍賢くなる」
- Cole Medin:「AI コーディングアシスタント向け、間違いなく最高の MCP サーバー」
- Income Stream Surfers:「Context7 + SequentialThinking MCP:これは AGI なのか?」
- Julian Goldie SEO:「Context7:新しい MCP AI エージェントのアップデート」
- JeredBlu:「Context 7 MCP:ドキュメントをすぐに入手 + VS Code のセットアップ」
- Income Stream Surfers:「Context7:AI コーディングを変える新しい MCP サーバー」
- AICodeKing:「Context7 + Cline & RooCode:この MCP サーバーで CLINE の効果が 100 倍に!」
- Sean Kochel:「バイブコーディングを楽しむための 5 つの MCP サーバー(つなぐだけですぐ使えます)」
⭐ スター履歴
📄 ライセンス
MIT
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。