> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP • AI Agent SDK

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

# MCP

> Defined in the [**MCP**](../modules/mcp) module.

<Badge color="blue">AI Agent</Badge>

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 query="command_or_string" type="Any" required={false}>
  No description available.
</ParamField>

<ParamField query="args" type="Any" required={false}>
  No description available.
</ParamField>

## Methods

<CardGroup cols={2}>
  <Card title="get_tools()" icon="function" href="../functions/MCP-get_tools">
    Get the list of tool functions from this MCP instance.
  </Card>

  <Card title="to_openai_tool()" icon="function" href="../functions/MCP-to_openai_tool">
    Convert the MCP tool to an OpenAI-compatible tool definition.
  </Card>

  <Card title="shutdown()" icon="function" href="../functions/MCP-shutdown">
    Explicitly shut down MCP resources.
  </Card>
</CardGroup>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/mcp/mcp.py#L150">
  `praisonaiagents/mcp/mcp.py` at line 150
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="MCP Concept" icon="server" href="/docs/concepts/mcp" />

  <Card title="MCP Lifecycle" icon="rotate" href="/docs/features/mcp-lifecycle" />
</CardGroup>
