> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/upstash/context7/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Up-to-date library documentation for AI coding assistants

<img className="block dark:hidden" src="https://github.com/upstash/context7/blob/master/public/cover.png?raw=true" alt="Context7 Hero" />

<img className="hidden dark:block" src="https://github.com/upstash/context7/blob/master/public/cover.png?raw=true" alt="Context7 Hero" />

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

Context7 provides an MCP server and SDK for accessing up-to-date, version-specific documentation and code examples for any programming library or framework. Stop getting outdated code from AI assistants - Context7 pulls fresh documentation directly into your LLM's context.

## The Problem

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

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

## The Solution

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 (or set up a rule to auto-invoke):

```txt theme={null}
Create a Next.js middleware that checks for a valid JWT in cookies
and redirects unauthenticated users to `/login`. use context7
```

```txt theme={null}
Configure a Cloudflare Worker script to cache
JSON API responses for five minutes. use context7
```

Context7 fetches up-to-date code examples and documentation right into your LLM's context. No tab-switching, no hallucinated APIs that don't exist, no outdated code generation.

## Key Features

<CardGroup cols={2}>
  <Card title="MCP Server Integration" icon="plug" href="/quickstart">
    Connect Context7 to Cursor, Claude Code, OpenCode, and 30+ other AI coding assistants
  </Card>

  <Card title="TypeScript SDK" icon="code" href="/installation#sdk">
    Programmatic access to Context7's documentation API with full TypeScript support
  </Card>

  <Card title="CLI Tools" icon="terminal" href="/installation#cli">
    Quick setup with ctx7 CLI for authentication and MCP configuration
  </Card>

  <Card title="AI SDK Tools" icon="brain" href="/installation#ai-sdk-tools">
    Pre-built tools for Vercel AI SDK with automatic library resolution
  </Card>
</CardGroup>

## Available Tools

Context7 MCP provides two main tools that LLMs can use:

### resolve-library-id

Resolves a general library name into a Context7-compatible library ID.

* `query` - The user's question or task (used to rank results by relevance)
* `libraryName` - The name of the library to search for

Returns matching libraries with:

* Library ID in format `/org/project`
* Name and description
* Code snippets count
* Source reputation (High, Medium, Low, Unknown)
* Benchmark score (quality indicator, max 100)
* Available versions

### query-docs

Retrieves documentation for a library using a Context7-compatible library ID.

* `libraryId` - Exact Context7-compatible library ID (e.g., `/mongodb/docs`, `/vercel/next.js`)
* `query` - The question or task to get relevant documentation for

Returns up-to-date documentation and code examples specific to your query.

## Use Cases

* **AI Coding Assistants**: Cursor, Claude Code, OpenCode, and more
* **Custom AI Agents**: Build agents with access to current library docs
* **Documentation Automation**: Fetch fresh docs programmatically
* **Code Generation**: Generate code with accurate, version-specific APIs

## Next Steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Get Context7 running in your AI coding assistant in under 5 minutes
  </Card>

  <Card title="Installation Guide" icon="download" href="/installation">
    Detailed installation instructions for all components
  </Card>
</CardGroup>
