MCP YAML Configuration
Configure local stdio and remote Streamable HTTP MCP servers declaratively in YAML workflows
Define local and remote MCP servers directly in YAML workflows and attach them to agents by name in tools:.
MCP(...)also accepts three equivalent Python construction forms — see Three equivalent forms and MCP from Config.
# workflow.yaml
name: Support Triage
mcp_servers:
linear:
url: https://mcp.linear.app/mcp
oauth: true
allowed_tools: [list_issues, get_issue]
filesystem:
command: npx
args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
agents:
triage:
instructions: Inspect recent issues and summarize relevant local files.
llm: gpt-4o-mini
tools: [linear, filesystem]
steps:
- agent: triage
action: Summarize open P1 issues and related docs in this repo.Run it from Python or the CLI:
from praisonaiagents.workflows import Workflow
workflow = Workflow.from_yaml("workflow.yaml")
result = workflow.start()praisonai workflow run --file workflow.yamlgraph LR
subgraph "YAML MCP Configuration"
YAML["YAML Workflow (mcp_servers / mcp)"] --> Parse["parse_mcp_servers"]
Parse --> MCP["Lazy Shared MCP Clients"]
MCP --> Agent["Agent tools: [server_name]"]
Agent --> Tools["Prefixed Tools (if >1 server)"]
end
classDef config fill:#6366F1,stroke:#7C90A0,color:#fff
classDef process fill:#F59E0B,stroke:#7C90A0,color:#fff
classDef output fill:#10B981,stroke:#7C90A0,color:#fff
class YAML config
class Parse,MCP process
class Agent,Tools outputHow It Works
sequenceDiagram
participant YAML as workflow.yaml
participant Parser as YAMLWorkflowParser
participant MCP as MCP Client
participant Agent
YAML->>Parser: Parse top-level mcp_servers (or mcp)
Parser->>Agent: Resolve server names listed in tools
Agent->>MCP: Build client lazily on first reference
MCP-->>Agent: Expose tools (prefixed when >1 server)- Top-level key: Declare servers under
mcp_servers:(preferred). Themcp:alias is also accepted in either direct (mcp: { name: ... }) or nested (mcp: { servers: { name: ... } }) form. - Agent attachment: Reference any declared server by name inside an agent’s
tools:list (supported in bothagents:and legacyroles:YAML schemas). - Lazy initialization: An MCP client is created only when at least one agent references it in
tools:. Unreferenced servers and entries withenabled: falseare skipped. - Shared per workflow: When multiple agents list the same server name in
tools:, they share one initializedMCPclient instance for that workflow parse. - Automatic tool prefixing: When a workflow declares more than one MCP server, each client’s tools are prefixed with its server name (
with_tool_prefix(name)) to prevent tool name collisions.
Configuration Schema
Local Stdio Server
mcp_servers:
filesystem:
command: npx
args:
- "-y"
- "@modelcontextprotocol/server-filesystem"
- "."
env:
NODE_ENV: production
cwd: "."
allowed_tools:
- read_file
- list_directory
disabled_tools:
- delete_file
timeout: 30
enabled: trueRemote Streamable HTTP Server
mcp_servers:
linear:
url: https://mcp.linear.app/mcp
oauth: true
allowed_tools:
- list_issues
- create_issue
timeout: 60
internal_api:
url: https://mcp.example.com/mcp
headers:
X-Team: platform
disabled_tools:
- drop_indexUsing the mcp: Alias
Both forms below are equivalent to top-level mcp_servers::
# Nested alias
mcp:
servers:
time:
command: uvx
args: ["mcp-server-time"]# Direct alias
mcp:
time:
command: uvx
args: ["mcp-server-time"]Supported Fields
| Field | Applies To | Description |
|---|---|---|
command | Local (stdio) | Executable to launch (for example npx, uvx, python). |
args | Local (stdio) | List of command arguments. |
env | Local (stdio) | Mapping of environment variables passed to the server process. |
cwd | Local (stdio) | Working directory for the local server process. |
url | Remote | Remote MCP endpoint (http://, https://, ws://, or wss://). |
headers | Remote | HTTP headers sent on Streamable HTTP requests. |
oauth | Remote | true or { client_id, scopes } to enable OAuth 2.1 + PKCE sign-in. |
allowed_tools | Both | Allow-list of tool names exposed from this server. |
disabled_tools | Both | Deny-list of tool names hidden from this server. |
timeout | Both | Request timeout in seconds (values > 1000 are converted from milliseconds). |
enabled | Both | Set false to keep a server defined without starting it (default true). |
Multi-Agent Sharing & Prefixing Example
name: Release Assistant
mcp_servers:
github:
url: https://api.githubcopilot.com/mcp/
oauth: true
allowed_tools: [get_pull_request, list_commits]
filesystem:
command: npx
args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
allowed_tools: [read_file, list_directory]
optional_metrics:
url: https://metrics.example.com/mcp
enabled: false # Skipped cleanly
agents:
reviewer:
instructions: Review open PR changes against repository conventions.
llm: gpt-4o-mini
tools: [github, filesystem]
writer:
instructions: Draft release notes from recent commits.
llm: gpt-4o-mini
tools: [github] # Shares the same github client as reviewer
steps:
- agent: reviewer
action: Inspect the latest PR and local changelog.
- agent: writer
action: Draft concise release notes.Because two active servers (github and filesystem) are declared in this workflow, tools are automatically prefixed with github_ and filesystem_.
Managing MCP Servers with the CLI
You can also configure, import, and verify MCP servers in your user config from the command line:
# Add a remote Streamable HTTP server with headers, OAuth, and tool allow-list
praisonai mcp add linear \
--url https://mcp.linear.app/mcp \
--oauth \
--allow list_issues,create_issue
# Add a remote server with custom headers
praisonai mcp add internal \
--url https://mcp.example.com/mcp \
--header X-Team=platform
# Add a local stdio server
praisonai mcp add filesystem npx --args "-y @modelcontextprotocol/server-filesystem ."
# Import existing servers read-only from an editor (cursor, claude-desktop, claude-code, vscode, codex, zed, ...)
praisonai mcp import cursor --dry-run
praisonai mcp import cursor
# Verify connectivity with a real MCP initialize + tools/list handshake
praisonai mcp test linearKnown Pitfalls
Authorization header on a legacy /sse URL is refused
MCP servers declared with a url ending in /sse cannot forward custom headers on the legacy SSE client. When headers.Authorization is present on an /sse URL, PraisonAI refuses to start the server instead of silently connecting without the token. Use a Streamable HTTP endpoint (/mcp) or set type: streamable-http when you need Authorization. See MCP from Config.
Workflow YAML does not re-expand ${VAR} placeholders
YAMLWorkflowParser builds MCP clients without expanding ${VAR} placeholders a second time. For authenticated remote servers, prefer oauth: true (with praisonai mcp auth <name>) or store credentials in your user config rather than embedding raw tokens in workflow files.
Per-server timeout in CLI config is in milliseconds
Per-server timeout in .praisonai/config.yaml is specified in milliseconds and converted to seconds with a 1-second floor (500 becomes 1 second) before being passed to MCP(timeout=...). In workflow YAML you can specify seconds directly (for example timeout: 60).