How to Configure MCP Servers in VS Code, Claude Desktop, and Claude Code on WSL

8 min read

MCP (Model Context Protocol) servers extend AI coding assistants by connecting them to external tools and APIs. In VS Code, MCP servers give GitHub Copilot’s agent mode access to tools like AWS documentation search and cloud resource management. In Claude Desktop and Claude Code CLI, MCP servers let Claude interact with your filesystem, GitHub repos, databases, and more — all from within the conversation. This guide shows you how to configure MCP servers across all three tools on WSL, with practical examples for each.

The examples in this guide are run on WSL2 Ubuntu in Windows, but the MCP configuration format works the same on any platform.

Prerequisites

How MCP Servers Work

MCP servers expose tools over a standard protocol. When an AI assistant supports MCP, it can discover and call these tools during a conversation. For example, a GitHub MCP server lets the assistant create pull requests, and a filesystem server lets it read and write files on your machine.

Each tool — VS Code (Copilot), Claude Desktop, and Claude Code CLI — reads MCP server definitions from a JSON config file, starts the server processes, and makes their tools available in the chat. The server configuration format is nearly identical across all three, so once you understand the pattern, adding servers to any tool is straightforward.

Configuration Overview by Tool

Tool Config File Top-Level Key
VS Code (Copilot) .vscode/mcp.json or user mcp.json "servers"
Claude Desktop claude_desktop_config.json "mcpServers"
Claude Code CLI .mcp.json (project) or ~/.claude.json (user) "mcpServers"

The server entry format (with command, args, and env) is the same across all three tools. The only difference is the top-level key name and where the config file lives.

VS Code (GitHub Copilot) Configuration

When you switch Copilot Chat to Agent mode (click the mode selector in the chat panel), Copilot can use tools provided by MCP servers. VS Code reads server definitions from a mcp.json file and starts them automatically.

Configuration Scopes

Scope File Location Use Case
Workspace .vscode/mcp.json in your project Project-specific servers. Can be committed to source control.
User (Global) User profile mcp.json Servers available across all workspaces.

To open the global config, run MCP: Open User Configuration from the Command Palette (Ctrl+Shift+P). On WSL, this file is stored at ~/.vscode-server/data/User/mcp.json.

Workspace settings override global ones if they define the same server name.

VS Code Configuration Format

{
  "servers": {
    "server-name": {
      "command": "uvx",
      "args": ["package-name@latest"],
      "env": {
        "ENV_VAR": "value"
      }
    }
  },
  "inputs": []
}
  • servers — maps server names to their configuration
  • command — the executable to run (uvx, npx, node, python, etc.)
  • args — command arguments (package name, flags, paths)
  • env — environment variables passed to the server process
  • inputs — optional input variable definitions for secrets like API keys

Example: AWS MCP Servers in VS Code

AWS provides official open-source MCP servers through awslabs. Here’s how to add the AWS Documentation server (searches AWS docs) and the AWS CDK server (helps with infrastructure as code).

{
  "servers": {
    "aws-documentation": {
      "command": "uvx",
      "args": ["awslabs.aws-documentation-mcp-server@latest"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR"
      }
    },
    "aws-cdk": {
      "command": "uvx",
      "args": ["awslabs.cdk-mcp-server@latest"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR"
      }
    }
  }
}
  • aws-documentation — lets Copilot search official AWS documentation, API references, and getting-started guides
  • aws-cdk — provides CDK construct lookup and IaC guidance for AWS CloudFormation and CDK projects
  • @latest — ensures you always run the newest version
  • FASTMCP_LOG_LEVEL — set to ERROR to reduce noise in the output panel

After saving mcp.json, VS Code detects the change and shows a Start button at the top of the file. Click it to start all configured servers. You can also run MCP: List Servers from the Command Palette to see their status.

Claude Desktop Configuration

Claude Desktop reads MCP server definitions from a single config file. On Linux/WSL, you’ll typically access this through the Claude Desktop app on the Windows side.

Config File Location

Platform Path
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json

You can also open this file from Claude Desktop by going to Settings → Developer → Edit Config.

Claude Desktop Configuration Format

Claude Desktop uses mcpServers as the top-level key (not servers like VS Code):

{
  "mcpServers": {
    "server-name": {
      "command": "npx",
      "args": ["-y", "package-name"],
      "env": {
        "ENV_VAR": "value"
      }
    }
  }
}

Example: Filesystem and GitHub MCP Servers

Here’s a practical Claude Desktop config with a filesystem server (lets Claude read and write files) and a GitHub server (lets Claude manage repos, issues, and PRs):

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/home/youruser/projects"
      ]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
      }
    }
  }
}
  • filesystem — gives Claude read/write access to the specified directory. Add multiple paths as additional arguments to grant access to more folders.
  • github — connects Claude to GitHub using a personal access token. Claude can then search repos, read code, create issues, and open pull requests.
  • -y — auto-confirms the npx install prompt so the server starts without manual intervention.

After saving the config, fully quit Claude Desktop and reopen it. The app needs a restart to load new MCP server configurations.

Claude Code CLI Configuration

Claude Code CLI supports MCP servers natively with both a CLI command and direct config file editing. This is the most flexible option for developers working in the terminal.

Configuration Scopes

Scope File Use Case
Local (default) ~/.claude.json (project-specific entry) Private to you, only active in the current project.
Project .mcp.json in project root Shared with team via source control.
User ~/.claude.json (global entry) Available across all projects on your machine.

Adding Servers via CLI

The fastest way to add MCP servers to Claude Code is with the claude mcp add command:

# Add a filesystem server (user scope, available in all projects)
claude mcp add filesystem -s user -- npx -y @modelcontextprotocol/server-filesystem ~/projects

# Add a GitHub server with environment variable
claude mcp add github -s user -e GITHUB_PERSONAL_ACCESS_TOKEN=ghp_your_token_here -- npx -y @modelcontextprotocol/server-github

# Add Context7 for up-to-date library documentation
claude mcp add context7 -s user -- npx -y @upstash/context7-mcp@latest

# Add Sequential Thinking for complex problem-solving
claude mcp add sequential-thinking -s user -- npx -y @modelcontextprotocol/server-sequential-thinking

# List all configured servers
claude mcp list

# Remove a server
claude mcp remove github
  • -s user — sets user scope so the server is available across all projects
  • -s local — (default) restricts the server to the current project
  • -e KEY=VALUE — passes environment variables to the server process
  • -- — separates the claude mcp add options from the server command and arguments

Adding Servers via Config File

For complex configurations, edit the config file directly. Create a .mcp.json file in your project root to share servers with your team:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/home/youruser/projects"
      ]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
      }
    },
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp@latest"]
    },
    "aws-documentation": {
      "command": "uvx",
      "args": ["awslabs.aws-documentation-mcp-server@latest"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR"
      }
    }
  }
}

Claude Code supports environment variable expansion in .mcp.json files using ${VAR} and ${VAR:-default} syntax. This lets you share the config file without exposing secrets — each team member sets their own environment variables.

After adding or modifying servers, restart Claude Code with /mcp or by exiting and re-running claude in your terminal.

Install uv and Python (for AWS MCP Servers)

The AWS MCP servers use uvx as their runtime. If you plan to use them in any of the tools above, install uv and Python first.

1. Install uv

curl -LsSf https://astral.sh/uv/install.sh | sh

Restart your terminal or run source $HOME/.local/bin/env to add uv and uvx to your PATH.

2. Install Python 3.10+

uv python install 3.10

Using Input Variables for Secrets (VS Code)

If an MCP server needs an API key in VS Code, never hardcode it in mcp.json. Use input variables instead — VS Code will prompt you for the value when the server starts:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "github-token",
      "description": "GitHub Personal Access Token",
      "password": true
    }
  ],
  "servers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github-token}"
      }
    }
  }
}

The password: true flag hides the input as you type it. For Claude Desktop and Claude Code, use environment variables on your system instead (e.g., export them in ~/.bashrc).

Troubleshooting

“spawn npm ENOENT” or “spawn uvx ENOENT”

This means the tool can’t find the command binary. In VS Code on WSL, the server process doesn’t inherit your shell’s PATH. In Claude Desktop on Windows, the same issue occurs when binaries aren’t in the system PATH.

Fix it by using the full absolute path to the command:

which uvx

If it returns /home/youruser/.local/bin/uvx, use that full path in your config:

{
  "command": "/home/youruser/.local/bin/uvx",
  "args": ["awslabs.aws-documentation-mcp-server@latest"],
  "env": {
    "FASTMCP_LOG_LEVEL": "ERROR"
  }
}

The same fix applies to npx — use the output of which npx as the command value.

Server starts but tools don’t appear (VS Code)

  • Make sure Copilot Chat is in Agent mode, not Ask or Edit mode. MCP tools only work in agent mode.
  • Run MCP: List Servers to check if the server status shows “Running”. If it shows an error, check the Output panel (Ctrl+Shift+U) and select the MCP server from the dropdown.
  • Try MCP: Reset Cached Tools from the Command Palette to clear stale tool data.

Claude Desktop doesn’t load new servers

Claude Desktop requires a full restart after editing the config. Closing the window is not enough — fully quit the app (right-click the tray icon → Quit) and reopen it.

Claude Code CLI servers not connecting

Run claude mcp list to check server status. If a server shows errors, verify the command path exists and any required environment variables are set. You can also run /mcp inside a Claude Code session to see server status and restart them.

Invalid JSON in config files

A single syntax error breaks all servers. Validate the file:

# For VS Code
python3 -m json.tool ~/.vscode-server/data/User/mcp.json

# For Claude Code project config
python3 -m json.tool .mcp.json

If it prints the formatted JSON, the syntax is valid. If it shows an error, fix the line it points to.

AWS credentials not found

The AWS MCP servers use your local AWS credentials. If you get authentication errors, make sure ~/.aws/credentials or ~/.aws/config is set up correctly in your WSL environment. See How to Configure AWS SSO CLI Access for Linux Ubuntu if you use SSO.

Conclusion

MCP servers work across VS Code (GitHub Copilot), Claude Desktop, and Claude Code CLI with a nearly identical configuration format. The key difference is the config file location and the top-level JSON key (servers for VS Code, mcpServers for Claude). Once you understand the pattern, you can add any MCP server to any tool in seconds. For more on setting up your WSL development environment, see How to Install Claude Code CLI on WSL2 Ubuntu.