> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usegradient.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP

> Drive your Gradient organization from Claude Code, Cursor, or any MCP client through the hosted Streamable HTTP server.

Gradient hosts a remote MCP server on the console. Point an MCP-capable coding tool (Claude Code, Cursor, or anything that speaks MCP) at it, and it can build agents, publish versions, manage tools and data, place calls, and run evals. It operates on the same organization data the dashboard edits, driven from your editor or terminal.

## Endpoint and auth

The server is a **Streamable HTTP** MCP at:

```text theme={null}
https://console.usegradient.dev/api/mcp
```

Authenticate with an organization API key sent as a Bearer token. Scopes are enforced per tool, so create a key with the scopes you need (for example `agents:*`, `tools:*`, `knowledge_bases:*`, `phone_numbers:*`). See [Organizations](/platform/organizations) for creating and scoping keys.

## Connect a client

<CodeGroup>
  ```json Streamable HTTP theme={null}
  {
    "mcpServers": {
      "gradient": {
        "url": "https://console.usegradient.dev/api/mcp",
        "headers": {
          "Authorization": "Bearer ${GRADIENT_API_KEY}"
        }
      }
    }
  }
  ```

  ```json stdio (mcp-remote) theme={null}
  {
    "mcpServers": {
      "gradient": {
        "command": "npx",
        "args": [
          "-y",
          "mcp-remote",
          "https://console.usegradient.dev/api/mcp",
          "--header",
          "Authorization: Bearer ${GRADIENT_API_KEY}"
        ],
        "env": { "GRADIENT_API_KEY": "grad_live_..." }
      }
    }
  }
  ```
</CodeGroup>

Use the stdio form only for clients that cannot speak Streamable HTTP directly; it proxies to the same hosted endpoint.

## What it exposes

The server exposes **tools** (there are no MCP resources). The surface mirrors the product:

**Identity**

* `whoami`: the authenticated organization and the key's scopes.

**Agents**

* `list_agents`, `create_agent`, `get_agent`, `update_agent`, `delete_agent`, `get_agent_builder`.

**Builder (draft graph)**

* `add_node`, `update_node`, `delete_node`: edit nodes on the draft.
* `add_connection`, `delete_connection`: wire or remove `agent_swap` handoffs.
* `add_tool_to_node`, `remove_tool_from_node`: attach or detach a deployed custom tool.
* `attach_skill`, `detach_skill`, `add_knowledge_base_to_node`: attach skills and knowledge.
* `restore_node`, `restore_version`: restore a published revision back over the draft.

**Publish and run**

* `publish_agent`: publish the reachable draft as the next immutable version.
* `chat_agent`, `start_agent_run`, `list_agent_runs`, `get_agent_run`, `new_conversation`: run a published agent and read its transcript.

**Skills**

* `list_skills`, `create_skill`, `get_skill`, `update_skill`, `delete_skill`.

**Knowledge bases**

* `list_knowledge_bases`, `create_knowledge_base`, `get_knowledge_base`, `update_knowledge_base`, `delete_knowledge_base`, `list_kb_documents`, `ingest_kb_document`, `search_kb`.

**Custom tools**

* `list_tools`, `create_tool`, `get_tool`, `update_tool`, `delete_tool`, `test_tool`, `invoke_tool`.

**Providers and models**

* `list_providers`, `set_provider_key`, `delete_provider_key`, `list_models`.

**Phone numbers**

* `list_phone_numbers`, `search_phone_numbers`, `buy_phone_number`, `update_phone_number`, `release_phone_number`, `create_outbound_call`.

**Dataset worlds (Postgres)**

* `list_dataset_databases`, `create_dataset_database`, `run_dataset_sql`, `get_dataset_schema`.
* `list_dataset_tables`, `create_dataset_table`, `list_dataset_rows`, `insert_dataset_row`.
* `create_dataset_snapshot`, `acquire_dataset_fork`, `release_dataset_fork`.

**Observe and evaluate**

* `list_runs`, `get_run`: trace runs.
* `list_datasets`, `create_dataset`: evaluation datasets.
* `list_experiments`, `create_experiment`, `run_red_team_experiment`, `delete_experiment`: redteam scenarios and QA rubrics (`create_experiment` takes `kind` `red_team` or `qa_rubric`).

## Build and evaluate from the terminal

Because agents, tools, datasets, scenarios, and rules are all authorable through these tools, a coding agent can carry a change the whole way: `create_agent`, shape the graph with `add_node` and `add_connection`, attach code with `add_tool_to_node`, `publish_agent`, then write and run evals with `create_experiment` and `run_red_team_experiment`. See [MCP reference](/api/mcp) for the full tool list.
