Introduction to MCP servers¶
AI Refinery now supports the use of the Model Context Protocol (MCP) to extend the capabilities of the provided agents and models. The MCP protocol is an open standard that allows AI models to access and use data from various sources like databases, APIs, and files, without needing custom code for each integration.
Hosting of MCP Servers¶
MCP servers can be hosted in various environments, ranging from local machines to cloud platforms. The hosting environment dictates the infrastructure requirements and accessibility.
Hosting Environments:
- Local Machine: Suitable for development, testing, and small-scale deployments. Requires minimal setup but limits accessibility.
- Cloud Platforms (e.g., AWS, Google Cloud, Azure): Provide scalability, reliability, and accessibility. Requires cloud account setup and resource provisioning.
- Containerized Environments (e.g., Docker, Kubernetes): Enables consistent deployments across different environments and simplifies scaling.
Exposure of MCP Servers¶
Exposure Methods:
MCP servers typically expose their functionality through a network endpoint. Common exposure methods include:
- STDIO: Local exposure for initial development and debugging.
- Streamable HTTP/HTTPS (Recommended): The most common and preferred method, allowing clients to interact with the server using a single HTTP/HTTPS endpoint to handle both sending requests (via HTTP/HTTPS POST) and receiving real-time, streaming responses.
- Server-Sent Events (SSE): (Deprecated and migrated to Streamable HTTP/HTTPS by MCP) Delivers real-time server-to-client updates for continuous data streaming to connected agents. (AI Refinery SDK still offers legacy SSE fallback)
- WebSockets: Enables bidirectional communication between the server and clients, suitable for interactive applications.
Exposure Compatibility:
Given its easy setup, versatile functionality, and allowing for both local and public exposure of the servers, the MCPClientAgent is compatible with both http-stream and sse exposed servers. However, servers that natively support the STDIO protocol can be made compatible using tools such as mcp-proxy that create a proxy SSE or Streamable HTTP/HTTPS transport and mirror the default STDIO transport of the server.