@mario-gc/pi-context7

Context7 integration for pi coding agent — fetch up-to-date library documentation and code examples

Packages

Package details

extensionskill

Install @mario-gc/pi-context7 from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@mario-gc/pi-context7
Package
@mario-gc/pi-context7
Version
0.1.1
Published
May 5, 2026
Downloads
99/mo · 8/wk
Author
mario-gc
License
MIT
Types
extension, skill
Size
45 KB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/context7.ts"
  ],
  "skills": [
    "./skills"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@mario-gc/pi-context7

Context7 integration for pi coding agent. Fetch up-to-date library documentation and code examples directly from Context7.

Installation

Global install (npm):

pi install npm:@mario-gc/pi-context7

Global install (GitHub):

pi install git:github.com/mario-gc/pi-context7

Project install (adds to .pi/settings.json):

pi install -l npm:@mario-gc/pi-context7
pi install -l git:github.com/mario-gc/pi-context7

Local development:

pi -e ./extensions/context7.ts

Usage

This package provides two tools for the agent:

  1. context7_search_library — Search Context7 for libraries by name. Resolves a library name to a Context7 library ID.
  2. context7_get_context — Get up-to-date documentation context and code examples for a library from Context7.

Workflow: search for a library → get documentation context for code examples and API reference.

Skill

A companion skill (context7) is also available. Use /skill:context7 to load it.

API Key Setup

Context7 uses an API key for authenticated access (higher rate limits). Unauthenticated requests work but have stricter rate limits.

Environment variable:

export CONTEXT7_API_KEY=ctx7sk-your-api-key-here

Auth file (~/.pi/agent/auth.json):

{
  "context7": {
    "apiKey": "ctx7sk-your-api-key-here"
  }
}

Generate an API key at https://context7.com/dashboard.

Cache

Responses are cached locally for performance and offline resilience.

Cache location: ~/.pi/agent/cache/context7/

  • Search results cached for 7 days
  • Documentation context cached for 3 days

Offline mode: Set PI_OFFLINE=1 to use cached results only:

PI_OFFLINE=1 pi -e ./extensions/context7.ts

Cache TTL override: Set CONTEXT7_CACHE_TTL in minutes:

CONTEXT7_CACHE_TTL=60 pi -e ./extensions/context7.ts

License

MIT