Skip to content

💾 Saving & Loading Pipelines

💾 Saving & Loading Pipelines

Pipelines can be serialized to JSON and restored later. This makes sharing and reusing pipelines easy.


1. Saving

stack.save("my_pipeline.json")

This writes:

{
  "config": {...},
  "tools": [
    {
      "type": "hello_world",
      "params": {}
    }
  ]
}

2. Loading

from MCPStack.stack import MCPStackCore

stack = MCPStackCore.load("my_pipeline.json")

The stack is reconstructed, tools are re-initialized, and actions re-registered.


3. CLI equivalents

# Save
mcpstack save --pipeline my_pipeline.json

# Load and run
mcpstack run --pipeline my_pipeline.json --config-type fastmcp

Note

After loading, MCPStack calls each tool’s post_load() hook to restore backends or connections.