Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.praison.ai/llms.txt

Use this file to discover all available pages before exploring further.

MCP Lifecycle CLI

Commands for managing MCP (Model Context Protocol) connections and lifecycle.

Commands

Start MCP Server

Start an MCP server for testing:
praisonai mcp start "uvx mcp-server-time"

Test MCP Connection

Test connectivity to an MCP server:
praisonai mcp test "uvx mcp-server-time"
Output:
Testing MCP connection...
✓ Connection established
✓ Tools discovered: get_current_time
✓ Connection closed cleanly

List MCP Tools

List available tools from an MCP server:
praisonai mcp tools "uvx mcp-server-time"
Output:
Available MCP Tools:
  - get_current_time: Get the current time in a timezone

Using MCP with Agents

Basic Usage

praisonai "What time is it?" --mcp "uvx mcp-server-time"

Multiple MCP Servers

praisonai "Get time and search" \
  --mcp "uvx mcp-server-time" \
  --mcp "uvx mcp-server-fetch"

With Environment Variables

export BRAVE_API_KEY="your-key"
praisonai "Search for Python" --mcp "npx -y @modelcontextprotocol/server-brave-search"

Connection Types

Stdio (Command)

praisonai "Task" --mcp "uvx mcp-server-time"

SSE URL

praisonai "Task" --mcp "http://localhost:8080/sse"

HTTP Stream

praisonai "Task" --mcp "http://localhost:8080"

WebSocket

praisonai "Task" --mcp "ws://localhost:8080"

Lifecycle Management

Automatic Cleanup

The CLI automatically handles cleanup:
# Connection opened, used, and closed automatically
praisonai "What time is it?" --mcp "uvx mcp-server-time"

Timeout Configuration

Set connection timeout:
praisonai "Task" --mcp "uvx mcp-server-time" --mcp-timeout 30

Debugging

Verbose Mode

Enable verbose output for debugging:
praisonai "Task" --mcp "uvx mcp-server-time" --verbose

Check MCP Status

python -c "
from praisonaiagents import MCP

with MCP('uvx mcp-server-time') as mcp:
    print('Connection: OK')
    tools = mcp.get_tools()
    print(f'Tools: {len(tools)}')
print('Cleanup: OK')
"

Environment Variables

VariableDescription
MCP_TIMEOUTDefault timeout in seconds
MCP_DEBUGEnable debug logging

Error Handling

Connection Errors

# If MCP server fails to start
praisonai "Task" --mcp "invalid-server"
# Error: Failed to connect to MCP server

Timeout Errors

# If operation times out
praisonai "Task" --mcp "slow-server" --mcp-timeout 5
# Error: MCP operation timed out after 5 seconds