---
title: "Connect VS Code to Narwhal MCP | Narwhal API"
description: "Add Narwhal's hosted Streamable HTTP MCP server to Visual Studio Code and sign in with your Narwhal account."
url: "https://narwhalapi.com/docs/mcp/vscode"
---

# Connect VS Code to Narwhal MCP

Add Narwhal's hosted Streamable HTTP MCP server to Visual Studio Code and sign in with your Narwhal account.

Visual Studio Code supports remote HTTP MCP servers in `.vscode/mcp.json`. Add the Narwhal server and sign in with your Narwhal account.

## Configure VS Code

Choose Install in VS Code. VS Code opens and asks you to confirm the Narwhal server.

[Install in VS Code](vscode:mcp/install?%7B%22name%22%3A%22narwhal%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fapi.narwhalapi.com%2Fmcp%22%7D)

When VS Code starts the server, it asks you to sign in. Choose Connect, sign in with your Narwhal account, and choose Allow on the Narwhal consent screen.

To add the server by hand instead, open `MCP: Open Workspace Folder MCP Configuration` from the Command Palette and add:

.vscode/mcp.json

```
{
  "servers": {
    "narwhal": {
      "type": "http",
      "url": "https://api.narwhalapi.com/mcp"
    }
  }
}
```

If your client cannot sign in, use your API key instead. Replace the entry with this configuration:

.vscode/mcp.json

```
{
  "inputs": [
    {
      "type": "promptString",
      "id": "NARWHAL_API_KEY",
      "description": "Narwhal API Bearer key",
      "password": true
    }
  ],
  "servers": {
    "narwhal": {
      "type": "http",
      "url": "https://api.narwhalapi.com/mcp",
      "headers": {
        "Authorization": "Bearer ${input:NARWHAL_API_KEY}"
      }
    }
  }
}
```

When VS Code prompts for `NARWHAL_API_KEY`, enter the key through the input prompt. Keep the file itself free of credentials. See [VS Code's MCP server guide](https://code.visualstudio.com/docs/agent-customization/mcp-servers) for current client behavior.

## Verify the connection

Open the client's MCP server list and confirm that `narwhal` is connected. In the Command Palette, run `MCP: List Servers`.

Then ask the client to list the available Narwhal tools. Tool discovery costs nothing; each successful `tools/call` costs one call at the price of its API.

Use the [main MCP guide](https://narwhalapi.com/docs/mcp.md) for the public tool list, arguments, response shape and credit rules.

## Keep the key private

If you use an API key, use Cursor's or VS Code's secure variable/input storage for the placeholder. Do not commit a real key to `mcp.json`, paste it into a prompt, put it in a URL, or expose it in browser code.

Every request requires the `Authorization: Bearer` header. See the [authentication guide](https://narwhalapi.com/docs/authentication.md) for key storage and rotation.

Was this page helpful?
