Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MCP Integration

Model Context Protocol server for AI agents.

What MCP Enables

AI agents (Claude, GPT, custom) can:

  • Create pipelines from natural language
  • Query pipeline state and metrics
  • Diagnose issues
  • Suggest optimizations

Start the Server

fungi mcp serve

CLI Tools

fungi mcp tools                     # list available tools
fungi mcp call <tool> --args '{...}' # invoke a tool

Available Tools

ToolPurpose
create-pipelineBuild a pipeline from a description
query-stateGet pipeline metrics / state
optimizeSuggest pipeline improvements
debugDiagnose pipeline issues
deployDeploy to a cluster

Configuration

# fungi.toml
[mcp]
enabled = true
host = "0.0.0.0"
port = 3000

[mcp.skills]
enabled = ["create-pipeline", "query-state", "optimize", "debug", "deploy"]

Connect Claude

fungi mcp install --agent claude

This registers Fungi as an MCP server in Claude's config.

Custom Agent (Python)

import fungi_mcp

client = fungi_mcp.Client("http://localhost:3000")

pipeline = client.create_pipeline(
    source="kafka://events",
    filter="amount > 100",
    aggregate="GROUP BY user_id, SUM(amount)",
    sink="kafka://processed-events",
)

state = client.query_state(pipeline.id)
print(state.throughput)

Example Conversation

User: Filter purchases over $100 from Kafka and aggregate by user.

Agent → create-pipeline → returns pipeline-abc123
       → query-state    → throughput, errors, lag
  • Operations / CLIfungi mcp commands
  • ~/.pi/agent/skills/fungi/SKILL.md — Pi agent skill bundled with this repo