Skip to main content

💻 VS Code / GitHub Copilot Installation

Set up Code Scalpel with Visual Studio Code and GitHub Copilot's MCP support.

Prerequisites

  • VS Code 1.85+ installed
  • GitHub Copilot extension installed and active
  • Python 3.10+ installed
  • uv or pip package manager

1Install Code Scalpel

# Test that uvx works
uvx codescalpel --version
pip install codescalpel
codescalpel --version

2Configure VS Code

Option A: User Settings (All Projects)

  1. Open VS Code
  2. Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS)
  3. Type "Preferences: Open User Settings (JSON)"
  4. Add the MCP server configuration:
{
  "mcp.servers": {
    "code-scalpel": {
      "command": "uvx",
      "args": ["codescalpel", "mcp"]
    }
  }
}

Option B: Workspace Settings (Project-Specific)

For project-specific configuration, create or edit .vscode/settings.json:

{
  "mcp.servers": {
    "code-scalpel": {
      "command": "uvx",
      "args": ["codescalpel", "mcp"]
    }
  }
}

Option C: Using pip Installation

If you installed with pip, use the full Python path:

{
  "mcp.servers": {
    "code-scalpel": {
      "command": "/path/to/python",
      "args": ["-m", "code_scalpel"]
    }
  }
}

💡 Find Your Python Path

# macOS/Linux
which python

# Windows
where python

3Reload VS Code

After saving the configuration:

  1. Press Ctrl+Shift+P / Cmd+Shift+P
  2. Type "Developer: Reload Window"
  3. Press Enter

4Verify Installation

Check MCP Server Status

  1. Open the Output panel (Ctrl+Shift+U / Cmd+Shift+U)
  2. Select "MCP" from the dropdown
  3. Look for "code-scalpel" server status

Test with Copilot

Open Copilot Chat and try:

Test Prompt

"Use Code Scalpel to analyze the structure of the current file"

You should see Copilot invoke the analyze_code tool.

Advanced Configuration

With Environment Variables

{
  "mcp.servers": {
    "code-scalpel": {
      "command": "uvx",
      "args": ["codescalpel", "mcp"],
      "env": {
        "CODE_SCALPEL_LICENSE_PATH": "${workspaceFolder}/.code-scalpel/license.jwt"
      }
    }
  }
}

With Working Directory

{
  "mcp.servers": {
    "code-scalpel": {
      "command": "uvx",
      "args": ["codescalpel", "mcp"],
      "cwd": "${workspaceFolder}"
    }
  }
}

Multiple Workspaces

For multi-root workspaces, add to each workspace's settings:

{
  "folders": [
    { "path": "frontend" },
    { "path": "backend" }
  ],
  "settings": {
    "mcp.servers": {
      "code-scalpel": {
        "command": "uvx",
        "args": ["codescalpel", "mcp"]
      }
    }
  }
}

Using Code Scalpel in VS Code

In Copilot Chat

Ask Copilot to use specific Code Scalpel tools:

@workspace Use Code Scalpel's security_scan to check src/auth.py for vulnerabilities
@workspace Extract the UserService class using Code Scalpel

In Inline Chat

Select code and press Ctrl+I / Cmd+I:

Analyze this function with Code Scalpel and suggest improvements

Common Workflows

Task Prompt
Analyze file structure "Use analyze_code on this file"
Find security issues "Run security_scan on this code"
Extract a function "Use extract_code to get the process_order function"
Check dependencies "Use get_cross_file_dependencies for this module"

Troubleshooting

MCP server fails to start
  1. Check the Output panel → MCP for error messages
  2. Verify the command works in terminal:
    uvx codescalpel --version
  3. Use absolute paths if relative paths fail
Copilot doesn't use Code Scalpel tools
  1. Make sure you explicitly ask for Code Scalpel tools
  2. Reload VS Code window after config changes
  3. Check that GitHub Copilot extension is active
File not found errors
  1. Use ${workspaceFolder} in paths
  2. Ensure you have the folder open in VS Code
  3. Try using absolute file paths
Permission errors on macOS
  1. Go to System Preferences → Security & Privacy → Privacy
  2. Add VS Code to Full Disk Access
  3. Restart VS Code

VS Code Variables

You can use these variables in your configuration:

Variable Description
${workspaceFolder} Root of the current workspace
${workspaceFolderBasename} Folder name without path
${file} Current open file
${fileBasename} Current filename
${env:VAR_NAME} Environment variable

Next Steps

🚀 What's Next