💻

Context7

Featured

Pull current library docs into coding prompts before the model invents old APIs.

Category: Developer
Difficulty: Easy
Rank: #1

Quick Configuration

Choose the setup that matches your environment.

Before You Start

  • Confirm you have the account, endpoint, or API key required for Context7.
  • Start with minimum scopes and read-only access where possible.
  • Keep secrets in environment variables instead of hardcoding them in JSON.
Last verified: 2026-05-25
Environment: Context7 remote MCP or @upstash/context7-mcp over stdio
Install command: npx -y @upstash/context7-mcp@latest

Local config

JSON
Local config json
{
  "context7": {
    "command": "npx",
    "args": ["-y", "@upstash/context7-mcp@latest"],
    "env": {
      "CONTEXT7_API_KEY": "${CONTEXT7_API_KEY}"
    }
  }
}

Verify prompt

Use Context7 to find the current Next.js middleware docs and summarize the auth redirect example.

Expected success output

You should see version-aware documentation snippets instead of generic framework advice.

Common Pitfalls & Fixes

  • ⚠️ Watch out: API drift, stale framework examples, and version-specific documentation.
  • 🔑 Always store API keys in environment variables, never hardcode them in JSON.
  • 🛡️ Start with read-only scopes if available to verify connection safely.

Security checklist

  • Use Context7 for documentation lookup; do not treat docs snippets as executable authority without testing.
  • Keep CONTEXT7_API_KEY in environment variables or remote MCP headers, not committed config.

Common errors

Error Cause Fix
request timed out The local npx server is slow to start or blocked by the host timeout. Increase MCP startup timeout, pin @latest, or use the hosted Context7 MCP URL when your host supports remote MCP.
rate limited The free unauthenticated quota is exhausted. Create a Context7 API key and inject it as CONTEXT7_API_KEY.
wrong library The initial library name resolved to the wrong package or docs source. Ask Context7 to resolve the library ID first, then query the exact ID.

Example Prompts

Once connected, try these prompts to test capabilities:

  • Use Context7 to get the latest Astro routing docs and explain the correct dynamic route pattern.
  • Find the current Supabase auth API for email/password sign-up and show a minimal TypeScript example.
  • Before editing, check the current Tailwind CSS container query docs and summarize the relevant classes.

Verification Checklist

  • Run 1-2 real prompts to confirm Context7 returns usable data.
  • Check that error messages are clear enough for troubleshooting.
  • Document the required scopes, dependencies, and env vars for future reuse.