MCP connection using standard input/output.
| 71 | |
| 72 | |
| 73 | class MCPConnectionStdio(MCPConnection): |
| 74 | """MCP connection using standard input/output.""" |
| 75 | |
| 76 | def __init__(self, command: str, args: list[str] = None, env: dict[str, str] = None): |
| 77 | super().__init__() |
| 78 | self.command = command |
| 79 | self.args = args or [] |
| 80 | self.env = env |
| 81 | |
| 82 | def _create_context(self): |
| 83 | return stdio_client( |
| 84 | StdioServerParameters(command=self.command, args=self.args, env=self.env) |
| 85 | ) |
| 86 | |
| 87 | |
| 88 | class MCPConnectionSSE(MCPConnection): |