MCPClient
Service to connect to MCP (Model Context Protocol) servers
Overview
MCP is an open standard for enabling AI agents to interact with external data and tools. MCPClient
provides a way to access and call tools via MCP. For example, instead of writing bespoke function call implementations for an external API, you may use an MCP server that provides a bridge to the API. Be aware there may be security implications. See MCP documenation for more details.
Installation
To use MCPClient
, install the required dependencies:
You may also need to set environment variables as required by the specific MCP server to which you are connecting.
Configuration
Constructor Parameters
You can connect to your MCP server via Stdio or SSE transport. See here for more documentation on MCP transports.
You can provide either:
- URL: “https://your.mcp.server/sse”
- StdioServerParameters, which are defined as:
Input Parameters
See more information regarding server params here.
Usage Example
MCP Stdio Transport Implementation
MCP SSE Transport Implementation
Additional documentation
See MCP’s docs for MCP related updates.