Skip to main content

VSCode Integration

Visual Studio Code supports MCP servers through GitHub Copilot Chat. You can configure servers at the workspace or user level, enabling your entire team to share MCP configurations.
Prerequisites:
  • VSCode 1.102+ with GitHub Copilot installed and enabled
  • Copilot subscription (individual, business, or enterprise)
  • MCP support is generally available from VS Code 1.102

Configuration File Locations

Location: .vscode/mcp.json in your project rootBenefits:
  • Shared with team via version control
  • Project-specific MCP servers
  • Consistent across team members
mkdir -p .vscode
touch .vscode/mcp.json

Local (Stdio) Setup

  1. Press Cmd/Ctrl+Shift+P
  2. Run MCP: Add Server
  3. Choose Workspace or Global scope
  4. Paste configuration and edit with IntelliSense

Using CLI

# Add local stdio server
code --add-mcp '{
  "name": "ibmiMcp",
  "type": "stdio",
  "command": "npx",
  "args": ["-y", "@ibm/ibmi-mcp-server@latest", "--tools", "/absolute/path/to/tools"],
  "env": {
    "DB2i_HOST": "your-ibmi-host.com",
    "DB2i_USER": "your-username",
    "DB2i_PASS": "your-password",
    "DB2i_PORT": "8076",
    "MCP_TRANSPORT_TYPE": "stdio"
  }
}'

Using mcp.json

Create or edit mcp.json:
{
  "servers": {
    "ibmiMcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@ibm/ibmi-mcp-server@latest", "--tools", "/absolute/path/to/tools"],
      "env": {
        "DB2i_HOST": "your-ibmi-host.com",
        "DB2i_USER": "your-username",
        "DB2i_PASS": "your-password",
        "DB2i_PORT": "8076",
        "MCP_TRANSPORT_TYPE": "stdio"
      }
    }
  }
}
Important: The --tools path must be an absolute path.
Security: On first start, VSCode will prompt you to trust the MCP server. Only trust servers from reliable sources as they can execute code on your machine.

Remote (HTTP/SSE) Setup

VSCode supports both HTTP and SSE (Server-Sent Events) transport for remote servers.

Using CLI

# Add remote HTTP server
code --add-mcp '{
  "name": "ibmiMcp",
  "type": "http",
  "url": "http://localhost:3010/mcp",
  "headers": {
    "Authorization": "Bearer YOUR_ACCESS_TOKEN_HERE"
  }
}'

Using mcp.json

{
  "servers": {
    "ibmiMcp": {
      "type": "http",
      "url": "http://localhost:3010/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_ACCESS_TOKEN_HERE"
      }
    }
  }
}

Secure Credentials with Variables

VSCode supports multiple variable types for secure credential management and flexible configurations:

Input Variables

Prompt users for sensitive data at runtime:
{
  "inputs": [
    {
      "id": "db2iHost",
      "type": "promptString",
      "description": "IBM i DB2 host address"
    },
    {
      "id": "db2iUser",
      "type": "promptString",
      "description": "IBM i username"
    },
    {
      "id": "db2iPass",
      "type": "promptString",
      "description": "IBM i password",
      "password": true
    }
  ],
  "servers": {
    "ibmiMcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@ibm/ibmi-mcp-server@latest", "--tools", "/absolute/path/to/tools"],
      "env": {
        "DB2i_HOST": "${input:db2iHost}",
        "DB2i_USER": "${input:db2iUser}",
        "DB2i_PASS": "${input:db2iPass}",
        "DB2i_PORT": "8076",
        "MCP_TRANSPORT_TYPE": "stdio"
      }
    }
  }
}
VSCode will prompt for these values when the server starts, keeping credentials secure and out of version control.

Built-in Variables

Use VSCode’s built-in variables for dynamic paths:
  • ${workspaceFolder} - Absolute path to the workspace root
  • ${env:VAR_NAME} - Environment variable value
  • ${userHome} - User’s home directory path
Example:
{
  "servers": {
    "ibmiMcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@ibm/ibmi-mcp-server@latest", "--tools", "${workspaceFolder}/tools"],
      "env": {
        "DB2i_HOST": "${env:IBM_HOST}",
        "DB2i_USER": "${env:IBM_USER}",
        "DB2i_PASS": "${env:IBM_PASS}"
      }
    }
  }
}
Best Practice: Use ${workspaceFolder} for tools paths in team configs so they work regardless of where teammates clone the repo.

Managing Servers

List All Servers

  1. Open Command Palette (Cmd/Ctrl+Shift+P)
  2. Run MCP: List Servers
  3. View all configured servers with status

View Servers in Chat

  • Open the Copilot Chat view in the Activity Bar
  • Look for MCP servers listed in the chat interface
  • Click the MCP indicator to see available tools

Restart Server

Method 1 - Command Palette:
  1. Press Cmd/Ctrl+Shift+P
  2. Run MCP: Restart Server
  3. Select your server from the list
Method 2 - Extensions View:
  • Right-click server in Extensions view
  • Select “Restart”

Autostart Servers (Experimental)

Enable automatic server startup:
  1. Open VSCode Settings
  2. Search for chat.mcp.autostart
  3. Enable the setting

Disable Server

Remove or comment out the server entry in mcp.json

Testing the Connection

After configuration:
  1. Reload VSCode: Cmd/Ctrl+Shift+P → “Developer: Reload Window”
  2. Open Copilot Chat: Click the chat icon in Activity Bar
  3. Check MCP status: Look for MCP indicator in Copilot Chat
  4. List tools: Ask “@mcp what tools are available?”
  5. Test a tool: Ask “Show me the IBM i system status”

Troubleshooting

Solutions:
  • Verify JSON syntax in mcp.json
  • Reload VSCode window: Cmd/Ctrl+Shift+P → “Developer: Reload Window”
  • Check Copilot is installed and enabled
  • Verify GitHub Copilot subscription is active
  • Look for errors in Output panel: View → Output → “MCP”
Solutions:
  • Verify npx -y @ibm/ibmi-mcp-server@latest works from terminal
  • Check all paths are absolute
  • Ensure IBM i credentials are correct
  • Review VSCode Developer Tools: Help → Toggle Developer Tools
Solutions:
  • Verify remote server is running
  • Check token is valid and not expired
  • Ensure correct Authorization header format
  • Get fresh token: node get-access-token.js --verbose
Solutions:
  • Ensure inputs array is at root level of mcp.json
  • Verify ${input:id} syntax is correct
  • Restart VSCode completely
  • Check that input IDs match between definition and usage

Advanced Configuration

Team Workspace Setup

Share MCP configuration with your team via .vscode/mcp.json:
{
  "inputs": [
    {
      "id": "db2iHost",
      "type": "promptString",
      "description": "IBM i host (e.g., dev-ibmi.company.com)",
      "default": "dev-ibmi.company.com"
    },
    {
      "id": "db2iUser",
      "type": "promptString",
      "description": "Your IBM i username"
    },
    {
      "id": "db2iPass",
      "type": "promptString",
      "description": "Your IBM i password",
      "password": true
    }
  ],
  "servers": {
    "ibmiMcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["@ibm/ibmi-mcp-server@latest", "-y", "--tools", "${workspaceFolder}/tools"],
      "env": {
        "DB2i_HOST": "${input:db2iHost}",
        "DB2i_USER": "${input:db2iUser}",
        "DB2i_PASS": "${input:db2iPass}",
        "DB2i_PORT": "8076",
        "MCP_TRANSPORT_TYPE": "stdio"
      }
    }
  }
}

Multiple Environments

Configure dev and prod servers:
{
  "servers": {
    "ibmi-dev": {
      "type": "stdio",
      "command": "npx",
      "args": ["@ibm/ibmi-mcp-server@latest", "-y", "--tools", "/path/to/dev-tools"],
      "env": {
        "DB2i_HOST": "dev-ibmi.company.com",
        "DB2i_USER": "${input:devUser}",
        "DB2i_PASS": "${input:devPass}",
        "MCP_TRANSPORT_TYPE": "stdio"
      }
    },
    "ibmi-prod": {
      "type": "http",
      "url": "https://prod-mcp.company.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:PROD_MCP_TOKEN}"
      }
    }
  }
}

Custom Toolsets

Load specific toolsets for different workflows:
{
  "servers": {
    "ibmi-performance": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "@ibm/ibmi-mcp-server@latest", "-y",
        "--tools", "/path/to/tools",
        "--toolsets", "performance,monitoring"
      ],
      "env": {
        "DB2i_HOST": "your-ibmi-host.com",
        "DB2i_USER": "${input:db2iUser}",
        "DB2i_PASS": "${input:db2iPass}",
        "MCP_TRANSPORT_TYPE": "stdio"
      }
    }
  }
}

Next Steps

Additional Resources