Openfi Documentation

Guides, APIs, standards, and examples

OpenFi MCP Server

Overview

The OpenFi MCP server exposes framework-level tools via the Model Context Protocol. It supports both Streamable HTTP and stdio transports.

Transport Modes

Streamable HTTP

URL: http://127.0.0.1:3010/mcp
Health: http://127.0.0.1:3010/healthz

Uses StreamableHTTPServerTransport from @modelcontextprotocol/sdk. Supports POST, GET, and DELETE on the /mcp endpoint.

stdio

# Run via npx
npx openfi-mcp

# Or directly
node packages/mcp-server/dist/stdio.js

Uses StdioServerTransport. Suitable for MCP clients that manage the server process directly (e.g., Claude Code, Cursor).

Tools

Read Tools

#ToolDescription
1openfi_list_agentsList all installed OpenFi agents
2openfi_get_agentGet agent details by slug
3openfi_get_agent_manifestGet agent.json manifest
4openfi_get_agent_logGet agent execution log (agent_log.json)
5openfi_get_runGet run details by runId
6openfi_get_run_receiptsGet all receipts for a run
7openfi_get_trust_summaryGet trust snapshot and summary for an agent
8openfi_get_treasury_statusGet treasury contract status (balance, owner, paused)
9openfi_get_treasury_policyGet treasury policy for an agent

Write Tools

All write tools support dry_run: true to preview actions without executing them.

#ToolDescription
10openfi_register_identityRegister/update agent identity
11openfi_set_agent_walletSet agent operator wallet
12openfi_submit_taskSubmit a task for execution
13openfi_configure_treasury_policyConfigure treasury policy for an agent
14openfi_dry_run_callSimulate a treasury call
15openfi_execute_callExecute a treasury call
16openfi_dry_run_transfer_erc20Simulate an ERC20 transfer
17openfi_transfer_erc20Execute an ERC20 transfer
18openfi_post_feedbackPost reputation feedback to cache
19openfi_recompute_trust_summaryRecompute trust snapshot for an agent

Dry-Run Semantics

When dry_run: true is passed to a write tool:

  • No state changes are made
  • The tool returns what would happen, including simulation results, estimated gas, and policy check outcomes
  • For treasury operations, simulateContract is used via viem

When dry_run: false (default):

  • The operation executes normally
  • Returns transaction hashes, run IDs, and receipt summaries

Input Schemas

All input schemas are defined using import * as z from 'zod/v4' and are shared between the MCP server and control-plane API via packages/core.

Example: openfi_submit_task

{
  "goal": "Check treasury balance",
  "coordinatorSlug": "coordinator",
  "dry_run": false
}

Example: openfi_execute_call

{
  "agentSlug": "my-agent",
  "target": "0x1234...",
  "value": "0",
  "data": "0xabcdef...",
  "runId": "run_abc123",
  "taskId": "task_xyz",
  "purpose": "Deposit collateral",
  "dry_run": true
}

Service Layer Reuse

The MCP server uses the same service layer (packages/services) as the control-plane API. Both are thin transport adapters over:

  • AgentService - agent CRUD and identity management
  • RunService - run lifecycle and task management
  • TrustService - trust snapshots and reputation
  • TreasuryService - policy management and execution
  • ManifestService - manifest generation and serving

This ensures consistent behavior regardless of whether tools are invoked via MCP or HTTP API.