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

# MCP tools

> Use tools from MCP servers

<Note>
  **Agent commands.** Your AI agent uses this node in workflows. You manage the MCP servers that provide these tools with [`pflow mcp`](/reference/cli/mcp) commands.
</Note>

MCP (Model Context Protocol) lets you extend pflow with external tools. When you add an MCP server, its tools become pflow nodes — same validation, same error handling, same template access as built-in nodes.

## How it works

1. **Add an MCP server** with `pflow mcp add`
2. **Sync tools** with `pflow mcp sync` (or let auto-sync handle it)
3. **Tools become nodes** named `mcp-{server}-{tool}`
4. **Agent uses them** like any other node

```bash theme={null}
# Add a GitHub MCP server
pflow mcp add github.mcp.json

# Tools are now available
pflow mcp list github
# mcp-github-create_issue
# mcp-github-list_repos
# mcp-github-search_code
```

## Node naming

MCP tools become nodes with the pattern `mcp-{server}-{tool}`:

| Server     | Tool          | Node name                  |
| ---------- | ------------- | -------------------------- |
| github     | create\_issue | `mcp-github-create_issue`  |
| slack      | send\_message | `mcp-slack-send_message`   |
| filesystem | read\_file    | `mcp-filesystem-read_file` |

## Parameters

MCP node parameters come directly from the tool's input schema. Each MCP server defines its own tools with their own parameters.

To see a tool's parameters:

```bash theme={null}
pflow mcp describe mcp-github-create_issue
```

## Output

All MCP nodes write to:

| Key      | Type | Description                     |
| -------- | ---- | ------------------------------- |
| `result` | any  | Tool execution result           |
| `error`  | str  | Error message (only on failure) |

For dict results, read nested fields through `result`:

If a tool returns `{"issue_url": "...", "issue_number": 123}`, use:

```markdown theme={null}
${github-issue.result.issue_url}
${github-issue.result.issue_number}
```

MCP nodes do not extract top-level result fields into `${node.field}` and do not
write a `{server}_{tool}_result` alias. Each workflow node already has its own
namespace, so `${node.result}` is the canonical success output.

## Example workflow

```markdown theme={null}
### create_issue

Create a GitHub issue from the error summary.

- type: mcp-github-create_issue
- repository: myorg/myrepo
- title: "Bug: ${error_summary}"
- body: ${error_details}

### notify

Send a Slack notification with the issue link.

- type: mcp-slack-send_message
- channel: "#alerts"
- text: "Created issue: ${create_issue.issue_url}"
```

## Setup

To use MCP tools, first add MCP servers to pflow. See [Adding MCP servers](/guides/adding-mcp-servers) for configuration format, authentication, and examples.

pflow supports both local (stdio) and remote (HTTP) MCP servers. Both work identically in workflows - same naming, parameters, and output structure.

## Error handling

MCP nodes return `error` action on:

* **Connection failure**: Server not reachable
* **Tool error**: Tool reported an error (via `isError` flag)
* **Timeout**: Request took too long (default 30 seconds)

The node does **not** retry automatically - MCP calls start a server subprocess, and retries would cause resource conflicts.

## Auto-sync

When you run a workflow, pflow automatically syncs MCP tools if the server configuration has changed. You don't need to manually run `pflow mcp sync` after adding servers.

Manual sync is useful for:

* Testing connection immediately after adding a server
* Debugging connection issues
* Forcing re-discovery without running a workflow
