# MCP (Model Context Protocol)

Give agents the tools of any MCP server, call MCP tools directly, and expose your own workflows as MCP tools for Claude, Cursor and other agents.

Source: https://glamorous-boar.cloudvent.net/mcp/

---

The **Model Context Protocol (MCP)** is an open standard for connecting AI applications to tools and data. AgenticMind is both an **MCP client** (agents use other servers' tools) and an **MCP server** (your workflows become tools for other agents). Background: [MCP](/learn/mcp/) in the handbook.

## Use an MCP server's tools in an agent

1. Add an **MCP Server** node and connect its `tools` output to an Agent's `tools` input.
2. Choose the transport:
   - **stdio**: AgenticMind starts a local command. Set `command` (e.g. `npx`, `uvx`, `python`, `docker`), `args` (e.g. `["-y", "@modelcontextprotocol/server-everything"]`), optional `env`, `secret_env` (e.g. `{"GITHUB_TOKEN": {"$secret": "GITHUB_TOKEN"}}`) and `cwd`.
   - **http**: a Streamable HTTP endpoint. Set `url`, optional `bearer_token` (a secret) and `headers`.
3. Optionally `name_prefix` (e.g. `github` → `github_create_issue`), `include_tools`, `exclude_tools`.
4. Run. The node's `catalog` output lists the tools it found.

The Agent expands the MCP toolkit into one tool per MCP tool. Tool names are made safe (`word.count` → `word_count`). Structured results are used as-is; images and resources are summarised; an `isError` result becomes a tool error the model can see.

**Call one tool without a model:** **MCP Call** with `tool` and default `arguments`, merged with the `arguments` input. Outputs `result`, `text`, `is_error`.

### Security of MCP clients

- A stdio server inherits only a safe allow-list of environment variables (PATH, home, temp) plus the ones you configure, so AgenticMind's own keys never reach it.
- HTTP targets may be localhost, but link-local and cloud-metadata addresses are refused.
- stdio servers run with your user's privileges, outside the sandbox. **Only add servers you trust.**
- stdio tools need the `subprocess` permission: Agent 1.2.0, Tool Router 1.1.0, Tool Chain 1.1.0.

## Expose a workflow as an MCP tool

1. Open the project, click empty canvas to see the **Project** panel, and tick **Expose as MCP tool** (optionally set a tool name). Save.
2. The workflow is now served at **`http://localhost:8000/api/mcp`** (Streamable HTTP, stateless).
3. Its **Manual Input** nodes become the tool's arguments (key, type, default, required); its outputs are returned as structured content (text for single outputs).
4. Each call is an ordinary recorded run with a trace. A call waits up to `AGENTICMIND_MCP_RUN_TIMEOUT` (300 s), then answers "still running".

Connect a client, for example Claude Desktop, Cursor, or another AgenticMind's MCP Server node, to `http://localhost:8000/api/mcp`.

<CodeBlock language="json" filename="MCP client config (HTTP)" showCopy={true}>

```
{
  "mcpServers": {
    "agenticmind": {
      "url": "http://localhost:8000/api/mcp",
      "headers": { "Authorization": "Bearer <AGENTICMIND_MCP_TOKEN>" }
    }
  }
}
```

</CodeBlock>

### Access control

- Set `AGENTICMIND_MCP_TOKEN` to require `Authorization: Bearer <token>` (compared in constant time). Recommended whenever others can reach the server.
- Host headers are checked against `AGENTICMIND_MCP_ALLOWED_HOSTS` (localhost by default) to block DNS rebinding.
- Cross-site writes are refused; with sign-in required, a session or the token is needed.
- `AGENTICMIND_MCP_SERVER=0` turns the endpoint off.

### Serve graph files over stdio

For desktop clients that launch a command, or exported projects:

<CodeBlock language="bash" filename="terminal" showCopy={true}>

```
uv run agenticmind mcp-serve support.json triage.json
```

</CodeBlock>

Problems go to stderr, never into the protocol stream.

## Template

*Agent with MCP tools*: an Agent whose MCP Server node points at this server's own `/api/mcp`, so any project you expose becomes a tool. Expose another project first, then run.

## Limits

A connection per tool call (stdio servers start each call); no MCP resources, prompts, sampling, elicitation or OAuth yet. SSE transport is superseded upstream and not offered.
