@mario-gc/pi-context7
v0.2.0
Published
Context7 integration for pi coding agent — fetch up-to-date library documentation and code examples
Maintainers
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-context7Global install (GitHub):
pi install git:github.com/mario-gc/pi-context7Project install (adds to .pi/settings.json):
pi install -l npm:@mario-gc/pi-context7
pi install -l git:github.com/mario-gc/pi-context7Local development:
pi -e ./extensions/context7.tsUsage
This package provides two tools for the agent:
- context7_search_library — Search Context7 for libraries by name. Resolves a library name to a Context7 library ID.
- 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-hereAuth 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.tsCache TTL override: Set CONTEXT7_CACHE_TTL in minutes:
CONTEXT7_CACHE_TTL=60 pi -e ./extensions/context7.tsLicense
MIT
