Add tool to search by npm package name to skip the initial docs index search, makes MCP server faster
Right now the MCP has to first find the docs for the library it needs, because there is no centralized index for docs that associates the docs to one key.
Fortunately in the javascript cases there is one: npm. The MCP should have a tool to get docs for a specific npm package name, this way it can skip the initial index search and directly get the docs for a specific npm package name
You can directly tell the LLM to use a package’s library ID.
Currently, we map the GitHub repo structure one-to-one to Context7 library IDs. For example, if the repo URL is github.com/vercel/next.js, its Context7 ID is /vercel/next.js. You can instruct the LLM to use this ID directly, and in our tests, it skips the initial resolution step.
Let us know how it works for you after trying it out!
Now it's very restrictive because it asks for the exact same context7 slug format which the llm can't really know without the user explicitly telling it
https://github.com/upstash/context7/blob/1755da4d49af053613e7ff70cd63a40db66a0970/src/index.ts#L50
I think you should add a line explaining that the context7 and the npm package name are the same and there is no need to search in that case, it would make the MCP 2x faster. Or add a special npm org like /npm/package-name that can be resolved in 1 shot