How to Set Up GitHub Copilot in VS Code with Custom MCP Servers
This guide explains how to set up a github copilot vscode workspace configuration with custom Model Context Protocol (MCP) servers, configure user-level settings, and connect your coding tools to a secure, shared workspace.
Why Grounding GitHub Copilot in Custom Context Matters
Nearly 80% of new developers adopted GitHub Copilot within their first week on the platform, according to the GitHub Octoverse 2025 report [GitHub 2025 Octoverse]. This high adoption highlights how AI assistance has transformed the development workflow. However, standard auto-completions and chat interactions often fail when the model lacks context about your private codebase, internal database schemas, or team documentation. Without this specific background information, the assistant must guess implementation details, which leads to time-consuming manual debug cycles.
Model Context Protocol (MCP) addresses this challenge. This open standard allows the AI client in your editor to query external data sources and run local tools on your behalf. GitHub Copilot in VS Code uses extension-based AI chat and completions that can be extended via user or workspace configuration files for MCP. By configuring custom MCP servers, you can bridge the gap between static model weights and your active development environment.
This guide provides a comprehensive walkthrough for setting up custom MCP servers in Visual Studio Code. We will explore how to manage global and project-specific settings, structure configuration JSON files, enable autonomous agent mode, and connect your assistant to Fastio persistent workspaces.
The Context Limitation of Large Language Models
Large language models are trained on historical public repositories. As a result, they are blind to your private APIs, system architectures, or team guidelines. When you ask a generic coding assistant to interact with these private resources, the tool generates suggestions that are close to correct but fail. Extending the assistant with workspace-level or user-level configuration files for MCP provides a direct pathway for the model to query real-time data from your system, removing guesswork.
How the Model Context Protocol Works in Your Editor
The Model Context Protocol establishes a standard client-server model inside Visual Studio Code. The editor serves as the MCP client, while your configured helper processes act as MCP servers. When you submit a request to the Copilot Chat panel, the assistant evaluates the tools registered by your active MCP servers. If a query requires database inspection or file reading, Copilot requests permission to execute the corresponding server tool. VS Code spawns the tool as a local subprocess, executes the command, and returns the output to ground the model response.
How to Configure GitHub Copilot VSCode MCP Settings
VS Code MCP configs use user-level or workspace-level settings. Choosing the correct scope is essential for managing security, credentials, and configuration sharing across your team. A global setup ensures that your personal tools are always active, whereas workspace settings keep project-specific tools bundled with the codebase.
Global configurations are stored at the user level. They apply across all directories and projects you open. User-level setups are ideal for personal developer utilities, such as a local web search helper, a general calculator tool, or a personal database explorer. In contrast, workspace-level settings are scoped to a single project folder. Committing these configurations to your version control system ensures that every team member who clones the project starts with the same development environment.
Before building custom integrations, consider the hosting alternatives. While developers can use local directory storage, AWS S3, or Google Drive for storing configuration files and developer documentation, these traditional options function as passive storage blocks. They lack built-in semantic indexes, version histories, or direct collaboration interfaces. Fastio provides an alternative by serving as an intelligent workspace platform where humans and AI agents collaborate on the same files and directories with built-in versioning.
Locating Your User Profile Configuration File
To configure global MCP servers, you must edit the user-level configuration file. You can access this file by launching the Visual Studio Code Command Palette with the Cmd+Shift+P shortcut on macOS or Ctrl+Shift+P on Windows. Type the command "MCP: Open User Configuration" and select it. This action opens the global configuration file in your editor.
Depending on your operating system, the configuration file is saved in the following directories:
- On macOS:
/Users/<username>/Library/Application Support/Code/User/mcp.json - On Windows:
C:\Users\<username>\AppData\Roaming\Code\User\mcp.json - On Linux:
/home/<username>/.config/Code/User/mcp.json
Setting Up Project-Specific Configurations
For project-specific setups, you must create a configuration file named .vscode/mcp.json relative to the root directory of your active workspace. If you use both global and local configuration scopes, Visual Studio Code merges the server listings. If a server configuration is declared in both scopes with the same name, the workspace-level configuration takes precedence, allowing you to override global defaults for specific projects.
Steps for Writing the JSON Configuration
The configuration file uses a standard JSON schema to register your MCP servers. The root of the JSON object must contain an mcpServers property. Under this property, you define each server with a unique identifier key. For local processes, the configuration requires a command pointing to the executable and an array of runtime arguments. For remote endpoints, you configure the connection using a transport URL.
Below is an example configuration that defines a local database inspector using Node Package Execute (npx) and a remote connection using a streamable HTTP transport:
{
"mcpServers": {
"local-database-explorer": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"--connection-string",
"postgresql://localhost:5432/development_db"
],
"env": {
"DB_PASSWORD": "${input:database-password}"
}
},
"remote-workspace-server": {
"url": "https://fast.io/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
When you configure a command to run, Visual Studio Code spawns the process as a background daemon. The env block allows you to declare environment variables. Using the ${input:database-password} placeholder tells the editor to prompt you for sensitive values, such as database passwords, when it boots the server. This prevents secret keys from being written in plain text inside your settings file.
If you need to query database tables or process unstructured files like invoices or contracts, you can use Fastio Metadata Views to turn those documents into structured, queryable databases.
Running Local Scripts with Execution Tools
For Python-based local scripts, you can run the server using python or uv execution tools. If you use uv, write the command as uvx and pass the package name in the args array. Ensure that any executable referenced in your command property is available within your system path environment variables, or provide the absolute path to the binary.
Connecting to Secure Remote Endpoints
When connecting to remote servers, you must specify the connection URL. Many developers use HTTP endpoints that support Server-Sent Events (SSE) or streamable HTTP channels. These connections require authorization headers to prevent unauthorized access to your workspace files.
Connect GitHub Copilot to a shared workspace environment
Set up a shared, version-controlled workspace for your development agents and team members. Fastio indexes your files for semantic search and exposes a secure MCP endpoint, starting with a 14-day free trial.
Activating Agent Mode and Approving Tools in the Copilot Chat Panel
Once you save your configuration file, Visual Studio Code automatically initializes the registered MCP servers. To run the tools provided by these servers, you must activate Agent Mode inside the Copilot Chat panel. Agent Mode toggles MCP tool calls inside Copilot Chat panel, transitioning the assistant from an autocomplete box to an autonomous developer agent.
To enable Agent Mode, open the Copilot Chat panel in the side utility bar. Click the agent selection dropdown at the top of the chat panel and select the Agent option. You can verify which tools are registered by clicking the tools icon (often a gear or wrench) inside the chat input box. This panel displays a checkbox list of all active tools. You can manually disable tools you do not want the assistant to use during your session.
When you submit a prompt that triggers a tool call, Visual Studio Code displays a security verification box. For example, if you ask the assistant to inspect the schema of your database, the editor prompts you to authorize the Postgres read operation. Once you approve the request, the agent runs the tool and incorporates the output into the chat response.
Managing Auto-Approval Settings for Local Commands
By default, Visual Studio Code prompts you for approval before executing any MCP tool. If you are running repetitive tasks, you can configure auto-approval settings for trusted servers. In your user settings, search for tool execution permissions to allow specific servers to read files or run terminal commands without intermediate verification prompts.
Testing Your Connection with Inspection Prompts
To verify that your custom setup is functioning, submit a prompt that requires tool execution. If you configured a file system tool, ask: "List the files in the workspace root." If the server is connected, the editor will display the progress of the tool call, show the raw output returned by the script, and summarize the files in the chat window.
Securing and Sharing Configurations Across Your Team
Deploying MCP configuration files across a team requires careful management of security boundaries and access permissions. Because local MCP servers run with the permissions of the logged-in user, a malicious configuration could read private directories or modify system settings.
When sharing configurations, commit .vscode/mcp.json to your repository, but do not hardcode authentication tokens. Instead, configure the server to read credentials from your system environment variables. This approach allows team members to manage their individual API keys locally while sharing the command structure.
For teams requiring granular permissions and a detailed log of all modifications, passive storage buckets are difficult to manage. Fastio provides secure workspaces with granular permissions at the organization, workspace, folder, and file levels. Every modification is tracked in an append-only audit log, and file version history is maintained automatically. This design allows you to track exactly which tools and team members edited a specific file, ensuring visibility during developer testing.
To get started with team coordination, visit the Fastio pricing page to select a plan and start a 14-day free trial.
Avoiding Credential Leakage in Version Control
Never commit plain-text API keys or database passwords to your Git repository. If your server requires an authentication header, define the header value using environment variables. You can instruct your build system or local startup script to export these variables before launching Visual Studio Code.
Tracking Code History and Version Rollbacks
When AI agents make edits to your files, tracking the revision history is essential. Fastio maintains a detailed revision ledger for every file in the workspace. If an autonomous agent writes a buggy code block or corrupts a configuration, developers can view the exact changes and restore the previous version from the workspace interface.
Troubleshooting Connection Failures and Inspecting Logs
If a custom MCP server fails to launch or does not appear in the Copilot Chat panel, you must inspect the system logs to identify the error. Visual Studio Code runs these servers as background tasks, meaning standard crash reports will not appear in your terminal.
To view the server logs, open the Output panel in Visual Studio Code by selecting View > Output from the top menu. In the top-right corner of the Output panel, click the dropdown menu and select MCP. This channel displays the initialization steps, execution arguments, standard output, and standard error logs of all active servers.
Common errors include missing executables, syntax errors in the JSON configuration, and network timeouts. If you see a command-not-found error, verify that the path to node, python, or npx is correct, or define the absolute path to the executable in your settings file. If the JSON syntax is malformed, the editor will fail to parse the file and will log a parsing error in the console.
Using the MCP Inspector for Tool Validation
For developers writing custom servers, the official MCP Inspector tool provides an interactive debugging interface. You can run the inspector locally to test your tool schemas, evaluate argument parsing, and verify JSON responses before registering the server in Visual Studio Code.
Handling Port Conflicts and Stale Daemons
If you modify your mcp.json file frequently, Visual Studio Code may fail to kill the old server processes, leading to port conflicts. If tools return stale data, close the editor, terminate any orphaned background processes in your system activity monitor, and restart Visual Studio Code to reload a clean environment.
Frequently Asked Questions
How do I install GitHub Copilot in VS Code?
To install GitHub Copilot, open the Extensions view in Visual Studio Code using the Cmd+Shift+X or Ctrl+Shift+X shortcut, search for the official GitHub Copilot extension, and click Install. Once the installation completes, follow the prompts to log in with your GitHub account to activate your subscription.
How do I configure MCP servers in VS Code Copilot?
To configure MCP servers, open the Command Palette with Cmd+Shift+P, run the MCP: Open User Configuration command, and define your servers inside the mcp.json file. For project-specific tools, create a file named .vscode/mcp.json in the root folder of your workspace and specify the command, arguments, and environment variables.
How do I enable Agent Mode in VS Code Copilot?
To enable Agent Mode, open the Copilot Chat panel in Visual Studio Code, locate the model/agent selection dropdown at the top of the interface, and select Agent. In this mode, the assistant can run configured MCP tools, execute terminal commands, and perform multi-file edits autonomously.
How do I resolve connection timeouts with remote MCP servers?
To resolve connection timeouts, check the MCP output logs in Visual Studio Code, verify that the remote URL is correct, and ensure that your authorization headers are active. If you are using a cloud workspace, check that your network allows outbound traffic to the destination IP address.
Can I share my MCP configurations with my team?
Yes, you can share configurations by committing the .vscode/mcp.json file to your Git repository. To prevent credential leakage, use environment variables for sensitive tokens instead of writing them directly in the JSON file.
Related Resources
Connect GitHub Copilot to a shared workspace environment
Set up a shared, version-controlled workspace for your development agents and team members. Fastio indexes your files for semantic search and exposes a secure MCP endpoint, starting with a 14-day free trial.