# MCP Server

## Introduction

The Eraser MCP server connects AI coding agents to Eraser, letting them generate, create, read, search, and update files, diagrams, folders, and presets in your Eraser workspace – all through the [Model Context Protocol](https://modelcontextprotocol.io/).

The remote server is hosted at `https://app.eraser.io/api/mcp` and uses OAuth for authentication. When you first connect, your MCP client will open a browser window to authorize access to your Eraser account.

## Capabilities

- **AI diagram generation** – Describe a system, flow, or architecture in natural language and have your agent generate a complete Eraser diagram with full control over styling, color, typeface, and layout direction
- **AI diagram editing** – Iteratively edit existing diagrams with natural language instructions
- **Diagram export** – Render diagrams to PNG or JPEG with configurable theme, quality, and background
- **File management** – Create, list, read, update, search, and archive Eraser files with document and diagram content
- **Diagram management** – Create, read, update, and delete individual diagrams within files
- **Folder management** – Organize files into folders with full CRUD support
- **Preset management** – Create and manage AI presets with custom rules to control diagram generation style and behavior
- **Full-text search** – Search across files and diagrams in your workspace

## Authentication

The Eraser MCP server supports two authentication methods:

- **OAuth (recommended).** The default for the remote server, and what the setup instructions below use. No configuration needed – the first time your client connects, you'll be prompted to sign in with your Eraser account.
- **API key.** A token you pass explicitly. Use this for agentic pipelines, CI, and headless environments where no user is present to sign in, for clients that don't support OAuth (such as Microsoft Copilot Studio), or when actions should be attributed to your team rather than an individual. See [API key authentication](#api-key-authentication) below.

The two methods differ in billing and attribution: **OAuth** requests use the signed-in user's AI credits and are attributed to that user. **API key** requests use team-level credits and are attributed to the team.

## Installation and setup

The remote MCP server URL for all clients is:

```eraser
https://app.eraser.io/api/mcp
```

After adding the server, your client will prompt you to authenticate via OAuth in the browser. To authenticate with an API key instead, see [API key authentication](#api-key-authentication).

### Claude Code

```bash
claude mcp add --transport http eraser https://app.eraser.io/api/mcp
```

### Claude (claude.ai)

Open the [Eraser connector page](https://claude.ai/directory/connectors/eraser) and click Connect.

### Cursor

Add to your Cursor MCP config (`.cursor/mcp.json`):

```json
{
  "mcpServers": {
    "eraser": {
      "url": "https://app.eraser.io/api/mcp"
    }
  }
}
```

### Codex

**Using CLI**

```bash
codex mcp add eraser --url https://app.eraser.io/api/mcp
```

**Using Desktop App**

Open the Codex desktop app and go to Settings > MCP servers > Add server. Choose Streamable HTTP, then enter:

```eraser
Name: Eraser 
URL: https://app.eraser.io/api/mcp
```

### VS Code

Add to your VS Code MCP config (`.vscode/mcp.json`):

```json
{
  "inputs": [],
  "servers": {
    "eraser": {
      "url": "https://app.eraser.io/api/mcp",
      "type": "http"
    }
  }
}
```

### GitHub Copilot

Add to your VS Code `settings.json`:

```json
{
  "mcp": {
    "servers": {
      "eraser": {
        "url": "https://app.eraser.io/api/mcp",
        "type": "http"
      }
    }
  }
}
```

### Kiro

Add to your Kiro MCP config – `.kiro/settings/mcp.json` for a single workspace, or `~/.kiro/settings/mcp.json` to make it available across all workspaces:

```eraser
{
  "mcpServers": {
    "eraser": {
      "url": "https://app.eraser.io/api/mcp",
      "type": "http"
    }
  }
}
```

### Microsoft Copilot Studio

We recommend API key auth for Copilot Studio – see [API key authentication](#api-key-authentication) to generate a key.

1. Create or open an agent.
2. Go to **Tools** → **Add tool** → **New tool** → **Model Context Protocol**.
3. Fill in:
   - Server name: `Eraser MCP`
   - Server description: `Generate, edit, and manage Eraser diagrams and documents`
   - Server URL: `https://app.eraser.io/api/mcp`
   - Authentication: API key, with Type `Header` and Header name `Authorization`
4. Select **Create**, then open the Connection dropdown and select **Create new connection**.
5. In the connection field, paste your key with the `Bearer` prefix:

```eraser
   Bearer YOUR_API_KEY
```

6. Select **Create**, then **Add and configure**. The Eraser tools are now available to your agent.
7. Test the agent in the test panel to confirm the Eraser tools respond.
8. Select **Publish** and confirm.

#### Make available in Microsoft 365 Copilot

1. Go to the **Channels** tab and select **Microsoft 365 Copilot and Teams**.
2. Confirm **Make agent available in Microsoft 365 Copilot** is checked, use **Edit details** to set the display name, icon, and description, then **Save**.
3. **Save** again to submit for admin review.
4. Set availability: share directly with yourself or specific people and groups, or have an admin approve it to the org catalog.

The agent then appears in the Microsoft 365 Copilot app and Teams, where you select or @mention it in a chat.

## API key authentication

If OAuth doesn't fit your setup – pipelines, CI, clients without OAuth support – you can authenticate with an API key instead.

### Getting an API key

Obtain an API key from your [Eraser account settings](https://app.eraser.io/dashboard/all?settings=api-tokens). Treat it like a password – store it in a secrets manager or environment variable, not in checked-in config files.

### Remote server

Pass the key as a bearer token on the `Authorization` header.

**Claude Code**

```bash
claude mcp add --transport http eraser https://app.eraser.io/api/mcp \
  --header "Authorization: Bearer YOUR_API_KEY"
```

**Cursor, VS Code, and other JSON-configured clients**

Add a `headers` block to the server entry. For example, in Cursor's `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "eraser": {
      "url": "https://app.eraser.io/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}
```

The same `headers` block works in VS Code's `.vscode/mcp.json` and GitHub Copilot's `settings.json` alongside the existing `url` and `type` fields.

### Using an API key in CI

API keys let agents use Eraser in pipelines with no user present. For example, a GitHub Actions step that gives Claude Code access to Eraser:

```yaml
- name: Add Eraser MCP server
  run: |
    claude mcp add --transport http eraser https://app.eraser.io/api/mcp \
      --header "Authorization: Bearer ${{ secrets.ERASER_API_KEY }}"
```

Store the key as a repository or organization secret rather than hardcoding it in the workflow file.

## FAQ

**Is it free?**

Yes. The Eraser MCP server is free to use and subject to the same free tier limits as in-app usage.

**What can the Eraser MCP do?**

With the Eraser MCP, agents can generate diagrams and documents from natural language, create and manage files in your Eraser workspace, and read or update existing diagrams and documents. See [Capabilities](#capabilities) above for the full list.

**Which server and auth method should I use?**

The remote server with OAuth is recommended for most users. It requires no installation and authenticates securely via your Eraser account. [API key auth](#api-key-authentication) and the local server are better suited for agentic pipelines where users may not have their own Eraser accounts, or for environments that don't support OAuth.

**Does it support API key authentication?**

Yes. See [API key authentication](#api-key-authentication) for setup examples, and [Authentication](#authentication) for how billing and attribution differ from OAuth.

**Does it support a local MCP server?**

Yes. The local server is available as [`@eraserlabs/eraser-mcp`](https://www.npmjs.com/package/@eraserlabs/eraser-mcp) on npm and uses API key authentication. Replace `your_api_key` with your key from [Eraser account settings](https://app.eraser.io/dashboard/all?settings=api-tokens).

_Claude Code:_

```bash
claude mcp add eraser --env ERASER_API_KEY=your_api_key -- npx -y @eraserlabs/eraser-mcp
```

_Cursor / VS Code / GitHub Copilot_ – add to your MCP config:

```json
{
  "mcpServers": {
    "eraser": {
      "command": "npx",
      "args": ["-y", "@eraserlabs/eraser-mcp"],
      "env": {
        "ERASER_API_KEY": "your_api_key"
      }
    }
  }
}
```

**Where are files and diagrams saved?**

All files and diagrams are saved to your Eraser account and accessible from the Eraser app.

**Who can access files I've generated?**

With OAuth, files are created under your identity and are private by default. With an API key, files are created under the team and attributed to the team rather than an individual user. In either case, you can change the access level and link sharing settings at any time, either in the Eraser app or via the `update` tool.

**Does it use AI credits?**

Yes. Calls that involve AI generation will use AI credits from your Eraser account.

**Something missing?**

Reach out to the Eraser team at [hello@eraser.io](mailto:hello@eraser.io).
