2025-11-25 stable framing: Streamable HTTP for remote servers, stdio for local servers, and SSE only for legacy compatibility.
💻 Code Examples
Basic MCP
Get started with MCP servers
Advanced MCP
Multiple servers with filtering
Quick Start
Python API
CLI (tyler-chat)
Add this to yourtyler-chat-config.yaml:
How It Works
- Agent Creation:
Agent(mcp={...})validates config schema immediately (fail fast!) - Connection:
await agent.connect_mcp()connects to servers and discovers tools - Tool Registration: Discovered tools are namespaced (
servername_toolname) and merged with built-in tools - Usage: Tools are available in
agent.run()like any other tool - Cleanup:
await agent.cleanup()disconnects MCP servers
Configuration Reference
Server Configuration
Each MCP server requires:Transport Types
Streamable HTTP - For HTTP-based MCP servers (Mintlify, hosted servers):Advanced Usage
Multiple Servers
Connect to multiple MCP servers simultaneously:Tool Filtering
Control which tools are registered:Custom Namespace
Override the default namespace prefix:Environment Variables
Use environment variables for secrets (recommended!):Graceful Degradation
Control failure behavior per server:Resource Management
When to Use cleanup()
Use try/finally and call await agent.cleanup() whenever an agent connects to MCP servers. Cleanup disconnects SDK sessions and removes dynamically registered MCP tools from the agent so reconnects do not duplicate definitions.
Long-running applications:
Streamable HTTP uses asyncio task groups and remote sessions that especially need explicit cleanup. Using the same pattern for
stdio and legacy sse keeps scripts and tests predictable.Security Best Practices
DO:- Trust only reviewed MCP servers; local
stdioservers run with the same privileges as the Tyler process. - Treat MCP tool descriptions, annotations, icons, and
_metaas advisory/untrusted unless the server is trusted. - Prefer
include_toolsandexclude_toolsso agents only see the tools they need. - Avoid always-on large MCP server catalogs; connect narrow server sets per agent or workflow.
- Keep secrets in environment variables and use
${VAR}substitution in config.
Troubleshooting
Connection refused
Error:Failed to connect to MCP server 'xyz': Connection refused
Solutions:
- Verify the server URL is correct
- Check if the MCP server is running
- For stdio servers, verify the command path is correct
- Check firewall settings
Invalid config schema
Error:Server 'xyz' with transport 'sse' requires 'url' field
Solution: Ensure required fields are present for the transport type:
- streamablehttp/SSE:
urlrequired - stdio:
commandrequired
Tools not discovered
Error: MCP connects but no tools available Solutions:- Verify the MCP server is functioning (check server logs)
- Check if tools are being filtered out (remove
include_tools/exclude_tools) - Try connecting to the server manually to verify it exposes tools
Environment variable not substituted
Error: Connection fails with literal${VAR} in URL
Solution: Ensure the environment variable is set before running:
Under the Hood: Tyler uses the official MCP SDK’s
ClientSessionGroup to manage
connections to MCP servers. The declarative config approach is recommended for all users.
See the API Reference for details.Next Steps
MCP Specification
Read the full MCP specification
MCP Servers
Browse available MCP servers
Adding Tools
Build custom tools for agents
Tyler CLI
Use MCP with tyler-chat CLI