# Context7 — Live Library Docs for LLMs, 51K Stars > MCP server fetching up-to-date, version-specific library documentation into LLM context. Eliminates hallucinated APIs across 30+ AI coding tools. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use Run the automated setup: ```bash npx ctx7 setup ``` Or add to your `.mcp.json` manually: ```json { "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp" } } } ``` Restart your AI tool and ask: "Using context7, look up the Next.js 14 App Router docs." --- ## Intro Context7 is an MCP server that fetches live, version-specific library documentation directly into your LLM's context window, with 51,700+ GitHub stars. It eliminates hallucinated or outdated APIs by pulling real-time docs from library sources. Works with 30+ coding clients including Claude Code, Cursor, GitHub Copilot, and Windsurf. Best for: developers tired of AI hallucinating outdated API methods. Works with: Claude Code, Cursor, Copilot, Windsurf, 30+ tools. Setup time: under 1 minute. --- ## Context7 — Real-Time Docs for AI ### The Problem LLMs frequently hallucinate API methods or reference outdated library versions. This leads to broken code and debugging time wasted on non-existent functions. ### The Solution Context7 fetches current documentation from the actual library source and injects it into your AI's context window, ensuring every code suggestion uses real, up-to-date APIs. ### Two Operation Modes 1. **CLI + Skills** — Use `ctx7` commands directly 2. **MCP Server** — Native integration into your coding agent ### MCP Tools | Tool | Description | |------|-------------| | `resolve-library-id` | Match library names to Context7 identifiers | | `query-docs` | Fetch relevant documentation using a library ID | ### CLI Commands ```bash # Find a library ctx7 library nextjs "app router" # Get specific docs ctx7 docs nextjs-14 "server components" ``` ### Key Benefits - **Version-specific**: Request docs for Next.js 14, React 19, etc. - **Real-time**: Always fetches current documentation - **Token-efficient**: Only retrieves relevant sections, not entire docs - **30+ integrations**: Works with practically any AI coding tool ### FAQ **Q: What is Context7?** A: Context7 is an MCP server that injects up-to-date, version-specific library documentation into AI coding tools, preventing hallucinated API suggestions. **Q: Is Context7 free?** A: Yes, Context7 is open source under the MIT license. **Q: How do I add Context7 to Claude Code?** A: Run `npx ctx7 setup` or add `{"url": "https://mcp.context7.com/mcp"}` to your `.mcp.json` under mcpServers. --- ## Source & Thanks > Created by [Upstash](https://github.com/upstash). Licensed under MIT. > > [context7](https://github.com/upstash/context7) — ⭐ 51,700+ Thank you for solving the hallucinated API problem. --- ## 快速使用 运行自动设置: ```bash npx ctx7 setup ``` 或手动添加到 `.mcp.json`: ```json { "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp" } } } ``` --- ## 简介 Context7 是一个 MCP 服务器,可以将实时的、版本特定的库文档直接注入 LLM 的上下文窗口,拥有 51,700+ GitHub stars。它从库源头拉取真实文档,消除 AI 编码工具中的 API 幻觉问题。支持 Claude Code、Cursor、Copilot 等 30+ 编码工具。 --- ## Context7 — AI 的实时文档 ### 问题 LLM 经常幻觉出不存在的 API 方法或引用过时的库版本。 ### 解决方案 Context7 从实际的库源头获取当前文档,并注入到 AI 的上下文窗口中,确保每个代码建议都使用真实、最新的 API。 --- ## 来源与感谢 > Created by [Upstash](https://github.com/upstash). Licensed under MIT. > > [context7](https://github.com/upstash/context7) — ⭐ 51,700+ --- Source: https://tokrepo.com/en/workflows/d95ee526-658a-4dc4-8f33-d0b6395f7f5c Author: TokRepo精选