-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy path__init__.py
More file actions
35 lines (28 loc) · 1.1 KB
/
__init__.py
File metadata and controls
35 lines (28 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Transport implementations for MCP clients.
This module provides transport abstractions for connecting to MCP servers
using different protocols:
- InMemoryTransport: For testing servers without network overhead
- HttpTransport: For Streamable HTTP connections (recommended for HTTP)
- SSETransport: For legacy Server-Sent Events connections
Example:
```python
from mcp.client import Client
from mcp.client.transports import HttpTransport, SSETransport
# Using Streamable HTTP (recommended)
async with Client(HttpTransport("http://localhost:8000/mcp")) as client:
result = await client.call_tool("my_tool", {...})
# Using legacy SSE
async with Client(SSETransport("http://localhost:8000/sse")) as client:
result = await client.call_tool("my_tool", {...})
```
"""
from mcp.client.transports.base import Transport
from mcp.client.transports.http import HttpTransport
from mcp.client.transports.memory import InMemoryTransport
from mcp.client.transports.sse import SSETransport
__all__ = [
"Transport",
"HttpTransport",
"InMemoryTransport",
"SSETransport",
]