Configuring the GitHub MCP Server in Visual Studio via OAuth

Design and implement SQL solutions by using AI-assisted tools
Answer Correct answer: B — create the .\mcp.json file containing https://api.githubcopilot.com/mcp/ so Visual Studio registers the GitHub MCP Server and authenticates with OAuth instead of a stored PAT.

You are developing an Azure SQL solution by using Microsoft Visual Studio 2026. The solution uses a GitHub repository. You plan to use GitHub Copilot Chat to access the GitHub repository tools by connecting to the GitHub MCP Server. You need to configure Visual Studio to support the planned configuration. The solution must rely on OAuth to access the MCP server. What should you create?

  1. the \.vs\settings.json file that contains the personal access token (PAT) that has the repo scope
  2. the \.mcp.json file that contains a URL of https://api.githubcopilot.com/mcp/ Correct Answer
  3. the \.vscode\settings.json file that contains a URL of https://api.githubcopilot.com/mcp/
  4. the \.github\mcp.json file that contains the personal access token (PAT) that has the repo scope

Community Insight

The question tests which MCP configuration file Visual Studio uses and how OAuth-based authentication removes the need for a PAT; the trap is picking an option that hard-codes a token or uses the .vscode path instead of the Visual Studio solution-root path.

To let GitHub Copilot Chat in Visual Studio 2026 reach the GitHub repository tools through the GitHub MCP Server, you must add a project-scoped MCP configuration file that declares the server endpoint and lets Visual Studio authenticate with OAuth. The correct setup is a .\mcp.json file in the solution root containing the URL https://api.githubcopilot.com/mcp/, with no personal access token stored in the file.

Learners often choose options A or D, storing a personal access token with the repo scope in a settings or mcp file. Because the requirement explicitly says the solution must rely on OAuth, embedding a PAT is both wrong for the scenario and a security anti-pattern; the .vscode path in option C targets VS Code, not Visual Studio 2026.

Community Discussion (1 comments)

gangreja 👍 1 Selected: B
never a PAT in the file and VS Code → .vscode/mcp.json Visual Studio → .mcp.json in the solution root.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Because the requirement states the solution must rely on OAuth, the MCP server entry should contain only the server endpoint URL, and Visual Studio handles authentication interactively through the OAuth sign-in flow. Visual Studio 2026 reads project-scoped MCP servers from a.\mcp.json file located in the solution root, matching the file name and location described in option B. The GitHub Copilot MCP server endpoint is https://api.githubcopilot.com/mcp/, so declaring that URL in.mcp.json is exactly the documented configuration. Once the file is present, Copilot Chat can invoke the GitHub MCP tools (repository search, issues, pull requests) against the GitHub repository used by the solution.

Why the Other Options Are Wrong

Options A and D both embed a personal access token with the repo scope directly in a file, which contradicts the OAuth requirement — with OAuth the credential is obtained at sign-in time and never written into configuration. Option A additionally targets the.\vs\settings.json file, which is not the project-scoped MCP registration file Visual Studio reads for MCP servers. Option C uses the.vscode\settings.json path, which belongs to Visual Studio Code's own configuration layout (and VS Code's MCP configuration is typically mcp.json, not settings.json), so it does not configure Visual Studio 2026. Only option B supplies the correct file name, correct location, and the tokenless OAuth-friendly endpoint.

Community Comment Notes

A single commenter, gangreja, supported option B and captured the core rule succinctly: "never a PAT in the file and VS Code →.vscode/mcp.json Visual Studio →.mcp.json in the solution root." That matches the official guidance that Visual Studio uses a.mcp.json file in the solution root for project-scoped MCP servers, while Copilot OAuth authentication eliminates any stored token. As the only comment available, it is consistent with the vendor documentation rather than being an outlier opinion.

Official Reference

Exam Strategy

When an MCP or Copilot question mentions OAuth or interactive authentication, eliminate any option that stores a PAT, API key, or secret in a file — OAuth means the config holds only the endpoint. Then match the config file to the editor: Visual Studio uses .mcp.json in the solution root, whereas Visual Studio Code uses .vscode/mcp.json.

Frequently Asked Questions

Why is storing a PAT in the mcp or settings file wrong for this GitHub MCP setup?

The question requires OAuth authentication, so Visual Studio signs in interactively and no token is written to configuration. Hard-coding a PAT with the repo scope also creates a credential-leak risk in the repository.

Why not use the .vscode path when configuring the GitHub MCP Server in Visual Studio 2026?

The .vscode folder is Visual Studio Code's configuration layout. Visual Studio 2026 reads project-scoped MCP servers from a .mcp.json file in the solution root, so only that path registers the server for Copilot Chat in Visual Studio.

More DP-800 FAQ →

Related Analysis

← Back to DP-800 Study Guide