Skip to main content
The --mcp flag enables integration with Model Context Protocol (MCP) servers, allowing agents to use external tools and services.

Quick Start

praisonai mcp list
List MCP servers example
praisonai "Search files" --mcp "npx -y @modelcontextprotocol/server-filesystem ."

Usage

Manage MCP Server Configuration

Basic MCP Server

praisonai "List files in current directory" --mcp "npx -y @modelcontextprotocol/server-filesystem ."
Expected Output:
🔌 MCP Server connected: @modelcontextprotocol/server-filesystem

╭─ Agent Info ─────────────────────────────────────────────────────────────────╮
│  👤 Agent: DirectAgent                                                       │
│  Role: Assistant                                                             │
│  🔧 Tools: list_directory, read_file, write_file                            │
╰──────────────────────────────────────────────────────────────────────────────╯

╭────────────────────────────────── Response ──────────────────────────────────╮
│ Here are the files in the current directory:                                 │
│                                                                              │
│ 📁 src/                                                                      │
│ 📁 tests/                                                                    │
│ 📄 README.md                                                                 │
│ 📄 package.json                                                              │
│ 📄 requirements.txt                                                          │
╰──────────────────────────────────────────────────────────────────────────────╯

MCP with Environment Variables

# Brave Search with API key
praisonai "Search for AI news" \
  --mcp "npx -y @modelcontextprotocol/server-brave-search" \
  --mcp-env "BRAVE_API_KEY=your_api_key"
Expected Output:
🔌 MCP Server connected: @modelcontextprotocol/server-brave-search
🔑 Environment variables loaded

╭────────────────────────────────── Response ──────────────────────────────────╮
│ Here are the latest AI news articles:                                        │
│                                                                              │
│ 1. "OpenAI Announces GPT-5" - TechCrunch                                    │
│    https://techcrunch.com/2024/12/...                                       │
│                                                                              │
│ 2. "Google DeepMind's Latest Breakthrough" - The Verge                      │
│    https://theverge.com/2024/12/...                                         │
╰──────────────────────────────────────────────────────────────────────────────╯

Multiple Environment Variables

praisonai "Complex task" \
  --mcp "npx server-name" \
  --mcp-env "API_KEY=key1,SECRET=secret2,REGION=us-east-1"

Filesystem

--mcp "npx -y @modelcontextprotocol/server-filesystem ."
Read, write, and list files

Brave Search

--mcp "npx -y @modelcontextprotocol/server-brave-search"
--mcp-env "BRAVE_API_KEY=xxx"
Web search capabilities

GitHub

--mcp "npx -y @modelcontextprotocol/server-github"
--mcp-env "GITHUB_TOKEN=xxx"
GitHub repository operations

PostgreSQL

--mcp "npx -y @modelcontextprotocol/server-postgres"
--mcp-env "DATABASE_URL=xxx"
Database queries

Slack

--mcp "npx -y @modelcontextprotocol/server-slack"
--mcp-env "SLACK_TOKEN=xxx"
Slack messaging

Google Drive

--mcp "npx -y @anthropic/server-gdrive"
Google Drive access

Use Cases

File Operations

praisonai "Read the README.md file and summarize it" \
  --mcp "npx -y @modelcontextprotocol/server-filesystem ."

Web Research

praisonai "Research the latest developments in quantum computing" \
  --mcp "npx -y @modelcontextprotocol/server-brave-search" \
  --mcp-env "BRAVE_API_KEY=your_key"

Database Queries

praisonai "Show me the top 10 customers by revenue" \
  --mcp "npx -y @modelcontextprotocol/server-postgres" \
  --mcp-env "DATABASE_URL=postgresql://user:pass@localhost/db"
Expected Output:
╭────────────────────────────────── Response ──────────────────────────────────╮
│ Top 10 Customers by Revenue:                                                 │
│                                                                              │
│ | Rank | Customer        | Revenue      |                                   │
│ |------|-----------------|--------------|                                   │
│ | 1    | Acme Corp       | $1,250,000   |                                   │
│ | 2    | TechStart Inc   | $980,000     |                                   │
│ | 3    | Global Systems  | $875,000     |                                   │
│ | ...  | ...             | ...          |                                   │
╰──────────────────────────────────────────────────────────────────────────────╯

GitHub Operations

praisonai "List open issues in the repository" \
  --mcp "npx -y @modelcontextprotocol/server-github" \
  --mcp-env "GITHUB_TOKEN=ghp_xxx"

Combine with Other Features

# MCP with metrics
praisonai "Search and analyze" --mcp "npx server" --metrics

# MCP with planning
praisonai "Complex research task" --mcp "npx server" --planning

# MCP with guardrail
praisonai "Query database" --mcp "npx postgres-server" --guardrail "Read-only queries"

MCP Server Configuration

Command Format

--mcp "command [args...]"
Examples:
  • --mcp "npx -y @modelcontextprotocol/server-filesystem ."
  • --mcp "python -m mcp_server"
  • --mcp "node ./my-server.js"

Environment Variables Format

--mcp-env "KEY1=value1,KEY2=value2"
Never commit API keys or secrets to version control. Use environment variables or secure secret management.

Best Practices

Test MCP servers independently before using them with agents to ensure they’re working correctly.

Security

Use environment variables for sensitive credentials

Testing

Test MCP servers with simple commands first

Permissions

Grant minimum necessary permissions to MCP servers

Monitoring

Use --metrics to track MCP tool usage

Troubleshooting

IssueSolution
Server not foundEnsure npx/node is installed and in PATH
Connection timeoutCheck network connectivity and server status
Permission deniedVerify API keys and access permissions
Tool not availableCheck server documentation for available tools

MCP Configuration Management

In addition to the --mcp flag, you can manage MCP server configurations using the praisonai mcp command.

List Configurations

praisonai mcp list
Expected Output:
                         MCP Server Configurations                         
┏━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name       ┃ Command ┃ Enabled ┃ Scope     ┃ Description                ┃
┡━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ filesystem │ npx     │ ✅      │ workspace │ Filesystem access          │
│ brave      │ npx     │ ✅      │ global    │ Brave search               │
└────────────┴─────────┴─────────┴───────────┴────────────────────────────┘

Create Configuration

praisonai mcp create <name> <command> [args...]
Example:
praisonai mcp create filesystem npx -y @modelcontextprotocol/server-filesystem .

Show Configuration

praisonai mcp show <name>
Expected Output:
MCP Config: filesystem
Command: npx
Args: -y @modelcontextprotocol/server-filesystem .
Enabled: Yes
Description: Filesystem access

Enable/Disable Configuration

praisonai mcp enable <name>
praisonai mcp disable <name>

Delete Configuration

praisonai mcp delete <name>

Configuration File Format

MCP configs are stored as JSON files in .praison/mcp/:
{
  "name": "filesystem",
  "command": "npx",
  "args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
  "env": {
    "SOME_VAR": "value"
  },
  "enabled": true,
  "description": "Filesystem access for the agent"
}

Storage Locations

LocationScopeDescription
.praison/mcp/WorkspaceProject-specific configs
~/.praisonai/mcp/GlobalShared across all projects

Python API

from praisonaiagents import MCPConfigManager

# Initialize
mcp = MCPConfigManager(workspace_path=".")

# List all configs
configs = mcp.list_configs()

# Get a specific config
config = mcp.get_config("filesystem")

# Create a config
mcp.create_config(
    name="brave-search",
    command="npx",
    args=["-y", "@modelcontextprotocol/server-brave-search"],
    env={"BRAVE_API_KEY": "$BRAVE_API_KEY"},
    description="Brave web search"
)

# Get MCP tools for agents
tools = mcp.get_mcp_tools()