nodecode-context7
Current, version-specific library documentation from Context7 (upstash/context7): resolve a library name to its Context7 id, then read the snippets that answer a question, pinned to the version the project uses. Written for Nodecode from Context7's documented REST API.
Get it
Tell the agent "add the context7 cell", or run nodecode add nc://context7.
Set it up
Nothing is required: Context7 answers without a key. For a higher rate limit, put a free key from the Context7 dashboard in Nodecode's environment as CONTEXT7_API_KEY. See config.example.jsonc:
| Key | Default | What it does |
|---|---|---|
base_url |
"https://context7.com" |
Where Context7's API answers: https://, or http:// on this machine. |
api_key_env |
"CONTEXT7_API_KEY" |
The environment variable holding an optional key. |
api_key |
none | A key written here instead; the environment variable wins. |
timeout |
30 |
One API call's ceiling, in seconds. |
max_chars |
20000 |
How many characters of docs one context7_docs answer carries (at least 500). |
max_results |
10 |
How many libraries one context7_resolve answer lists. |
Use it
| Tool | Context7 API | For |
|---|---|---|
context7_resolve |
GET /api/v2/libs/search |
A library name, and optionally the task, to the matching ids, best first, with snippet count, stars, trust and benchmark scores, and indexed versions. |
context7_docs |
GET /api/v2/context |
One id (/vercel/next.js), a question, and optionally a version, to the snippets that answer it with their sources. |
3 libraries match "next.js"; pass an id to context7_docs:
/vercel/next.js - Next.js: Next.js is a React framework ... (8316 snippets, 131745 stars, trust 9.7, benchmark 78.55)
versions: v14.3.0-canary.87, v13.5.11, v15.4.0-canary.82, v12.3.7, v11.1.3, v16.0.3, v15.1.11, v16.1.6 and 12 more
/websites/nextjs - Next.js: ... (9524 snippets, trust 10, benchmark 72.2)
versions: 15
A library id must start with / and hold only letters, digits and . _ - @ / +; a version is a tag like v15.1.8. Anything else is refused before a request is made. Docs longer than max_chars are cut, and the answer says so.
/context7 checks the connection and says whether a key rides it.
The key
- The key is optional. When set it rides only the
Authorization: Bearerheader, never a URL, and only overhttps://or to this machine. - Every answer and every refusal has the key scrubbed out, so an error that echoes it cannot carry it into the conversation.
- A rejected key (401) names the environment variable to fix; a rate limit (429) says that a key raises it, or to wait when one is already set.
Test
.github/test-cell.sh tools/nodecode-context7
The tests run offline: nlk:http is stubbed to answer by URL, so each tool's request and parameters, the key's header and its scrubbing, the refusals, and the answer format are asserted with no network.
License
MIT. See LICENSE. Context7 is Upstash's service; its MCP server is MIT and is not included.