Skip to main content
MCP (Model Context Protocol) lets agents connect to external tool servers, instantly adding file system access, database queries, API integrations, and more.
The user asks to inspect the filesystem; the agent calls MCP tools on the connected server.
MCP tool turns are treated specially: a mid-response network failure surfaces provider_outcome_unknown instead of silently re-running the tool. See Replay-Safe Retries.

Which MCP package do I need?

Three packages cover three MCP roles — connecting, light serving, and full hosting. This page covers the client layer. To serve your own agents, see the praisonai-mcp Package and The Three MCP Layers.

Quick Start

1

Connect to an MCP server

2

SSE-based MCP server

3

Streamable HTTP MCP server

Requires an up-to-date mcp package (pip install -U 'mcp'). The transport is powered by the official SDK’s streamablehttp_client.Pass the full endpoint URL your server exposes. Bare-host URLs are no longer rewritten to /mcp (see PraisonAI #3032).
4

Multiple MCP servers


Three equivalent forms

MCP(...) accepts the command in three equivalent forms — pick whichever reads best for your stdio server. Pick the form that matches how the command reaches your code.

Merge rules

A multi-token string is split with shlex: the first token becomes the command, and the remaining tokens are prepended to any explicit args.
MCP("cmd multi word", args=[...]) requires PraisonAI containing #3943 (merged 2026-08-15). On older versions this form silently discovered 0 tools — upgrade with pip install -U praisonaiagents or switch to Form 1 or Form 3.
On Windows, shlex.split(..., posix=False) is used and surrounding double-quotes are stripped from each token. Quote paths that contain spaces: MCP('"C:\\Program Files\\node\\npx.cmd" -y @pkg').

How It Works

For string forms, the command is parsed with shlex before the server spawns.

MCP Server Types

Remote Streamable HTTP servers connect through the official MCP SDK client.

Common Patterns

Pattern 1 — File management agent

Pattern 2 — Database agent

Pattern 3 — GitHub integration


Best Practices

Start with the official @modelcontextprotocol npm packages for common integrations (filesystem, SQLite, GitHub, etc.). They’re well-tested and actively maintained.
When using the filesystem MCP server, pass the narrowest directory path you need. Giving access to / or /home when you only need /app/data creates unnecessary risk.
Never hardcode API keys or tokens in your code. Pass them as environment variables to the MCP server via the env parameter, and source them from your environment or secrets manager.
Agents can use tools from multiple MCP servers simultaneously. Unpack each server’s tools with *MCP(...) and combine them into a single tools list for maximum capability. Loading via load_mcp_tools auto-namespaces each server’s tools (e.g. filesystem_search, github_search) so overlapping names never collide.

Tools — built-in tools and custom tool functions
MCP Tool Filtering — filter which tools to expose per agent