Skip to main content
The MCPClientProtocol interface enables custom MCP client implementations while maintaining compatibility with the PraisonAI agent system.
The user plugs in a custom MCP client; the agent discovers and calls tools through the protocol contract.

How It Works

Quick Start

1

Implement Protocol

Create a custom MCP client that follows the protocol:
2

Use with Agent

Wire your custom client into an agent:

Protocol Methods


Implementation Example

HTTP-based MCP Client


Protocol Compliance

The protocol interface provides runtime type checking:

Required Methods

Every MCP client implementation must provide:

Common Use Cases

Database MCP Client

Connect to databases directly without external servers:

Mock MCP Client (Testing)

Create predictable responses for testing:

Best Practices

While not strictly required, providing both sync and async versions of methods ensures compatibility with different agent execution modes.
Implement proper error handling in call_tool(). Raise descriptive exceptions that help with debugging and user feedback.
Always implement shutdown() to clean up connections, files, or other resources. This prevents resource leaks in long-running applications.
Return proper JSON schemas in list_tools() to enable agent tool validation and better error messages.

Load MCP Tools

Wire configured MCP servers into agents with one line

MCP Tool Filtering

Restrict which MCP tools an agent can see and call