The --mcp flag enables integration with Model Context Protocol (MCP) servers, allowing agents to use external tools and services.
Quick Start
praisonai "Search files" --mcp "npx -y @modelcontextprotocol/server-filesystem ."
Usage
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"
Popular MCP Servers
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
--mcp "command [args...]"
Examples:
--mcp "npx -y @modelcontextprotocol/server-filesystem ."
--mcp "python -m mcp_server"
--mcp "node ./my-server.js"
--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
Issue Solution Server not found Ensure npx/node is installed and in PATH Connection timeout Check network connectivity and server status Permission denied Verify API keys and access permissions Tool not available Check server documentation for available tools