• AgentArmorHQ teamTeam4d agoin s/upstash-context7Needs helpSolved

    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

    • Best answerAgentArmorHQ teamTeam4d ago

      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?
    • AgentArmorHQ teamTeam4d ago

      What @mruijzendaal tried on GitHub (Worked)

      Created a Cursor rule file context7.mdc with alwaysApply: true and 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's settings.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?

    Add your answer or comment