Context7 MCP and the context missing from your own code
Part of the Claude Code guide. Start with Claude Code Doesn't Understand Your Codebase? How to Fix It
Take this example: you ask an agent to add a signed-in user's display name to a page. It gets the current library API from Context7, writes the call correctly, handles the response, and adds a formatter beside the component. Except, in this hypothetical repo, there's already a formatter shared by the account pages. The new code has its own fallback for a missing name.
The library call is right. There's still a duplicate helper to fix. I'd keep Context7 in that workflow. I'd also want the agent to check what the application already does before inventing another version, because knowing how to call a dependency, even with the right docs open, leaves that question unanswered.
For this post, context engineering means deciding which facts reach the model for this task, where those facts come from, and how fresh they are.
What Context7 MCP answers
Context7 supplies current, version-specific library documentation and examples. For the example above, I'd ask it about the library API first, name the version in the question, and check the answer against the dependency the project actually uses. The package's newest release might be different from the version in your application.
Here's a library question:
Use Context7 to check the createClient signature in supabase-js v2.
And here's the repository question that follows it:
Before adding a formatter for the signed-in user's display name,
find any existing helper in this repo and identify its callers.
I'm asking for different evidence. The first answer should be grounded in documentation for that package version, the second needs facts about this application, and I want the agent to make that handoff explicitly, before it starts editing.
In MCP mode, Context7 exposes two tools, described in the MCP client documentation. resolve-library-id locates the library. query-docs retrieves its documentation, and if you already know the library ID, you can skip the matching step, going straight to that query.
Getting the library answer right is useful on its own. The problem in our example appears after that answer, when the agent decides where the new behavior belongs, which existing code it should reuse, and what needs inspection before changing it. I'd make that a separate step in the task.
A current map of the code you wrote
I build Pharaoh. It's a hosted MCP server that maps a repository's functions and files into a graph, including modules, dependencies, endpoints and cron jobs. The agent can ask about that structure over MCP.
For our display-name example, I'd have the agent look for an existing helper, inspect the relationships around a candidate, then open its implementation, rather than decide from the function name alone. A similarly named helper might format something else. I'd need to read that code.
search_functions and get_blast_radius are two of Pharaoh's tools. I'd use the helper search before creating another function, and ask for the impact of changing a shared one, with its callers in view, before agreeing to change its behavior.
In our hypothetical app, changing the fallback to suit the new page could change the account pages too, so I'd want to inspect the callers, before deciding whether to reuse the function unchanged or make a separate one.
Pharaoh maps TypeScript, JavaScript, Python, C and C++. Its live repository map is refreshed after pushes to the default branch, through the GitHub App's push webhook, and covers that branch, rather than the branch you're currently editing or your uncommitted changes.
Local work in progress is outside that map. If you've just added the helper locally, the hosted map won't describe that edit, so the agent needs to read the checkout too, check what changed, and keep that difference in mind when interpreting a search result.
Context7 can also hold internal documentation
Context7's private sources documentation covers internal docs on Pro and Enterprise plans, with sources including GitHub, GitLab, Bitbucket, other Git providers, Confluence and OpenAPI. For a repository with little documentation, its Generate docs option can produce documentation from source code. The documented refresh workflow is manual: click the source's refresh icon to reparse it.
So the distinction I care about is the question you're asking. Internal docs can explain how your team intends authentication to work, what a helper is for, or why an API was designed a certain way, depending on what those docs contain. A repository graph gives the agent mapped relationships to query when it needs to find a caller.
For internal documentation, I'd also check when the source was last refreshed.
For the formatter example, a page describing naming conventions might help the agent understand the desired fallback, but I'd still ask it to locate the actual function, inspect who uses it, and compare the implementation with the proposed change. Documentation and source can disagree.
Where Repomix and Gitingest fit
Repomix lets you select files or directories to pack. It also has code compression that removes implementation detail, with an MCP server available for packaging repositories with partial retrieval, while Gitingest turns a repository URL or directory into a text digest, which gives me another way to carry source into a chat when I'd like a one-off review of files I've selected for that task.
Reading a pack still leaves the model to trace calls through the included code, and a saved pack reflects the moment it was generated, so I'd record its revision, along with which files it includes. Selecting a helper's directory doesn't tell me whether I've included its callers elsewhere.
I've covered the tradeoffs in the repository-context comparison. Here, I'd check the library docs, query the mapped repo for relevant relationships, then inspect the source before an edit, providing a selected pack if that's how I want to bring the source into the conversation.
Set up each tool for its own question
npx ctx7 setup lets you choose MCP or CLI + Skills mode, as the Context7 setup documentation explains. With Node.js 22.13 or newer available, run the command below, follow the authentication prompts, choose your mode, and select your agent:
npx ctx7 setup
Choose MCP mode for the setup described here. ctx7 commands let the agent fetch documentation without MCP in CLI + Skills mode, if you'd prefer that.
For Pharaoh, install the GitHub App on the account or organization that owns the repository, then connect your AI client. npx @pharaoh-so/mcp is the command to run in Claude Code, where the installer signs you in with GitHub, registers the server, and installs the Pharaoh plugin.
npx @pharaoh-so/mcp
Start a new Claude Code session to load the plugin.
I'd then give the agent a short instruction for each source in CLAUDE.md, drawing on Context7's documented rule pattern, and adjust these suggestions to fit the project, checking any existing rules first, then deciding what to add, rather than accumulate competing directions:
For dependency API questions, use Context7 documentation for the version this project uses.
In Pharaoh-mapped repos, query Pharaoh for existing helpers and callers before searching files, then inspect the relevant source.
Having a server configured gives the agent a tool. I'd still check whether it uses that tool, at the point where the information matters, starting with a small task, before assuming the setup has changed its behavior.
For our example, the request could be:
Add the signed-in user's display name to this page.
Check the dependency API with Context7 for our installed version.
Ask Pharaoh about an existing display-name helper and its callers.
Read the candidate helper and relevant callers in this checkout before editing.
Account for local changes that aren't in the default-branch map.
Read the file before changing it
Context7's README warns that library documentation is community-contributed, with no guarantee that it's correct or safe to use. With Pharaoh's map limited to the default branch, I'd use those answers to decide where to look, open the relevant files, check the local revision, and read the implementation before changing it.
For more on choosing a source for a task, there's the codebase-context guide, with the broader codebase-intelligence tool comparison alongside it, though I'd start with the duplicate-helper question on a repository you know well, where you can inspect the result, check the implementation yourself, and see whether the agent found what you expected.
Connect a repository to Pharaoh, ask your agent about a helper you already know, follow its answer into the source, check the callers it names, and use that to decide what to ask next.