context7-mcp

context7-mcp is a cursor rule for Cursor from danielvm-git/bigpowers. It costs 37 tokens per session (598 once invoked), scanned A, original, MIT.

Fetch current library docs via Context7 MCP instead of training data. Use when user asks about frameworks, APIs, setup, or code examples for React, Next.js, Prisma, etc.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/danielvm-git/bigpowers/context7-mcp
Clone the repo
git clone --depth 1 https://github.com/danielvm-git/bigpowers

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for context7-mcp

README.md
[![agentmods](https://agentmods.dev/badge/rules/danielvm-git/bigpowers/context7-mcp.svg)](https://agentmods.dev/rules/danielvm-git/bigpowers/context7-mcp)
Your own site
<a href="https://agentmods.dev/rules/danielvm-git/bigpowers/context7-mcp"><img src="https://agentmods.dev/badge/rules/danielvm-git/bigpowers/context7-mcp.svg" alt="Measured on agentmods" height="20"></a>
Per session 37 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 598 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin unknown No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00037 $0.00598
Opus 5 $0.00018 $0.00299
Sonnet 5 $0.00007 $0.00120
Haiku 4.5 $0.00004 $0.00060

Measured today against content hash 1d19c8b2ea45, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

context7-mcp scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/context7-mcp.mdc · 55 lines

How it starts

The opening of the file, as written. The whole thing — 55 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context7 MCP

HARD GATE — Max 3 Context7 tool calls per user question (resolve-library-id + query-docs count toward the cap). On quota/rate-limit errors, emit an explicit CONTEXT7_UNAVAILABLE block — do NOT silently answer from training data.

HARD GATE — Before HTTP fetch, check bash scripts/lib/doc-fetch-cache.sh get "<libraryId>:<query>". Cache hit within TTL → use cached body (no round-trip). On ETag mismatch after conditional refresh, replace cache entry.

When to Use

  • Setup/configuration questions ("How do I configure Next.js middleware?")
  • Code involving libraries ("Write a Prisma query for…")
  • API references ("What are the Supabase auth methods?")
  • User mentions specific frameworks (React, Vue, Svelte, Express, Tailwind, etc.)

Bounded Retry (max 3x)

Attempt Action
1 resolve-library-id → pick best match
2 query-docs with selected libraryId
3 Retry query-docs once with refined query (narrower scope)

After 3 failures, stop and print:

CONTEXT7_UNAVAILABLE
Reason: <quota|rate-limit|no-match|timeout>
Action: Ask user to retry later, paste official docs URL, or run `bts docs <lib>`.
Do NOT substitute training-data answers without labeling them UNVERIFIED.

Fetch Cache (ETag-revalidated)

  1. Cache key: "<libraryId>:<normalized-query>" (lowercase, trimmed).
  2. Read: bash scripts/lib/doc-fetch-cache.sh get "<key>" — exit 0 → use cached body.
  3. Miss / stale: call query-docs; store via doc-fetch-cache.sh put.
  4. TTL: 300s default (DOC_CACHE_TTL). Stale entries refresh on next fetch; honor ETag when MCP returns it.

bts docs <lib> shares the same cache helper when invoked from this skill.

Process

  1. resolve-library-id with libraryName + full user query.
  2. Select match: name similarity, reputation, benchmark score; prefer version-specific IDs when user names a version.
  3. query-docs with libraryId + specific question (one concept per call).
  4. Answer using fetched docs; cite library/version when relevant.

Read the full file on GitHub · 55 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 55 lines · 37 tokens per session scan A 1d19c8b2ea45

Subscribe to this mod's changes

context7-mcp is a cursor rule published in the GitHub repository danielvm-git/bigpowers (163 stars, last pushed 2d ago), licensed MIT. It adds 37 tokens to every session and 598 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.