# Solana MCP server

## MCP server

An MCP server that gives coding agents and chat clients read access to Carbium: RPC and DAS reads, quotes and prices, unsigned swap and DCA transactions, token data and account usage.

`@carbium/mcp` is an MCP server that gives an AI client Carbium's RPC, DAS, quote, swap, DCA, token, docs and account tools, built on `@carbium/sdk`. It needs Node.js 22.12 or later and an MCP client. A service key in `CARBIUM_KEY` adds the chain tools.

### Run it

The server speaks MCP over stdio, so your MCP client starts it, and it writes its logs to stderr. With no key it lists the three keyless tools: `carbium_docs_search`, `carbium_tokens` and `carbium_dca`.

```
npx -y @carbium/mcp
# stderr: carbium-mcp: v0.1.0; service key none; account key none; writes off
```

### Claude Code

This command adds the server to Claude Code. The service key comes from your shell's `CARBIUM_KEY` when the command runs.

```
claude mcp add carbium --env CARBIUM_KEY="$CARBIUM_KEY" -- npx -y @carbium/mcp
```

### Claude Desktop

Add the entry to `claude_desktop_config.json`, found in `~/Library/Application Support/Claude/` on macOS, `%APPDATA%\Claude\` on Windows and `~/.config/Claude/` on Linux. This file does not expand variables, so you write the key into it in place of the placeholder.

```
{
  "mcpServers": {
    "carbium": {
      "command": "npx",
      "args": ["-y", "@carbium/mcp"],
      "env": { "CARBIUM_KEY": "<your c_serv_ key>" }
    }
  }
}
```

### Cursor

Cursor reads `~/.cursor/mcp.json`, or `.cursor/mcp.json` in a project. A variable from your environment is written `${env:NAME}`.

```
{
  "mcpServers": {
    "carbium": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@carbium/mcp"],
      "env": { "CARBIUM_KEY": "${env:CARBIUM_KEY}" }
    }
  }
}
```

### VS Code

VS Code with Copilot reads `.mcp.json` at the workspace root or `~/.copilot/mcp-config.json`. An existing `.vscode/mcp.json` takes the same entry under a top-level `servers` key, with the variable written `${env:CARBIUM_KEY}`.

```
{
  "mcpServers": {
    "carbium": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@carbium/mcp"],
      "env": { "CARBIUM_KEY": "${CARBIUM_KEY}" },
      "tools": ["*"]
    }
  }
}
```

### Codex

Codex reads `~/.codex/config.toml`. `env_vars` passes `CARBIUM_KEY` through from your environment.

```
[mcp_servers.carbium]
command = "npx"
args = ["-y", "@carbium/mcp"]
env_vars = ["CARBIUM_KEY"]
```

### Container

The image runs the same server over stdio as a non-root user and works with `--read-only`. Pass `-i` and never `-t`, and add `-e CARBIUM_ACCOUNT_KEY` for the account tools.

```
docker run -i --rm -e CARBIUM_KEY ghcr.io/carbium-sh/carbium-mcp:0.1.0
```

### Tools

The server lists a tool only when it has the key that tool needs.

- `carbium_docs_search` searches carbium.sh/skill.md and llms.txt for methods, limits, errors and retry rules. No key.
- `carbium_tokens` looks up token names, symbols, decimals, logos and volume with lookup, search, batch and image_url. No key.
- `carbium_dca` reads DCA quotes, positions, history and health, and builds one unsigned transaction for the owner's wallet with build_open, build_update, build_withdraw and build_close. No key.
- `carbium_rpc` calls any served Solana JSON-RPC read method by name with positional params. `sendTransaction` is not offered. Service key.
- `carbium_das` calls the DAS methods with one params object. Service key.
- `carbium_swap` returns a quote, prices or health, and build returns one unsigned swap transaction for `user_pubkey`. Service key with the quote scope.
- `carbium_account` reads whoami, overview, balance, keys_list, usage_daily, usage_per_key, usage_load, usage_hourly, usage_latency, webhooks_list, webhook_get, webhook_deliveries, modules, invoices, payments, crypto_intent and activity. Account key.
- `carbium_account_write` pauses, resumes and tests webhooks, sets key caps, limits, scope and allowlist, and enables a free module plan. Listed with an account key when writes are turned on; a call needs a key with full access.

```
# Service key (c_serv_...): carbium_rpc, carbium_das, carbium_swap
export CARBIUM_KEY="<your c_serv_ key>"
# Account API key (c_acct_...): carbium_account
export CARBIUM_ACCOUNT_KEY="<your c_acct_ key>"
# Lists carbium_account_write; a read-only account key is still refused
export CARBIUM_MCP_ALLOW_WRITES=1
```

### Safety

The server is read-only by default. No tool signs, sends or moves funds, and the swap and DCA tools return one unsigned transaction for the user's own wallet to sign. Every answer is marked as untrusted data, keys are redacted from all output, and the write tool is listed only with `CARBIUM_MCP_ALLOW_WRITES=1` and an account key. A call made with a read-only account key is refused.

```
claude mcp add carbium --env CARBIUM_ACCOUNT_KEY="$CARBIUM_ACCOUNT_KEY" --env CARBIUM_MCP_ALLOW_WRITES=1 -- npx -y @carbium/mcp
```

[@carbium/mcp on npm](https://www.npmjs.com/package/@carbium/mcp) · [Source on GitHub](https://github.com/carbium-sh/carbium-js/tree/main/packages/mcp) · [Agent plugin for Claude Code, Cursor and Codex](https://carbium.sh/sdk#plugins) · [Model Context Protocol specification](https://modelcontextprotocol.io/specification)
