Skip to main content
Add the hosted MCP server to GitHub Copilot or to an agent in Microsoft Copilot Studio. Choose your Copilot experience, then follow its setup instructions:

Server URL and authentication

Every Copilot experience on this page uses the same server URLs and credentials:
  • Server URL: https://semgrep.dev/api/mcp. To give Copilot only tools that read data, use the read-only URL, https://semgrep.dev/api/mcp/read-only.
  • API token: A Web API or Read-only API token, sent in an Authorization header as Bearer YOUR_SEMGREP_APP_TOKEN. Replace YOUR_SEMGREP_APP_TOKEN with your API token.
  • OAuth: Where the Copilot experience supports it, you sign in to Semgrep and select an organization in your browser.
For help choosing an authentication method, see Authentication and access.
Single-tenant URLThe steps on this page use https://semgrep.dev/api/mcp. On a single-tenant deployment, replace that URL with https://YOUR_TENANT.semgrep.dev/api/mcp. Use your subdomain for YOUR_TENANT. To connect to the read-only URL instead, see Read-only URL.

Connect GitHub Copilot CLI

Add the hosted MCP server to GitHub Copilot CLI so you can use Semgrep tools from your terminal. If you installed the Semgrep Guardian plugin for GitHub Copilot, it already includes the Semgrep MCP tools, so you don’t need to add the hosted MCP server separately.

Prerequisites

Add the server

To add the server, follow these steps:
  1. Start a Copilot CLI session:
  2. Run /mcp add. A form opens. Press Tab to move between fields. If semgrep is already configured, run /mcp edit semgrep instead to update the existing entry.
  3. Fill in the form:
    • Server Name: semgrep
    • Server Type: HTTP
    • URL: https://semgrep.dev/api/mcp
    • HTTP Headers: {"Authorization": "Bearer YOUR_SEMGREP_APP_TOKEN"}
  4. Press Ctrl+S to save. The server is available right away, without restarting the session. GitHub Copilot CLI saves the server to ~/.copilot/mcp-config.json, including the token. Keep that file out of version control.

Verify the connection

Run /mcp show semgrep and confirm that semgrep is connected and lists its tools.

Add the server from your terminal

You can also add the server without starting a session:
This command includes the token, so your shell can save it to its history file. For more information, see GitHub documentation on adding MCP servers to Copilot CLI.

Connect Copilot cloud agent

Copilot cloud agent works on GitHub.com, for example on issues that you assign to Copilot. It reads its MCP configuration from a repository’s settings.

Security considerations

Copilot cloud agent doesn’t support remote MCP servers that use OAuth, so connect with an API token stored as a secret. Copilot cloud agent uses MCP tools without asking for your approval. To limit what it can change, connect to the read-only URL with a Read-only API token.
Everyone who can assign work to Copilot in the repository uses the same API token, with the Semgrep access of the token’s owner. Through Copilot, they can read findings and code snippets from any project that the token can access. Copilot can also include that data in pull requests. The read-only URL limits what Copilot can change, not what it can read. Create the token as a user whose Semgrep access fits everyone who works in the repository.

Prerequisites

Add the server

To add the server, follow these steps:
  1. In the repository, go to Settings > Secrets and variables > Agents, click the Secrets tab, then click New repository secret.
  2. Name the secret COPILOT_MCP_SEMGREP_AUTH. Set its value to Bearer followed by a space and your API token, for example Bearer YOUR_SEMGREP_APP_TOKEN. Copilot cloud agent passes only secrets whose names start with COPILOT_MCP_ to MCP servers. For more information, see GitHub documentation on secrets and variables for Copilot cloud agent.
  3. In the repository, go to Settings > Copilot > MCP servers.
  4. Under MCP configuration, add the following configuration, or add the semgrep entry to your existing mcpServers object:
    To let Copilot cloud agent make changes, such as triaging findings or starting scans, use https://semgrep.dev/api/mcp and a Web API token instead. To allow only specific tools, replace "*" in tools with a list of tool names. For tool names, see Tools and capabilities.
  5. Click Save MCP configuration.
For more information, see GitHub documentation on configuring MCP servers for a repository.

Verify the connection

To confirm that the server starts, follow these steps:
  1. Assign an issue to Copilot.
  2. In the pull request that Copilot opens, click View session.
  3. Click the three-dot menu at the top right of the log viewer, then click Copilot.
  4. Expand the Start MCP Servers step. If semgrep started, its tools are listed at the end of the step.
The repository’s MCP configuration also applies to Copilot code review.

Connect Copilot Chat in an IDE

Setup for Copilot Chat depends on your IDE. Find your IDE in the following list:
  • VS Code: See Connect VS Code. Semgrep tools are available in Copilot Chat Agent mode.
  • Visual Studio: In Copilot Chat Agent mode, add an HTTP server with the server URL. Visual Studio saves it to an mcp.json file. To sign in with OAuth, open that file and click the Auth CodeLens for the server.
  • JetBrains IDEs or Eclipse: Add a remote server to the mcp.json file in JetBrains IDEs, or under Server Configurations in Eclipse. These IDEs take an API token in a requestInit object:
For where to find these settings in each IDE, see GitHub documentation on extending Copilot Chat with MCP.

Connect a Microsoft Copilot Studio agent

Add the hosted MCP server as a tool on an agent in Copilot Studio. With generative orchestration, the agent calls Semgrep tools when they’re relevant to a request.

Prerequisites

  • The prerequisites for the hosted MCP server.
  • A Copilot Studio agent with generative orchestration turned on.
  • If your Power Platform environment has data policies, they must allow the connector that Copilot Studio creates for the server. Copilot Studio connects to MCP servers through Power Platform connectors, so connector data policies also apply to the hosted MCP server.
  • To connect with an API token, a Web API or Read-only API token.

Add the server

To add the server, follow these steps:
  1. Open your agent in Copilot Studio, then go to its Tools page.
  2. Select Add a tool > New tool > Model Context Protocol.
  3. Enter the server details:
    • Server name: Semgrep
    • Server description: A description that tells the agent when to use the server, for example Search, triage, and fix Semgrep security findings, and run Semgrep scans.
    • Server URL: https://semgrep.dev/api/mcp, or the read-only URL to give the agent only tools that read data
  4. Choose an authentication method:
    • OAuth (recommended): Select OAuth 2.0, then set Type to Dynamic discovery.
    • API token: Select API key, set Type to Header, and enter Authorization as the header name.
  5. Click Create.
  6. In the Add tool dialog, click Create a new connection:
    • With OAuth, sign in to Semgrep and select an organization in your browser.
    • With an API token, enter Bearer followed by a space and your API token, for example Bearer YOUR_SEMGREP_APP_TOKEN.
  7. Click Add to agent.
  8. Optional: To allow only specific tools, select the Semgrep server on the Tools page. Turn off Allow all, turn on the tools you want, and click Save. All tools are on by default. For tool names, see Tools and capabilities.
  9. Publish the agent.

Verify the connection

On the agent’s Tools page, select the Semgrep server and confirm that its settings page lists the Semgrep tools. If Semgrep adds, removes, or renames tools, Copilot Studio can take up to 24 hours to show the change. For more information, see Microsoft documentation on troubleshooting MCP integration. For the full procedure, see Microsoft documentation on adding an MCP server to a Copilot Studio agent.