MCP ExplorerExplorer

Context7 MCP

@upstashon 10 days ago
11690 MIT
HostedFreeCommunity
Knowledge Base
#documentation#LLM#MCP#prompt context#up-to-date docs#code examples#Cursor#Claude#VSCode#Windsurf
LLMs rely on outdated or generic information about the libraries you use. You get:

Overview

What is Context7 MCP

Context7 MCP is a protocol that provides up-to-date, version-specific documentation and code examples for various libraries directly into prompts used by language models (LLMs). It ensures that users get accurate, relevant, and current coding information without relying on outdated data or hallucinated APIs.

Use cases

Context7 MCP can be used in various scenarios including generating up-to-date code snippets for specific library functions, troubleshooting issues with current imports, and learning about new features in a library. It is especially beneficial for developers who want immediate, reliable documentation without the need to switch tabs or search externally.

How to use

To utilize Context7 MCP, simply include ‘use context7’ in your prompt when using compatible LLM clients. For example, a prompt might read, ‘Create a basic Next.js project with app router. use context7’. This triggers the protocol to fetch relevant documentation and examples and integrate them into the language model’s responses.

Key features

Key features of Context7 MCP include real-time fetching of library documentation, integration with various MCP clients like Cursor and Visual Studio Code, and resolving library names to specific Context7-compatible IDs. It eliminates outdated code examples and enhances the coding experience for developers by providing precise and timely information.

Where to use

Context7 MCP can be integrated into various coding environments and editors such as Cursor, Visual Studio Code, Windsurf, Augment Code, and more. It is useful for developers working with modern web frameworks or libraries who need quick access to current resources and documentation while coding.

Content

Context7 MCP - Up-to-date Code Docs For Any Prompt

❌ Without Context7

LLMs rely on outdated or generic information about the libraries you use. You get:

  • ❌ Code examples are outdated and based on year-old training data
  • ❌ Hallucinated APIs don't even exist
  • ❌ Generic answers for old package versions

✅ With Context7

Context7 MCP pulls up-to-date, version-specific documentation and code examples straight from the source — and places them directly into your prompt.

Add use context7 to your prompt in Cursor:

Create a basic Next.js project with app router. use context7
Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7

Context7 fetches up-to-date code examples and documentation right into your LLM's context.

  • 1️⃣ Write your prompt naturally
  • 2️⃣ Tell the LLM to use context7
  • 3️⃣ Get working code answers

No tab-switching, no hallucinated APIs that don't exist, no outdated code generations.

Adding Projects

Check out our project addition guide to learn how to add (or update) your favorite libraries to Context7.

Installation

Local

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp"
      ]
    }
  }
}

Remote

{
  "mcpServers": {
    "fetch": {
      "type": "streamable-http",
      "url": "https://router.mcpso.cc/mcp/context7"
    }
  }
}

Tools

resolve-library-id
Required first step: Resolves a general package name into a Context7-compatible library ID. Must be called before using 'get-library-docs' to retrieve a valid Context7-compatible library ID.
get-library-docs
Fetches up-to-date documentation for a library. You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool.

Comments