All guides

FRESHYou commented this keyword

Context7

Stops Claude from using outdated or made-up APIs by pulling current, version-specific library docs into the conversation.

Before you start:
  • Node.js 18 or newer
  • Claude Code or another coding agent
Setup
2 min
Level
Beginner
Stars
62.7k
License
MIT
Context7 screenshot

What it does

AI models are trained on old data, so they often write code for old versions of a library or invent functions that do not exist. Context7 fetches the current documentation and code examples for the library you are using and puts them straight into Claude's context.

It works two ways: as a skill that tells Claude to use the ctx7 command-line tool, or as an MCP server (a connector that gives Claude new tools). The setup command lets you pick.

Install it

  1. Make sure Node.js 18 or newer is installed.
  2. Run the setup command below in your terminal. Add --claude to target Claude Code directly.
  3. Sign in when your browser opens. Setup generates an API key and installs the right skill for you.
  4. Choose CLI + Skills or MCP mode when asked.

Copy this

Terminal
npx ctx7 setup --claude

Use it

  1. Add "use context7" to the end of a coding request.
  2. If you know the library, name its Context7 ID to skip the lookup, for example: use library /supabase/supabase for API and docs.
  3. Mention a version (for example Next.js 14) and Context7 matches docs for that version.
  4. Optional: add the rule below to your CLAUDE.md so Claude uses Context7 without being asked.

Rule for CLAUDE.md

Prompt
Always use Context7 when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask.

Good to know

A free API key from context7.com/dashboard gives you higher rate limits. To undo the setup later, run npx ctx7 remove.

To connect manually, use the server URL https://mcp.context7.com/mcp and pass your key as an Authorization: Bearer YOUR_API_KEY header. Library docs are community-contributed, so Context7 cannot guarantee every entry is accurate.

Links

Want the next one first?

One new guide a week, straight to your inbox.

More like this