DEV Community

Jameson
Jameson

Posted on

Context7 fixed the thing I kept blaming myself for

I'm a vibe coder. I describe what I want, I read the diff, and if it runs I keep going. That gets me a long way, and then it fell apart in a very specific and very confusing way.

The setting

I was building a small static site with Astro. I needed to load a folder of Markdown files and list them. Bread and butter stuff. I asked for it, and got back something like this:

const posts = await Astro.glob('./posts/*.md');
Enter fullscreen mode Exit fullscreen mode

Confident, idiomatic, and completely non-existent.

Astro.glob() was removed in Astro 6. I'm on Astro 7. There was no deprecation warning first, it was simply gone, and the error I got was the kind of unhelpful undefined-is-not-a-function noise that makes you assume you've misconfigured your own project.

So I did what a vibe coder does: I assumed it was me. I checked my folder structure. I moved files around. I asked the assistant to fix its own error, and it produced a content-collections config in the old shape (src/content/config.ts, no loader) which was also removed in Astro 6. Two wrong answers in a row, both of which used to be exactly right.

I lost most of an evening to this before the penny dropped. The assistant wasn't hallucinating. It was answering correctly for Astro 4, and nobody had told it Astro 4 was over.

Why prompting harder doesn't help

This took me too long to understand. A model's library knowledge is frozen at its training cutoff, and it has no way to know which version of Astro is in my package.json. So it averages everything it ever saw, and for a library that's shipped three majors since, the average is wrong.

You can't prompt your way out of missing information. Telling it to "use the latest Astro API" just makes it confidently guess what latest means.

What Context7 actually does

Context7 is an MCP server whose entire job is to fetch current library documentation and put it into the model's context before it answers. The model is unchanged and the output isn't post-processed. It's a retrieval step in front of the thing that was already guessing. It exposes two tools: one that maps a name like "Astro" to a library it has indexed, and one that fetches the current docs for it, optionally scoped to a topic so you're not dumping an entire manual into your context window.

The install I'd recommend is the remote HTTP one, because there is genuinely nothing to install:

claude mcp add --scope user --transport http context7 https://mcp.context7.com/mcp
Enter fullscreen mode Exit fullscreen mode

There's no npx, no Node process idling in the background, and no package to keep current. Most guides lead with a local installer; skip it unless you specifically want a local process. Restart, then run claude mcp list and check context7 is in it. Other editors take the same URL as JSON, and annoyingly no two of them agree on the shape: Cursor and VS Code want different top-level keys. I wrote each one down so I'd stop re-deriving them.

Then I asked the same question again, with use context7 on the end. This time it came back with the actual current API:

import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';

const posts = defineCollection({
  loader: glob({ base: './src/content/posts', pattern: '**/*.md' }),
});
Enter fullscreen mode Exit fullscreen mode

Which is right, and which I would not have got to on my own without reading the migration guide I was specifically trying to avoid reading.

What changed, concretely

The failure mode I described at the top has stopped happening. The specific thing where I burn an evening on an API that was removed two majors ago is gone, because the docs are in the prompt now.

Two honest caveats. It doesn't make the model better at programming: my logic bugs are still entirely mine. And it only knows public library documentation, so it has nothing to say about my own modules.

The case for it is narrow and extremely common: a library moving faster than the model's cutoff, and a version you can name. If you've ever argued with an assistant about whether a method exists, and then found out you were both describing real APIs from different years, this is what fixes it.

If you get stuck wiring it up, the error strings are their own adventure and I wrote them down at mcpcontext7.com/troubleshooting. MCP error -32000 means two completely different things depending on the message next to it, which I discovered the slow way.

Top comments (0)