> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open.cx/llms.txt
> Use this file to discover all available pages before exploring further.

# Visual Studio Code

> Set up and use the OpenCX MCP server in Visual Studio Code with GitHub Copilot and mcp.json.

Visual Studio Code supports <Tooltip tip="An open standard that lets AI assistants interact with external tools and data sources.">MCP</Tooltip> servers through a dedicated `mcp.json` file. MCP tools are available when you use **GitHub Copilot** agent features (Copilot Chat with tool use).

<Note>
  You need [GitHub Copilot](https://github.com/features/copilot) and a recent VS
  Code build with MCP support. See [Add and manage MCP servers in VS
  Code](https://code.visualstudio.com/docs/copilot/customization/mcp-servers)
  for the latest UI flows.
</Note>

## Setup

<Steps>
  <Step title="Open MCP configuration">
    Open the Command Palette (**Shift+Command+P** on macOS, **Ctrl+Shift+P** on Windows or Linux) and run **MCP: Open User Configuration** for a personal server, or **MCP: Open Workspace Folder MCP Configuration** to store config in `.vscode/mcp.json` for the current project.
  </Step>

  <Step title="Add the OpenCX server">
    Paste this into `mcp.json`:

    ```json theme={"dark"}
    {
      "servers": {
        "opencx": {
          "type": "stdio",
          "command": "npx",
          "args": ["-y", "@opencx/mcp"],
          "env": {
            "OPENCX_API_KEY": "your-api-key-here"
          }
        }
      }
    }
    ```

    Replace `your-api-key-here` with your [OpenCX API key](https://platform.open.cx/settings/access).

    For secrets you prefer not to store in the file, use [input variables](https://code.visualstudio.com/docs/copilot/reference/mcp-configuration) (for example `${input:opencx-api-key}`) and define the corresponding `inputs` entry in the same `mcp.json`.

    <Tip>
      Prefer zero install? Use the [hosted endpoint](/mcp/install#remote-server-no-install) instead — same tools, no Node.js required:

      ```json theme={"dark"}
      {
        "servers": {
          "opencx": {
            "type": "http",
            "url": "https://api.open.cx/mcp",
            "headers": {
              "Authorization": "Bearer your-api-key-here"
            }
          }
        }
      }
      ```
    </Tip>
  </Step>

  <Step title="Trust and start the server">
    When VS Code starts the server for the first time, confirm any trust prompts.
    Use the **MCP: List Servers** command to see status, logs, and restart
    options.
  </Step>

  <Step title="Verify in Copilot Chat">
    Open Copilot Chat in agent mode and ask: *"List my recent chat sessions."*
  </Step>
</Steps>

## Workspace vs user config

| Location      | Path                                        | Best for                                                           |
| ------------- | ------------------------------------------- | ------------------------------------------------------------------ |
| **Workspace** | `.vscode/mcp.json`                          | Team-shared setup (omit secrets from git; use inputs or `envFile`) |
| **User**      | Opened via **MCP: Open User Configuration** | Personal OpenCX access across all folders                          |

## Debugging

1. Run **MCP: List Servers** and select **opencx** to view output and errors.
2. Confirm **Node.js 18+** is on your PATH in the same environment VS Code uses (`node --version` in the integrated terminal).
3. If tools never appear, confirm Copilot Chat is using a model and mode that supports tools (see [Use agent mode](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode)).

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Get Started" icon="download" href="/mcp/install">
    API key setup and all client configs
  </Card>

  <Card title="Cursor" icon="text-slash" href="/mcp/clients/cursor">
    Similar editor-native MCP setup
  </Card>

  <Card title="Prompt Library" icon="message" href="/mcp/prompts">
    Ready-to-use prompts by domain
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/mcp/troubleshooting">
    Common issues and fixes
  </Card>
</CardGroup>
