Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

Model Context Protocol

Learn what the Model Context Protocol (MCP) is, how it can improve your workflows, and how to use it in Haystack Enterprise Platform.


What Is the Model Context Protocol?​

The Model Context Protocol (MCP) is a way to let AI systems, like large language models (LLMs), connect to the outside world. With MCP, AI can access the newest information, trigger actions, or interact with other systems. Instead of building a custom connection for every app, database, or API, MCP provides a universal way to do this.

MCP acts like a universal adapter. It defines a common protocol, or a standard, for how AI applications communicate with external tools and data sources. Just as USB-C standardizes how devices connect, MCP standardizes how AI connects to external capabilities. For Haystack Enterprise Platform, this means you can connect pipelines to a wide range of tools and services with the same interface.

MCP defines how an AI assistant requests data from tools and how those tools respond. When a tool supports MCP, you can use it across any compatible client, such as Cursor, Claude Desktop, or your own custom agent.

Key Concepts​

MCP uses a client-server architecture with three key components:

  • MCP Host: The AI assistant the user interacts with, like Claude Desktop or VS Code. The host manages the overall workflow and launches one MCP client for each server it connects to.
  • MCP Client: The component that manages communication between the host and the server. It is usually part of the host application.
  • MCP Server: A program that provides capabilities, such as tools, resources, or prompts, to an MCP client. It can run locally on your machine or remotely on a provider's infrastructure. Haystack Enterprise Platform provides the Haystack Platform MCP server, which lets your coding assistant manage and debug your pipelines and services.

The Haystack Enterprise Platform also let you use your Haystack pipelines deployed as services as MCP tools. For example, if you have a pipeline that searches your company database, you can expose it as an MCP to the coding assistants used in your company.

The host coordinates the entire process. It creates one MCP client to communicate with each MCP server.

The Workflow​

Here's how a typical interaction works. Let's use the example of Claude Code as the host and a Haystack Platform service exposed as a tool:

  1. The user asks Claude Code a question that requires an external tool, in this case a pipeline published to a service.
  2. Claude Code forwards the query to its MCP client, which is its internal component.
  3. The client starts a session with your Gateway MCP server.
  4. They exchange information about available tools and capabilities.
  5. The client sends a tool call, the server returns the result, and the client passes the response back to Claude Code.
  6. Claude Code then formats it into natural language for the user.

Benefits of MCP​

  • Vendor-agnostic integration: MCP handles the communication protocol, so you can focus on building rather than writing custom integration code.
  • Flexible tool access: Access a growing ecosystem of MCP-compatible tools, including database connections, web search capabilities, file system operations, API integrations, and custom business tools.
  • Enhanced AI capabilities: Give your AI models access to real-time data and tools, enabling them to answer questions with current information, perform actions on external systems, access specialized data sources, and execute complex workflows.
  • Future-proof architecture: As more tools adopt MCP, your pipelines automatically gain access to new capabilities without code changes.

MCP in Haystack Enterprise Platform​

Haystack Enterprise Platform supports MCP in three ways:

  1. Agents in your pipelines can use tools from external MCP servers.
  2. Your AI assistant can access the Haystack platform through an MCP server and help you build there.
  3. Your services deployed on the platform can act as MCP tools that AI assistants call.

Using External MCP Servers​

You can connect your Agent components to external MCP servers to access third-party tools and data sources. This is useful when you need to integrate with services that provide MCP-compatible APIs.

Accessing the Platform from Your AI Assistant​

Haystack Enterprise Platform offers an MCP server that lets AI assistants and coding agents, like Claude Code or Cursor, work with the platform for you. Your assistant can create and debug pipelines, indexes and services, inspect traces, check costs, and more, using your permissions. You connect with your Haystack Platform account or an API key. For an overview, see MCP Servers. For instructions, see Connect to the Haystack Platform MCP Server.

Using Your Services as MCP Tools​

You can make your services available as tools to AI assistants like Cursor, VS Code, or Claude Code through a Gateway MCP server. A service is the stable endpoint under which a pipeline runs: when an assistant calls the tool, the service runs the pipeline behind it. A pipeline must be published as a service first. You then turn on each service you want to expose as a tool. For details on services, see Gateway.

When an AI client connects to your Gateway MCP server, it discovers all services you turned on and can call them as tools. Each tool can have its own name, description, and instructions to help the AI assistant understand when and how to use it. The MCP URL stays the same when you publish a new pipeline version to a service.

You can mix and match services, for example a RAG service for knowledge retrieval and a summarization service for document analysis, all accessible through one endpoint. You connect with your Haystack Platform account through OAuth or with an API key.

Response Time and Streaming​

An MCP tool call returns the pipeline's answer in one piece, after the pipeline finishes. A Gateway MCP server doesn't stream the answer token by token, so the AI client shows nothing until the whole answer is ready. A pipeline that streams in the Playground can therefore feel slower over MCP.

Other things add time to an MCP tool call:

  • Cold start: If the service scaled to zero after its idle timeout, the first call waits while a replica starts. For details, see Cold Starts and Timeouts.
  • Tool discovery: Each time the client lists or calls tools, the server reads the input schema of every tool you turned on. The more tools a workspace exposes, the longer this takes.

To keep MCP calls fast, turn on only the tools the AI client needs, use a fast model, and set an idle timeout long enough that the tool stays warm between calls. For token-by-token answers in your own app, call the streaming endpoint instead. For details, see Stream Pipeline Responses.

Example Use Cases​

  • Documentation assistant: Turn on a RAG service that searches your internal documentation
  • Code review helper: Use a service that analyzes code patterns and suggests improvements
  • Data processing tool: Make data transformation services available for development workflows
  • Knowledge search: Provide access to company knowledge bases through search services

For instructions on setting this up, see Use Your Services as MCP Tools.