Skip to main content
Connect agents to Model Context Protocol (MCP) servers to give them access to external tools, data, and services.

Quick Start

1

Simple Usage

2

With Configuration


Transport Selection

The MCP class picks the right transport automatically — no config objects needed.
Auto-detection is suffix-based: only URLs that end exactly with /sse select SSE. A URL like https://api.example.com/sse/v2 will not auto-select SSE — pass 'sse' explicitly.

Examples


Configuration Options


Instance API


New Exports


Best Practices

MCP connections stay open until explicitly closed. Always call await mcp.close() to release resources, especially in long-running applications or when switching servers.
Enable debug mode when first wiring up a new MCP server. It logs the selected transport and number of tools loaded, making misconfiguration easy to spot.
Auto-detection relies on the URL ending in /sse. If your server URL doesn’t follow this convention, pass the transport explicitly to avoid surprises.
Use the unified MCP class for all new integrations. MCPHttpStreaming is a standalone client without auto-detection. Only use it if you specifically need direct HTTP-Streaming without the unified interface.

MCP Security

Secure MCP connections with authentication and rate limiting

Python MCP Transports

Python equivalent — stdio, Streamable HTTP, WebSocket, SSE

Tools

Tool system overview for TypeScript agents

Agent

Agent configuration and capabilities