# Context7 MCP MCP

> Context7 instantly grounds your AI agent in accurate technical documentation. It resolves fuzzy framework names—like 'react' or 'tailwind'—into specific, version-controlled paths, letting your agent pull up-to-date API signatures and working code examples directly into your workflow.

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

## Description

You need your AI client to know the exact API signature for a component you built three years ago. Context7 handles that ambiguity. Instead of relying on generalized knowledge—which often means outdated or hallucinated data—this MCP pulls version-specific documentation from major libraries and frameworks. It first figures out the precise path for any framework, then uses that context to pull raw Markdown chunks detailing specific variables and functional code examples. This process lets your agent talk to living, breathing API docs, so it never gets stuck on an obsolete function name. Because this MCP handles highly sensitive, version-specific codebase details, you know those credentials pass through a zero-trust proxy in Vinkius; they're used only for transit and never sit on disk. You can chain this with other services to build complex automation pipelines that actually work across your entire stack.

## Tools

### query_docs
Retrieves detailed documentation and working code examples for a specific library topic.

### resolve_library
Finds the exact, deterministic path and latest version number for any given framework or library.

## 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

### Determine exact library paths
It resolves general framework names into precise, versioned identifiers needed for deep documentation fetching.

### Query specific API details
You can query documentation on a niche topic and pull raw text chunks detailing the exact usage of a variable or function.

### Extract working code examples
The agent pulls complete, functional code snippets for components or functions directly into your development context.

## Use Cases

### Building a Next.js Feature
A developer needs to know the exact structure for the 'App Router' in Next.js 14. They run `resolve_library` first, get the specific version ID, and then use that ID with `query_docs` to pull detailed Markdown segments showing exactly how to implement the layout.js and page.js structures.

### Integrating a New Component
A rapid prototyper needs to know how to structure a new UI component using Tailwind CSS v4. They use `resolve_library` for the current version, then query documentation via `query_docs` to pull the precise code examples needed to implement it correctly.

### Debugging Legacy Code
A technical writer needs to verify an API signature from a React component that hasn't been touched in years. They use the MCP to find the specific version path and then query documentation, verifying against the source of truth rather than memory.

### Setting up a New Project Stack
An AI engineer is setting up an agent pipeline that requires multiple dependencies. They run `resolve_library` for every framework mentioned to ensure their code generation agent uses the correct, deterministic path for each library.

## Benefits

- Accurate Context: Instead of general knowledge, the agent uses `query_docs` to fetch raw Markdown documentation chunks, guaranteeing you're working with technical truths.
- Version Control: The `resolve_library` tool forces precision, turning vague framework names into specific paths (e.g., /react/18.2.0), eliminating version guesswork entirely.
- Code Snippets: You pull valid code examples straight out of the documentation flow, skipping manual copy-pasting and boilerplate setup.
- Up-to-Date Knowledge: The MCP bypasses standard LLM training cutoffs by pulling data synchronized with the absolute latest library releases.
- Developer Focus: It keeps complex context retrieval inside your IDE or agent workflow, meaning you don't have to switch between documentation sites and code editors.

## How It Works

The bottom line is your AI client stops guessing; it reads the official docs before generating anything.

1. First, ask the MCP to determine the correct library ID and latest version for a framework (like 'nextjs').
2. Next, use that precise identifier to query documentation about a specific topic or feature.
3. The agent receives raw Markdown chunks containing accurate code examples and API references.

## 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.

**How is my Context7 API Key managed when using the `resolve_library` tool?**
Your API Key is handled via a zero-trust proxy, ensuring it's only used in transit. The key never gets stored on any disk during your session with your agent.

**What happens if I provide an ambiguous or misspelled name when calling `resolve_library`?**
The tool is designed to handle ambiguity. If the input is unclear, it returns a list of potential matches and asks you which specific ID (e.g., 'react' vs. 'next') you need to continue.

**Are there rate limits when I use `query_docs` repeatedly in one session?**
While Vinkius handles the underlying infrastructure, standard API usage applies. We recommend batching your documentation queries or utilizing our token optimization features to keep costs and call volumes efficient.

**Does `query_docs` pull only basic function signatures, or can it handle architectural concepts?**
The tool retrieves raw Markdown chunks from the official docs. This means you get detailed explanations of complex topics, not just simple API calls. You'll get deep context.

**If I use an old version ID in `resolve_library`, will `query_docs` still work?**
Yes. Since the tool resolves deterministic paths for specific versions, you can query documentation for any older release as long as that documentation exists in Context7's indexed knowledge base.