MCP • AI Agent SDK

MCP: Model Context Protocol (MCP) integration for PraisonAI Agents.

MCP

Defined in the MCP module.

AI Agent

Model Context Protocol (MCP) integration for PraisonAI Agents.

This class provides a simple way to connect to MCP servers and use their tools within PraisonAI agents.

Constructor

ParamField Any

No description available.

ParamField Any

No description available.

Methods

Usage

python
from praisonaiagents import Agent
    from praisonaiagents.mcp import MCP

    # Method 1: Using command and args separately
    agent = Agent(
        instructions="You are a helpful assistant...",
        llm="gpt-4o-mini",
        tools=MCP(
            command="/path/to/python",
            args=["/path/to/app.py"]
        )
    )

    # Method 2: Using a single command string
    agent = Agent(
        instructions="You are a helpful assistant...",
        llm="gpt-4o-mini",
        tools=MCP("/path/to/python /path/to/app.py")
    )

    # Method 3: Using an SSE endpoint
    agent = Agent(
        instructions="You are a helpful assistant...",
        llm="gpt-4o-mini",
        tools=MCP("http://localhost:8080/sse")
    )

    agent.start("What is the stock price of Tesla?")

Source

View on GitHub

praisonaiagents/mcp/mcp.py at line 448


Related Documentation