What is Haystack MCP?
Haystack MCP bridges deepset's Haystack AI framework with the Model Context Protocol. It exposes your Haystack RAG pipelines, document search, and QA systems as MCP servers — letting Claude Code, Cline, and other MCP clients query your custom AI pipelines through natural language.
Answer-Ready: Haystack MCP exposes Haystack RAG pipelines as MCP servers, enabling Claude Code and other AI tools to query document search, QA, and retrieval systems through the MCP protocol. Built by deepset.
Best for: Teams with existing Haystack pipelines who want AI tool integration. Works with: Claude Code, Cline, any MCP client + Haystack 2.x. Setup time: Under 10 minutes.
Core Features
1. Pipeline as MCP Tool
Each Haystack pipeline becomes an MCP tool:
server = HaystackMCPServer(
pipelines={
"doc_search": search_pipeline,
"qa": qa_pipeline,
"summarize": summary_pipeline,
}
)
# Creates 3 MCP tools: doc_search, qa, summarize2. Document Store Integration
from haystack.document_stores.in_memory import InMemoryDocumentStore
from haystack.components.writers import DocumentWriter
# Index documents
store = InMemoryDocumentStore()
writer = DocumentWriter(document_store=store)
writer.run(documents=[
Document(content="Company policy on remote work..."),
Document(content="Engineering standards document..."),
])
# Expose search
pipeline = Pipeline()
pipeline.add_component("retriever", InMemoryBM25Retriever(document_store=store))3. RAG Pipeline
from haystack.components.generators import OpenAIGenerator
from haystack.components.builders import PromptBuilder
rag_pipeline = Pipeline()
rag_pipeline.add_component("retriever", retriever)
rag_pipeline.add_component("prompt", PromptBuilder(
template="Answer based on context: {{documents}} Question: {{query}}"
))
rag_pipeline.add_component("llm", OpenAIGenerator())
rag_pipeline.connect("retriever", "prompt")
rag_pipeline.connect("prompt", "llm")4. Claude Code Integration
// .mcp.json
{
"mcpServers": {
"haystack": {
"command": "python",
"args": ["-m", "my_haystack_server"]
}
}
}You: "Search our docs for the remote work policy"
Claude Code (via Haystack MCP):
→ Calls doc_search tool
→ Haystack retrieves relevant documents
→ Returns formatted results5. Custom Tool Parameters
server = HaystackMCPServer(
pipelines={"search": pipeline},
tool_descriptions={
"search": "Search the company knowledge base for policies and procedures"
},
input_mappings={
"search": {"query": "retriever.query"}
},
)Supported Document Stores
| Store | Type |
|---|---|
| InMemory | Development |
| Elasticsearch | Production |
| OpenSearch | Production |
| Weaviate | Vector search |
| Pinecone | Managed vector |
| Qdrant | Vector search |
| Chroma | Lightweight vector |
FAQ
Q: Do I need Haystack experience? A: Basic Haystack knowledge helps. The MCP wrapper is simple once you have a pipeline.
Q: Can I use it with Claude models? A: Yes, Haystack supports Anthropic models for the generator component, and the MCP server works with Claude Code as a client.
Q: Is it production ready? A: Haystack 2.x is production-grade. The MCP bridge is newer but stable for most use cases.