Source code for agentopera.mcp.stdio

from mcp import Tool
from pydantic import BaseModel
from typing_extensions import Self

from .base import McpToolAdapter
from .config import StdioServerParams


[docs] class StdioMcpToolAdapter( McpToolAdapter[StdioServerParams], ): """Allows you to wrap an MCP tool running over STDIO and make it available to agentopera. This adapter enables using MCP-compatible tools that communicate over standard input/output with agentopera agents. Common use cases include wrapping command-line tools and local services that implement the Model Context Protocol (MCP). .. note:: To use this class, you need to install `mcp` extra for the `agentopera` package. .. code-block:: bash pip install -U "agentopera[mcp]" Args: server_params (StdioServerParams): Parameters for the MCP server connection, including command to run and its arguments tool (Tool): The MCP tool to wrap See :func:`~agentopera.agents.tools.mcp.mcp_server_tools` for examples. """ def __init__(self, server_params: StdioServerParams, tool: Tool) -> None: super().__init__(server_params=server_params, tool=tool)