Integrations/Haystack

Set up Haystack

Deepset’s LLM orchestration framework. Use mcp-haystack to add Agentcy tools to your Haystack pipelines and agents for marketing data retrieval and analysis.

SETUP
6 STEPS
  1. 01

    Sign up at app.goagentcy.com and create an API key

  2. 02

    Install both packages: pip install haystack-ai mcp-haystack

  3. 03

    Import from haystack_integrations.tools.mcp (NOT haystack.tools)

  4. 04

    Use class StreamableHttpServerInfo — camelCase ‘Http’, NOT all-caps ‘HTTP’

  5. 05

    Pass your API key via the token= parameter (auto-generates the Bearer header)

  6. 06

    Add the MCPTool to a Haystack Agent or pipeline

CONFIG

path: pip install mcp-haystack

python
# Python — Haystack with MCP
# pip install haystack-ai mcp-haystack

from haystack_integrations.tools.mcp import MCPTool, StreamableHttpServerInfo
#                ^^^^^^^^^^^^^                              ^^^
#       NOT haystack.tools                  "Http" (camelCase), NOT "HTTP"
from haystack.components.agents import Agent
from haystack.components.generators.chat import OpenAIChatGenerator

# token= shorthand auto-generates "Authorization: Bearer <token>"
server_info = StreamableHttpServerInfo(
    url="https://data.goagentcy.com/mcp",
    token="YOUR_AGENTCY_API_KEY",
)

tool = MCPTool(name="agentcy", server_info=server_info)

agent = Agent(
    chat_generator=OpenAIChatGenerator(model="gpt-4o"),
    tools=[tool],
)
result = agent.run(
    messages=[{"role": "user", "content": "How is my site performing this month?"}]
)
print(result["replies"])
Last verified: April 9, 2026Official docs
TIPS

IMPORTANT: Two breaking bugs were in our previous docs — (1) the import is from haystack_integrations.tools.mcp, NOT haystack.tools; (2) the class is StreamableHttpServerInfo with camelCase ‘Http’, NOT all-caps ‘HTTP’. Both caused ImportError. Use MCPToolset (instead of individual MCPTool) to auto-discover all Agentcy tools from one server_info object. For production, use Secret.from_env_var("AGENTCY_API_KEY") instead of a hardcoded token. Haystack pipelines can also be exposed AS MCP servers via Hayhooks. Latest mcp-haystack version: 1.3.0 (released March 24, 2026).

REFERENCES
4 SOURCES

Stuck or want to verify these instructions yourself? These are the documentation sources we used. If something here doesn't match what you see in your client, the vendor may have updated their UI — and we'll get this page updated.

EXPLORE DATA SOURCES

After connecting Haystack and configuring your data sources in the portal, ask questions about any of them in natural language:

View all data sources →

v1.0Need help?