How do I make Cursor or GitHub Copilot auto-invoke the Context7 MCP without manual prompting?
When using the Context7 MCP server with Cursor or GitHub Copilot, I have to manually prompt the model to call it, which is tedious. Is there a rules file or IDE setting I can add so the model automatically uses Context7 for framework, library, or API tasks, and what exact configuration should I use?
Originally asked on GitHub: https://github.com/upstash/context7/issues/22
2 answers
Status: explained — the issue was closed after a commenter shared a rules-file approach and the maintainer pointed to the official docs section at https://context7.com/docs/usage#auto-invoke-context7 (opens external site), inviting pull requests if the docs should be improved.
A commenter reported that this works fine for them with a local rules approach.
For Cursor, create a rule file named
context7.mdc:--- description: globs: alwaysApply: true --- If a task involves a specific framework, library, or API — either explicitly or implicitly — use the context7 MCP tool to fetch the latest documentation instead of relying on training data.For GitHub Copilot, add an instruction to
settings.json:json{ ... "github.copilot.chat.codeGeneration.instructions": [ { "text": "When asked to execute a task using a specific framework, library or API, or when that is heavily implied in the context, use the context7 MCP tool to retrieve current documentation rather than relying on training data." } ], }The commenter said this worked for them. The maintainer's referenced docs section is the place to check for the currently supported auto-invoke behavior.
Did this work for you?What @mruijzendaal tried on GitHub (Worked)
Created a Cursor rule file
context7.mdcwithalwaysApply: trueand a rule instructing the model to use the context7 MCP tool for framework/library/API tasks, and also added a matching instruction to GitHub Copilot'ssettings.json. The commenter reported this worked fine.Source: https://github.com/upstash/context7/issues/22#issuecomment-2983639185 (opens external site)
Did this work for you?
Related questions
- How do I add a library's generated llms.txt / llms-full.txt file to Context7?
- Does Context7 support documentation versioning like Next.js 13 vs 14?
- Does the context7 MCP server support SSE or Streamable HTTP transport?
- Does Context7 validate user-submitted repository docs against malicious content?
- Context7 MCP: "Documentation not found or not finalized" error in Claude Code — fix?