# VS Code

The MCP server works with [<mark style="color:blue;">VS Code</mark>](https://code.visualstudio.com) through [<mark style="color:blue;">GitHub Copilot</mark>](https://github.com/features/copilot)'s MCP support in agent mode.

## Prerequisites

* [<mark style="color:blue;">VS Code</mark>](https://code.visualstudio.com) with the [<mark style="color:blue;">GitHub Copilot</mark>](https://github.com/features/copilot) extension (version 0.22 or later)
* The `ionoscloud-mcp` binary built and available. For more information, see [<mark style="color:blue;">Quick Start</mark>](/cloud/ai/mcp-server/quick-start.md)
* An <code class="expression">space.vars.ionos\_cloud\_api</code> token. For least-privilege access, see [<mark style="color:blue;">Authentication</mark>](/cloud/ai/mcp-server/configuration/authentication.md#token-scope-by-product-area) to scope the token to only the tools you need.

## Add the MCP server

Create or edit `.vscode/mcp.json` in your workspace. The `"type": "stdio"` field tells VS Code to run the server as a local process communicating over standard input/output; just enter it as shown:

```json
{
  "servers": {
    "ionoscloud": {
      "type": "stdio",
      "command": "/usr/local/bin/ionoscloud-mcp",
      "env": {
        "IONOS_TOKEN": "your-api-token"
      }
    }
  }
}
```

To also enable Object Storage tools, add your Object Storage credentials:

```json
{
  "servers": {
    "ionoscloud": {
      "type": "stdio",
      "command": "/usr/local/bin/ionoscloud-mcp",
      "env": {
        "IONOS_TOKEN": "your-api-token",
        "IONOS_S3_ACCESS_KEY": "your-access-key",
        "IONOS_S3_SECRET_KEY": "your-secret-key"
      }
    }
  }
}
```

For a user-wide configuration that applies to all workspaces, open VS Code settings (`Ctrl+Shift+P` > **Open User Settings JSON**) and add the same `servers` block under the key `"mcp"`.

## Verify the connection

{% stepper %}
{% step %}

### Open Copilot Chat in agent mode

Open Copilot Chat and switch to **Agent** mode using the mode selector in the Copilot Chat panel.
{% endstep %}

{% step %}

### Test the connection

Type: *List my* <code class="expression">space.vars.ionos\_cloud</code> *data centers.*

{% hint style="success" %}
**Result:** Copilot responds with a list of your data centers: names, locations, and IDs.
{% endhint %}

If Copilot responds that it cannot access that information, check [<mark style="color:blue;">Troubleshooting</mark>](/cloud/ai/mcp-server/troubleshooting.md).
{% endstep %}
{% endstepper %}

{% hint style="info" %}
**Note:** All tools are registered at startup by default, so Compute Engine and Object Storage tools appear immediately. To reduce the startup tool count (for example, on clients with a tool-count cap), set `IONOS_MCP_LOAD_MODE=lazy` in the `env` block and call the `ionos_load_compute_tools` or `ionos_load_objectstorage_tools` sentinels on demand. For more information, see [<mark style="color:blue;">Selective Tool Loading</mark>](/cloud/ai/mcp-server/configuration/selective-tool-loading.md).
{% endhint %}

For full VS Code MCP documentation, see [<mark style="color:blue;">Add and manage MCP servers in VS Code</mark>](https://code.visualstudio.com/docs/copilot/customization/mcp-servers).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/cloud/ai/mcp-server/connect-to-an-ai-client/vs-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
