# Install the local Mux MCP Server

Run the Mux MCP server locally on your machine. Use this guide when your AI client does not support remote MCP servers or when you must restrict the tools the server can run.

<Callout type="info">
  If you just want to get started quickly, and to read more about how the server works, check out [Using the Mux MCP Server](/docs/integrations/mcp-server). This guide covers running the Mux MCP Server locally on your machine and connecting it to various AI clients.
</Callout>

The Mux MCP ([Model Context Protocol](https://modelcontextprotocol.io/introduction)) Server brings Mux's Video and Data platform capabilities directly to your AI tools. Once installed, you can upload videos, manage live streams, analyze video performance, and access practically all of Mux's video infrastructure through natural language prompts in supported AI clients.

The server is published to npm as [`@mux/mcp`](https://www.npmjs.com/package/@mux/mcp) and runs with `npx` — there's nothing to build or clone. Running locally (instead of using the hosted server at `https://mcp.mux.com`) is useful when your client doesn't support remote MCP servers, or when you want to restrict which tools and SDK methods the server is allowed to run.

## How it works: Code Mode

The Mux MCP server uses the "Code Mode" tool scheme. Instead of exposing hundreds of individual endpoint tools, it exposes just two tools to your agent: `search_docs` for searching Mux's documentation, and `execute`, which runs TypeScript written by your agent against the full Mux SDK, [`@mux/ts`](https://www.npmjs.com/package/@mux/ts). When you run the server locally, `execute` runs code on your own machine in an isolated [Deno](https://deno.com/) sandbox whose network access is limited to the Mux hosts the SDK calls.

## Prerequisites

Before installing the Mux MCP Server, make sure you meet the following prerequisites:

* Node.js installed locally on your machine (instructions available [here](https://nodejs.org/en/download))
* Deno 2.9 or newer. `@mux/mcp` installs Deno for itself through an optional npm dependency. Where that can't install (a blocked binary download, `npm install --omit=optional`, or a platform without an npm build of Deno, such as Alpine), [install Deno](https://docs.deno.com/runtime/getting_started/installation/) yourself and set `DENO_PATH` to the Deno executable.
* A Mux account (sign up at [mux.com](https://mux.com/) if you don't have one)
* Your Mux API access token and secret key from the [Mux Dashboard](https://dashboard.mux.com/settings/access-tokens) (detailed instructions are available below)
* Claude Desktop, Cursor, VS Code, or any other client that supports local MCP servers, installed and updated to the latest version

## Installation

### Get your Mux API credentials and configure access

1. Log into your [Mux Dashboard](https://dashboard.mux.com/)
2. Navigate to Settings → Access Tokens
3. Generate a new access token or use an existing one
4. Copy your **Access Token ID** and **Secret Key** — you'll need both for the configuration

#### Required scopes

* Your Mux access token should be configured for your desired environment. Give it Read and Write permissions, or only Read if the agent shouldn't change anything
* We recommend clearly labeling this access token in Mux, for example: `MCP Access Token`

The two required environment variables are `MUX_TOKEN_ID` and `MUX_TOKEN_SECRET`. A few optional variables unlock additional functionality:

| Variable | Required | Used for |
| --- | --- | --- |
| `MUX_TOKEN_ID` | Yes | Access Token ID |
| `MUX_TOKEN_SECRET` | Yes | Secret Key |
| `MUX_WEBHOOK_SECRET` | No | Verifying and unwrapping webhook payloads |
| `MUX_SIGNING_KEY` | No | JWT signing key ID for signed playback |
| `MUX_PRIVATE_KEY` | No | JWT private key for signed playback |
| `MUX_AUTHORIZATION_TOKEN` | No | Pre-built authorization token (alternative to token ID/secret) |
| `DENO_PATH` | No | Path to a Deno 2.9 or newer executable, used when the bundled Deno can't install |

**Important:** Replace the placeholder values when adding to your AI client's config using the templates provided below:

* Replace `your_access_token_id` with your actual Mux Access Token ID
* Replace `your_secret_key` with your actual Mux Secret Key

<Callout type="info">
  **Note:** If you're using a tool that manages Node versions like Mise, you'll probably need to make sure you execute the `npx` commands found in the following examples from within that context. An example Mise command could look something like this:

  `mise x node@22 -- npx -y @mux/mcp@latest`

  Accordingly, the following examples would need to be changed similarly to below:

  ```json
        "command": "mise",
        "args": ["x", "node@22", "--", "npx", "-y", "@mux/mcp@latest"],
  ```
</Callout>

### For Claude

* You must use Claude's Desktop app to install local MCP servers.

We support the [Claude Desktop Extensions](https://www.anthropic.com/engineering/desktop-extensions) format, so you can download the `mux.mcpb` asset from the [latest mux-ts release](https://github.com/muxinc/mux-ts/releases/latest) and open it with Claude Desktop to install it. The bundle doesn't include Deno, so [install Deno](https://docs.deno.com/runtime/getting_started/installation/) 2.9 or newer first, then set the bundle's `DENO_PATH` setting to the Deno executable (the output of `which deno` on macOS/Linux). Once that and your Mux credentials are configured, you're good to go.

If you'd like to configure it manually, follow the next steps.

#### Step A: Configure Claude Desktop

Follow [Claude's instructions](https://docs.anthropic.com/en/docs/agents-and-tools/mcp) to locate your Claude Desktop configuration file on your machine.

**macOS/Linux:**

```
~/Library/Application\ Support/Claude/claude_desktop_config.json
```

**Windows:**

```
%APPDATA%\Claude\claude_desktop_config.json
```

#### Step B: Add the MCP Server configuration

Add this configuration block to your `claude_desktop_config.json` file:

```json
{
  "mcpServers": {
    "mux": {
      "command": "npx",
      "args": ["-y", "@mux/mcp@latest"],
      "env": {
        "MUX_TOKEN_ID": "your_access_token_id",
        "MUX_TOKEN_SECRET": "your_secret_key"
      }
    }
  }
}
```

#### Step C: Restart Claude Desktop

Close and reopen Claude Desktop to load the new MCP server configuration.

### For Claude Code

You can add the server from your terminal with the `claude mcp add` command:

```sh
claude mcp add mux --env MUX_TOKEN_ID="your_access_token_id" MUX_TOKEN_SECRET="your_secret_key" -- npx -y @mux/mcp@latest
```

### For Cursor

#### Step A: Locate the settings file

Follow the paths below to locate your Cursor MCP configuration file. If the file does not exist, you can create it.

**macOS/Linux:**

```
~/.cursor/mcp.json
```

**Windows:**

```
C:/Users/<username>/.cursor/mcp.json
```

#### Step B: Add the MCP Server configuration

```json
{
  "mcpServers": {
    "mux": {
      "command": "npx",
      "args": ["-y", "@mux/mcp@latest"],
      "env": {
        "MUX_TOKEN_ID": "your_access_token_id",
        "MUX_TOKEN_SECRET": "your_secret_key"
      }
    }
  }
}
```

### For VS Code

VS Code reads MCP servers from an `mcp.json` file. To add the server to all of your workspaces, open your user configuration from the Command Palette with `MCP: Open User Configuration`. To add it to a single workspace, use `.vscode/mcp.json` in that workspace instead, and keep your credentials out of version control.

#### Step A: Add the MCP Server configuration

Add the server under `"servers"`:

```json
{
  "servers": {
    "mux": {
      "command": "npx",
      "args": ["-y", "@mux/mcp@latest"],
      "env": {
        "MUX_TOKEN_ID": "your_access_token_id",
        "MUX_TOKEN_SECRET": "your_secret_key"
      }
    }
  }
}
```

#### Step B: Start the MCP Server

In VS Code, make sure to click on the `Start` button for the MCP Server to start it. You can do this directly from the `mcp.json` file, or from the Command Palette with `MCP: List Servers`.

## Limiting tools and methods

By default the server exposes both tools and allows every SDK method. To change this, add flags after `@mux/mcp@latest`, either in your client's `args` array or at the end of the `claude mcp add` command.

| Flag | Values | Description |
| --- | --- | --- |
| `--no-tools` | `code`, `docs` | Disable a tool. `--no-tools=code` gives a docs-only server, and `--no-tools=docs` gives a code-only server |
| `--code-allow-http-gets` | — | Allow methods that make HTTP GET requests, which makes the server read-only. This also blocks `webhooks.unwrap`, which makes no request; see below to allow it |
| `--code-allowed-methods` | regex | Allow methods whose fully qualified name matches, such as `video.assets.create` |
| `--code-blocked-methods` | regex | Block methods whose fully qualified name matches, even if an allow flag allows them |

Pass values with `=`, as in `--no-tools=code`. Repeat a flag to pass more than one value.

### Restricting SDK methods

With no method flags, every method is allowed. Once you set either allow flag, only the methods they allow are available, and the two allow flags add together. `--code-blocked-methods` then removes methods from whatever is allowed. Every delete method has `delete` in its name, so `delete` is enough to block them all.

Read-only:

```json
"args": ["-y", "@mux/mcp@latest", "--code-allow-http-gets"]
```

Read-only, plus unwrapping webhooks:

```json
"args": ["-y", "@mux/mcp@latest", "--code-allow-http-gets", "--code-allowed-methods=^webhooks.unwrap$"]
```

Read-only, plus creating direct uploads:

```json
"args": ["-y", "@mux/mcp@latest", "--code-allow-http-gets", "--code-allowed-methods=video.uploads.create"]
```

Assets only, without deletes:

```json
"args": ["-y", "@mux/mcp@latest", "--code-allowed-methods=^video.assets.", "--code-blocked-methods=delete"]
```

Everything except deletes:

```json
"args": ["-y", "@mux/mcp@latest", "--code-blocked-methods=delete"]
```

<Callout type="warning">
  Method flags keep an agent on task, but they aren't a security boundary: the server looks for method names in the code's text, so code that builds a method name at runtime gets past them. To guarantee the server can't change anything, give it an access token with only Read permissions.
</Callout>

See the [`@mux/mcp` README](https://github.com/muxinc/mux-ts/blob/main/packages/mcp-server/README.md) for the full list of flags.

## Verify installation

Test that the Mux MCP Server is working by asking your AI client:

> Give me the details for the most recently created Mux Video asset (using the Mux tool)

or

> Using the Mux MCP, list the best performing countries for video streaming over the last month using Mux Data

If the installation was successful, your client will connect to the Mux API through the MCP server and return information about your video performance or assets.

## Troubleshooting

**Build issues**

If you encounter errors when the server starts up:

* Make sure you have a supported Node.js version installed, and that `npx` is accessible in your PATH (`npx -v`)

**Deno issues**

A missing or too-old Deno is the most common local failure. The server still starts and `search_docs` still works, but every `execute` call fails with an error saying code execution needs Deno 2.9 or newer. To fix it:

* If the bundled Deno couldn't install (`--omit=optional`, a blocked download, or a platform like Alpine), [install Deno](https://docs.deno.com/runtime/getting_started/installation/) yourself
* Check your Deno version with `deno --version` and upgrade with `deno upgrade` if it's older than 2.9
* Set `DENO_PATH` in your client's `env` block to the absolute path of the Deno executable (the output of `which deno`). MCP clients often launch servers without your shell's `PATH`
* In the Claude Desktop `.mcpb` bundle, set the bundle's `DENO_PATH` setting

**Connection issues**

If your client can't connect to the MCP server:

* Verify your Mux credentials are correct and properly formatted
* Make sure there are no extra spaces or characters in your token values
* Confirm your API tokens have the necessary permissions in your Mux account

**Claude Desktop issues**

If MCP features don't appear in Claude:

* Ensure you're using the latest version of Claude Desktop — older versions may not support MCP
* Verify your JSON configuration is valid (no missing commas or brackets)
* Check that Claude Desktop has restarted completely after configuration changes

## Getting help

If you run into issues or have questions:

* Check the [Model Context Protocol documentation](https://modelcontextprotocol.io/quickstart/user) for general MCP setup guidance
* Review [Claude's MCP documentation](https://docs.anthropic.com/en/docs/agents-and-tools/mcp) for Claude-specific configuration
* Visit our [API reference](https://docs.mux.com/api-reference) for detailed endpoint documentation
* Contact support: [mux.com/support](/support)
