# Context7 MCP

> Context7 pulls up-to-date, version-specific documentation and code examples for any library or framework directly into your agent's conversation flow. It stops AI agents from hallucinating outdated API calls by grounding them in current technical truths. This MCP finds the exact paths you need before pulling deep docs.

## Overview
- **Category:** friends-mcp
- **Price:** Free
- **Tags:** technical-documentation, vector-storage, ai-context, code-examples, knowledge-retrieval

## Description

You know how often an LLM spits out a piece of code using an old API signature? Or gives documentation for React v17 when your project is on v18? It's a massive time sink.

Context7 fixes that. You connect it to your agent and give it access to live, version-specific knowledge bases. Instead of relying on generalized training data—which gets stale fast—your agent queries the actual documentation for whatever library or framework you're dealing with. This isn't just another search layer; it's a developer-focused RAG engine that resolves fuzzy names into precise paths first, and then pulls raw Markdown chunks and working code examples right where your agent needs them.

It means when your AI client asks how to implement something, you get accurate snippets for the exact version of the library you need. You can connect this specialized context layer through Vinkius, giving your entire development team access to a reliable source of truth without leaving your IDE or slowing down your workflow.

## Tools

### resolve_library
It finds the correct, deep identifiers and the latest stable version number matching any framework or library search query.

### query_docs
This tool fetches specific technical documentation and ready-to-use code examples for a defined library topic.

## Prompt Examples

**Prompt:** 
```
Resolve the library ID for 'nextjs'
```

**Response:** 
```
I've resolved 'nextjs' to the following IDs: 'vercel/next.js/14.1.0' (latest), 'vercel/next.js/13.5.6', and 'vercel/next.js/12.3.4'. Which version would you like to query documentation for?
```

**Prompt:** 
```
Show me how to use 'App Router' in Next.js 14
```

**Response:** 
```
Retrieving documentation for 'App Router' in Next.js 14.1.0... [Agent pulls official Markdown segments detailing layout.js and page.js structure with code examples].
```

**Prompt:** 
```
What are the new features in Tailwind CSS v4?
```

**Response:** 
```
Querying Tailwind CSS v4.0.0 docs... The main updates include the new high-performance engine, native CSS variables support, and simplified configuration. I can provide the exact code examples for these new features.
```

## Capabilities

### Resolve Library Paths
It takes a common framework name (like 'react') and finds the precise, technical path and version number needed for deep documentation retrieval.

### Query Documentation
You ask about a specific feature or API call, and it pulls back raw, up-to-date documentation chunks and code examples related to that topic.

### Ground Agent Context
It prevents your AI client from hallucinating outdated syntax by feeding it real, verified technical truths before generating a response.

### Extract Code Examples
The system pulls ready-to-use code snippets for components or functions directly into the conversation flow.

## Use Cases

### Troubleshooting an API call
A dev hits a wall on a specific data fetching method. They ask their agent, and the agent first runs `resolve_library` to confirm the framework's version number. Then it uses `query_docs` to pull up the official documentation segment detailing that exact method, letting them see the correct syntax instantly.

### Starting a new component
A rapid imprototyper needs a boilerplate for a complex UI element in Tailwind CSS. Instead of searching docs manually, they ask their agent to pull examples. The system uses Context7's tools to extract valid code components directly into the workspace.

### Comparing framework versions
A senior dev needs to know how a utility function changed between Next.js 13 and 14. They prompt the agent, which uses `resolve_library` repeatedly to fetch documentation for two different versions, allowing them to compare API changes side-by-side.

### Building an internal tool
An AI engineer is writing a Python script that interacts with external APIs. By integrating this MCP, their agent can confirm the latest required library signatures and pull verified code snippets for type safety before committing the build.

## Benefits

- Stops outdated code generation. By using the `resolve_library` tool first, your agent pins down the exact library version needed before it looks up docs, guaranteeing accuracy.
- Eliminates manual searching for boilerplate. The MCP pulls valid, ready-to-use code examples and full API documentation straight into the chat, saving you copy-pasting time.
- Deep context retrieval. It goes beyond surface-level answers by retrieving raw Markdown chunks from official sources, giving your agent verifiable technical depth.
- Handles ambiguity instantly. If a developer mentions 'react' but needs v18, `resolve_library` handles the fuzzy matching and gives you deterministic paths needed for deep fetching.
- Works with any client. Whether it’s Cursor or VS Code Copilot, connecting this MCP via Vinkius makes high-fidelity documentation accessible across all your developer tools.

## How It Works

The bottom line is, your agent always knows the specific library version it's talking about before answering anything.

1. You subscribe to this MCP and enter your Context7 API Key in Vinkius.
2. Your AI client sends a request, asking for documentation on a specific framework or library.
3. The agent first uses `resolve_library` to find the exact ID and version (e.g., 'vercel/next.js/14.1.0'), then passes that result to `query_docs` to fetch the required technical data.

## Frequently Asked Questions

**Can my agent find the latest documentation for a specific Tailwind CSS version?**
Yes. First, use the 'resolve_library' tool with 'tailwindcss'. It will return the deterministic ID and version (e.g., 'tailwindcss/3.4.1'). Then, use 'query_docs' to pull the exact Markdown blocks for your specific topic.

**Does Context7 provide code examples for the libraries I search for?**
Absolutely. When you query documentation via the 'query_docs' tool, the agent retrieves not only textual descriptions but also version-specific code examples found in the original library documentation to ensure implementation accuracy.

**How does this help prevent AI hallucinations in coding tasks?**
Standard LLMs have a training data cutoff. Context7 pulls live, version-specific documentation chunks that act as ground-truth context. By grounding your agent in this real-time data, it avoids hallucinating outdated or non-existent API methods.

**What authentication details are required when connecting via Context7?**
You need your unique Context7 API Key. This key grants your agent access to the documentation corpus, so always store it securely in your client's settings following standard credential handling practices.

**If I run the `resolve_library` tool, how does it handle unknown or misspelled framework names?**
The tool will return an explicit error message indicating that no matching library ID was found. This prevents your agent from wasting time on queries for non-existent or incorrect package paths.

**When using the `query_docs` tool, are there limits on the amount of documentation I can retrieve in one query?**
The depth depends entirely on the specific topic you ask about. For extremely large sections of technical docs, it's best practice to break your request into smaller, focused queries for optimal context transfer.

**Does this MCP only work for JavaScript frameworks like React and Next.js?**
No. Context7 supports documentation retrieval across a wide range of libraries and frameworks in various domains, provided the technical information is structured and accessible online.

**What is the required two-step process when I need documentation for a new library?**
First, use `resolve_library` to get the precise ID and version of your target framework. Then, feed that deterministic path into `query_docs`. This ensures your agent gets context tied directly to the exact API version you need.