Trellis supports the Model Context Protocol (MCP), allowing AI agents (like Claude Desktop) to connect directly to your state machine.
This turns Trellis into a “Tool” for AI, enabling agents to:
Note: The MCP Server automatically reports the same version as the Trellis CLI (e.g.
v0.3.3), simplifying compatibility checks.
To use Trellis with Claude Desktop, you need to configure it as a local MCP server.
This mode runs trellis as a subprocess of Claude Desktop.
%APPDATA%\Claude\claude_desktop_config.json~/Library/Application Support/Claude/claude_desktop_config.jsonmcpServers section:{
"mcpServers": {
"trellis-tour": {
"command": "go",
"args": [
"run",
"github.com/aretw0/trellis/cmd/trellis",
"mcp",
"--dir",
"C:/path/to/trellis/examples/tour"
]
}
}
}
Note: Replace
C:/path/to/trellis/...with the absolute path to your flow directory. You can also compile the binary first (go build -o trellis.exe ./cmd/trellis) and point “command” to the executable.
If you are building a custom agent or want to debug the MCP traffic, you can run the server in SSE (Server-Sent Events) mode.
go run ./cmd/trellis mcp --dir ./examples/tour --transport sse --port 8080
Or using the Makefile:
make mcp-tour
The server will be available at:
http://localhost:8080/ssehttp://localhost:8080/messageYou can connect to this using any MCP-compliant client (e.g., MCP Inspector).
Many VS Code extensions (like “MCP Inspector” or agentic extensions) support MCP. Configuration typically goes in .vscode/mcp.json (Workspace) or your User Settings.
{
"mcpServers": {
"trellis-vscode": {
"command": "go",
"args": ["run", "./cmd/trellis", "mcp", "--dir", "./examples/tour"]
}
}
}
To use Trellis with Cursor:
trellis-cursorstdiogo run ./cmd/trellis mcp --dir ./examples/tour(Note: ensure you use absolute paths if the command fails to find files)
Antigravity natively supports MCP. Add the server to your mcp_config.json:
{
"mcpServers": {
"trellis": {
"command": "go",
"args": [
"run",
"C:/path/to/trellis/cmd/trellis",
"mcp",
"--dir",
"C:/path/to/trellis/examples/tour"
]
}
}
}
If your Gemini environment supports MCP (Model Context Protocol), it likely follows the standard JSON configuration for “Tools” or “Connectors”. Use the same JSON structure as above (stdio mode) or connect via SSE URL if running remotely.
render_state(node_id?): Returns the view (text actions) for a node.navigate(node_id, input): Transitions to the next state.get_graph(): Returns the full JSON definition of the nodes.trellis://graph: A read-only JSON resource containing the entire graph structure.You can use the official MCP Inspector to interactively test your server.
The inspector spawns the Trellis process directly. This is the default.
make inspect-tour
In the Inspector UI: Select Transport Type: Stdio.
Useful for debugging remote connections or HTTP issues. Requires two terminals.
Terminal 1 (Start Server):
make mcp-tour
Terminal 2 (Start Inspector):
make inspect-tour-sse
In the Inspector UI: Select Transport Type: SSE. The URL should pre-fill as http://localhost:8080/sse.
If the connection fails:
trellis compiles and runs via trellis run first.