--- title: Pi description: Using Context7 with the Pi coding agent --- Context7 integrates with the [Pi coding agent](https://pi.dev) through the official [`@upstash/context7-pi`](https://github.com/upstash/context7/tree/master/packages/pi) extension. Instead of relying on training data, Pi gets current library documentation directly in your coding sessions. The extension is self-contained — it registers Context7's tools natively in Pi, so there's no separate MCP server to run. ## Installation Install the extension with Pi's package command: ```bash pi install npm:@upstash/context7-pi ``` ## Authentication The extension works out of the box at IP-based rate limits — useful for trying it out. For higher quotas and access to private repositories, generate a free key at the [Context7 dashboard](https://context7.com/dashboard) and export it: ```bash export CONTEXT7_API_KEY=ctx7sk_... ``` Set it in your shell profile so Pi picks it up on launch. --- ## What it adds Converts a package or product name to a Context7 library ID (e.g. `Next.js` → `/vercel/next.js`). The agent calls this first. Fetches documentation and code examples for a resolved library ID. Teaches the agent to reach for these tools whenever you ask about a library, framework, SDK, API, CLI tool, or cloud service. Runs the resolve + query flow in one shot for manual lookups. --- ## Using Context7 Once installed, the skill triggers automatically when you ask about libraries — just ask a docs question and the tools are invoked for you: ``` how do I configure caching in Next.js 16? use the Prisma syntax for relations what are the Supabase auth methods? ``` For a manual lookup, use the slash command: ``` /c7-docs ``` For example: ``` /c7-docs next.js Cache Components /c7-docs supabase row level security ``` --- ## Tips - Be specific about what you're trying to do, not just which library - Mention versions when they matter - If the first result isn't right, ask for a different part of the docs ``` # Good How do I handle file uploads with the Supabase Storage API? # Less specific How does Supabase storage work? ```