> For the complete documentation index, see [llms.txt](https://docs.fastn.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fastn.ai/build/building-from-your-ai-agent/mcp-gateway/vscode.md).

# VS Code

Add fastn to VS Code in one click and use it from GitHub Copilot's agent mode.

VS Code runs fastn as an MCP server for GitHub Copilot's **Agent** mode. Add it once from fastn, sign in, then ask Copilot for the integration in the Chat panel.

{% hint style="info" %}
**Before you start:** you need VS Code with GitHub Copilot signed in. MCP servers are only used in Copilot's **Agent** mode, not in Ask or Edit.
{% endhint %}

## Add fastn

{% stepper %}
{% step %}

#### Click Install in VS Code

In fastn, click **Connect AI tools** in the top bar (or open **Embed → API keys and MCP** → **MCP server**), pick the **VS Code** tile and click **Install in VS Code**. When your browser asks to open Visual Studio Code, allow it.

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2Fgit-blob-db0da8f2e127277ac4532d6d4444024711fc147b%2Fmcp-fastn-tab-vscode.webp?alt=media" alt="fastn&#x27;s MCP server page with the VS Code tile selected, showing an Install in VS Code button, a note that VS Code keys this object servers not mcpServers, a code --add-mcp command and a .vscode/mcp.json snippet"><figcaption><p>The VS Code tile also has a command and a file, if you prefer those.</p></figcaption></figure>
{% endstep %}

{% step %}

#### Install the server

VS Code opens an **MCP Server: fastn** page with the URL `https://mcp.fastn.dev/fastn-workspace`. Click **Install** to add fastn for all your projects, or **Install in Workspace** to add it to the open folder only.

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2Fgit-blob-ec2f02876d9f2922464827036eaec4b343268a0c%2Fmcp-vscode-install.webp?alt=media" alt="VS Code&#x27;s MCP Server: fastn page with Install and Install in Workspace buttons, and a configuration showing Name fastn, Type http and URL https://mcp.fastn.dev/fastn-workspace"><figcaption><p><strong>Install</strong> writes fastn to your user <code>mcp.json</code>; <strong>Install in Workspace</strong> writes <code>.vscode/mcp.json</code> in the folder.</p></figcaption></figure>
{% endstep %}

{% step %}

#### Start it and sign in

Installing does not start the server. Press **Cmd+Shift+P** (**Ctrl+Shift+P** on Windows and Linux), run **MCP: List Servers**, pick **fastn** and choose **Start Server**.

The first time, VS Code asks to let fastn authenticate. Click **Allow**. fastn opens in your browser: sign in and, if you belong to more than one fastn org, pick the workspace VS Code works in and click **Connect**.

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2Fgit-blob-ce4a029e77bf0db4ac2255b9bfc94edd63c45d0e%2Fmcp-vscode-choose-workspace.webp?alt=media" alt="fastn&#x27;s page titled Which workspace should Visual Studio Code (vscode.dev) use?, with The org selected in fastn chosen, a list of orgs and a Connect button"><figcaption><p><strong>The org selected in fastn</strong> follows whichever org you have open in the fastn dashboard; picking a named org pins VS Code to it.</p></figcaption></figure>

The browser then hands you back to VS Code.

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2Fgit-blob-cdaadb4b6cb2902d848fb85e413cfdc9c7924559%2Fmcp-vscode-signin-done.webp?alt=media" alt="A browser page reading Sign-in successful! Returning to Visual Studio Code... If you&#x27;re not redirected automatically, click here or close this page."><figcaption><p>You can close this tab.</p></figcaption></figure>

If you signed in to fastn from VS Code before, the server starts without asking. **MCP: List Servers** then shows fastn as **Running**.
{% endstep %}
{% endstepper %}

## Use it

1. Open the Chat panel and set the mode to **Agent**.
2. Click the tools icon in the chat box and check that **fastn** is ticked.
3. Ask for the outcome in one sentence. To check the connection first, ask *Who am I in fastn?*
4. Copilot asks before it runs a fastn tool. Click **Allow** (or **Continue**).

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2Fgit-blob-76b6e2bf398b9eb47e4756218efe58b4ec465f64%2Fmcp-vscode-agent-answer.webp?alt=media" alt="Copilot&#x27;s chat in VS Code answering the question Who am I in fastn after completing 6 steps, naming the signed-in user, their role and the fastn organization it is acting in"><figcaption><p>Copilot answers with the fastn org you picked when signing in.</p></figcaption></figure>

From here Copilot works through the same steps as every agent: see [Building from your AI agent](https://docs.fastn.ai/build/building-from-your-ai-agent.md).

## Add it by hand

Instead of the button, run this from a terminal:

```
code --add-mcp "{\"name\":\"fastn\",\"type\":\"http\",\"url\":\"https://mcp.fastn.dev/fastn-workspace\"}"
```

Or add fastn to `.vscode/mcp.json` in a project. VS Code's key is `servers`, not `mcpServers`:

```json
{
  "servers": {
    "fastn": {
      "type": "http",
      "url": "https://mcp.fastn.dev/fastn-workspace"
    }
  }
}
```

## Troubleshooting

* **fastn is installed but Copilot never uses it.** Check the chat is in **Agent** mode and that fastn is ticked under the tools icon. Then run **MCP: List Servers** and make sure fastn is **Running**.
* **The list shows servers you did not add, or asks you to pick an MCP server "for this session".** That is a GitHub Copilot CLI session, which reads its own config (`~/.copilot/mcp-config.json`). Start a local chat instead.
* **Copilot works on the wrong org.** Run **MCP: List Servers** → **fastn** → **Stop Server**, sign out of fastn from the **Accounts** menu (bottom left), then start the server again and pick the workspace.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fastn.ai/build/building-from-your-ai-agent/mcp-gateway/vscode.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
