freshcrate
Skin:/
Home > MCP Servers > DeepMCPAgent

DeepMCPAgent

Model-agnostic plug-n-play LangChain/LangGraph agents powered entirely by MCP tools over HTTP/SSE.

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

Model-agnostic plug-n-play LangChain/LangGraph agents powered entirely by MCP tools over HTTP/SSE.

README

DeepMCPAgent Logo

๐Ÿค– DeepMCPAgent

Model-agnostic LangChain/LangGraph agents powered entirely by MCP tools over HTTP/SSE.

Docs Python License Status

Deep MCP Agents on Product Hunt

Discover MCP tools dynamically. Bring your own LangChain model. Build production-ready agentsโ€”fast.

๐Ÿ“š Documentation โ€ข ๐Ÿ›  Issues


โœจ Why DeepMCPAgent?

  • ๐Ÿ”Œ Zero manual tool wiring โ€” tools are discovered dynamically from MCP servers (HTTP/SSE)
  • ๐ŸŒ External APIs welcome โ€” connect to remote MCP servers (with headers/auth)
  • ๐Ÿง  Model-agnostic โ€” pass any LangChain chat model instance (OpenAI, Anthropic, Ollama, Groq, local, โ€ฆ)
  • โšก DeepAgents (optional) โ€” if installed, you get a deep agent loop; otherwise robust LangGraph ReAct fallback
  • ๐Ÿ› ๏ธ Typed tool args โ€” JSON-Schema โ†’ Pydantic โ†’ LangChain BaseTool (typed, validated calls)
  • ๐Ÿงช Quality bar โ€” mypy (strict), ruff, pytest, GitHub Actions, docs

MCP first. Agents shouldnโ€™t hardcode tools โ€” they should discover and call them. DeepMCPAgent builds that bridge.


๐Ÿš€ Installation

Install from PyPI:

pip install "deepmcpagent[deep]"

This installs DeepMCPAgent with DeepAgents support (recommended) for the best agent loop. Other optional extras:

  • dev โ†’ linting, typing, tests
  • docs โ†’ MkDocs + Material + mkdocstrings
  • examples โ†’ dependencies used by bundled examples
# install with deepagents + dev tooling
pip install "deepmcpagent[deep,dev]"

โš ๏ธ If youโ€™re using zsh, remember to quote extras:

pip install "deepmcpagent[deep,dev]"

๐Ÿš€ Quickstart

1) Start a sample MCP server (HTTP)

python examples/servers/math_server.py

This serves an MCP endpoint at: http://127.0.0.1:8000/mcp

2) Run the example agent (with fancy console output)

python examples/use_agent.py

What youโ€™ll see:

screenshot


๐Ÿง‘โ€๐Ÿ’ป Bring-Your-Own Model (BYOM)

DeepMCPAgent lets you pass any LangChain chat model instance (or a provider id string if you prefer init_chat_model):

import asyncio
from deepmcpagent import HTTPServerSpec, build_deep_agent

# choose your model:
# from langchain_openai import ChatOpenAI
# model = ChatOpenAI(model="gpt-4.1")

# from langchain_anthropic import ChatAnthropic
# model = ChatAnthropic(model="claude-3-5-sonnet-latest")

# from langchain_community.chat_models import ChatOllama
# model = ChatOllama(model="llama3.1")

async def main():
    servers = {
        "math": HTTPServerSpec(
            url="http://127.0.0.1:8000/mcp",
            transport="http",    # or "sse"
            # headers={"Authorization": "Bearer <token>"},
        ),
    }

    graph, _ = await build_deep_agent(
        servers=servers,
        model=model,
        instructions="Use MCP tools precisely."
    )

    out = await graph.ainvoke({"messages":[{"role":"user","content":"add 21 and 21 with tools"}]})
    print(out)

asyncio.run(main())

Tip: If you pass a string like "openai:gpt-4.1", weโ€™ll call LangChainโ€™s init_chat_model() for you (and it will read env vars like OPENAI_API_KEY). Passing a model instance gives you full control.


๐Ÿค Cross-Agent Communication

DeepMCPAgent v0.5 introduces Cross-Agent Communication โ€” agents that can talk to each other without extra servers, message queues, or orchestration layers.

You can now attach one agent as a peer inside another, turning it into a callable tool.
Each peer appears automatically as ask_agent_<name> or can be reached via broadcast_to_agents for parallel reasoning across multiple agents.

This means your agents can delegate, collaborate, and critique each other โ€” all through the same MCP tool interface.
Itโ€™s lightweight, model-agnostic, and fully transparent: every peer call is traced like any other tool invocation.


๐Ÿ’ป Example

import asyncio
from deepmcpagent import HTTPServerSpec, build_deep_agent
from deepmcpagent.cross_agent import CrossAgent

async def main():
    # 1๏ธโƒฃ Build a "research" peer agent
    research_graph, _ = await build_deep_agent(
        servers={"web": HTTPServerSpec(url="http://127.0.0.1:8000/mcp")},
        model="openai:gpt-4o-mini",
        instructions="You are a focused research assistant that finds and summarizes sources.",
    )

    # 2๏ธโƒฃ Build the main agent and attach the peer as a tool
    main_graph, _ = await build_deep_agent(
        servers={"math": HTTPServerSpec(url="http://127.0.0.1:9000/mcp")},
        model="openai:gpt-4.1",
        instructions="You are a lead analyst. Use peers when you need research or summarization.",
        cross_agents={
            "researcher": CrossAgent(agent=research_graph, description="A web research peer.")
        },
        trace_tools=True,  # see all tool calls + peer responses in console
    )

    # 3๏ธโƒฃ Ask a question โ€” the main agent can now call the researcher
    result = await main_graph.ainvoke({
        "messages": [{"role": "user", "content": "Find recent research on AI ethics and summarize it."}]
    })

    print(result)

asyncio.run(main())

๐Ÿงฉ Result: Your main agent automatically calls ask_agent_researcher(...) when it decides delegation makes sense, and the peer agent returns its best final answer โ€” all transparently handled by the MCP layer.


๐Ÿ’ก Use Cases

  • Researcher โ†’ Writer โ†’ Editor pipelines
  • Safety or reviewer peers that audit outputs
  • Retrieval or reasoning specialists
  • Multi-model ensembles combining small and large LLMs

No new infrastructure. No complex orchestration. Just agents helping agents, powered entirely by MCP over HTTP/SSE.

๐Ÿง  One framework, many minds โ€” DeepMCPAgent turns individual LLMs into a cooperative system.


๐Ÿ–ฅ๏ธ CLI (no Python required)

# list tools from one or more HTTP servers
deepmcpagent list-tools \
  --http name=math url=http://127.0.0.1:8000/mcp transport=http \
  --model-id "openai:gpt-4.1"

# interactive agent chat (HTTP/SSE servers only)
deepmcpagent run \
  --http name=math url=http://127.0.0.1:8000/mcp transport=http \
  --model-id "openai:gpt-4.1"

The CLI accepts repeated --http blocks; add header.X=Y pairs for auth:

--http name=ext url=https://api.example.com/mcp transport=http header.Authorization="Bearer TOKEN"

Full Architecture & Agent Flow

1) High-level Architecture (modules & data flow)

flowchart LR
    %% Groupings
    subgraph User["๐Ÿ‘ค User / App"]
      Q["Prompt / Task"]
      CLI["CLI (Typer)"]
      PY["Python API"]
    end

    subgraph Agent["๐Ÿค– Agent Runtime"]
      DIR["build_deep_agent()"]
      PROMPT["prompt.py\n(DEFAULT_SYSTEM_PROMPT)"]
      subgraph AGRT["Agent Graph"]
        DA["DeepAgents loop\n(if installed)"]
        REACT["LangGraph ReAct\n(fallback)"]
      end
      LLM["LangChain Model\n(instance or init_chat_model(provider-id))"]
      TOOLS["LangChain Tools\n(BaseTool[])"]
    end

    subgraph MCP["๐Ÿงฐ Tooling Layer (MCP)"]
      LOADER["MCPToolLoader\n(JSON-Schema โžœ Pydantic โžœ BaseTool)"]
      TOOLWRAP["_FastMCPTool\n(async _arun โ†’ client.call_tool)"]
    end

    subgraph FMCP["๐ŸŒ FastMCP Client"]
      CFG["servers_to_mcp_config()\n(mcpServers dict)"]
      MULTI["FastMCPMulti\n(fastmcp.Client)"]
    end

    subgraph SRV["๐Ÿ›  MCP Servers (HTTP/SSE)"]
      S1["Server A\n(e.g., math)"]
      S2["Server B\n(e.g., search)"]
      S3["Server C\n(e.g., github)"]
    end

    %% Edges
    Q -->|query| CLI
    Q -->|query| PY
    CLI --> DIR
    PY --> DIR

    DIR --> PROMPT
    DIR --> LLM
    DIR --> LOADER
    DIR --> AGRT

    LOADER --> MULTI
    CFG --> MULTI
    MULTI -->|list_tools| SRV
    LOADER --> TOOLS
    TOOLS --> AGRT

    AGRT <-->|messages| LLM
    AGRT -->|tool calls| TOOLWRAP
    TOOLWRAP --> MULTI
    MULTI -->|call_tool| SRV

    SRV -->|tool result| MULTI --> TOOLWRAP --> AGRT -->|final answer| CLI
    AGRT -->|final answer| PY
Loading

2) Runtime Sequence (end-to-end tool call)

sequenceDiagram
    autonumber
    participant U as User
    participant CLI as CLI/Python
    participant Builder as build_deep_agent()
    participant Loader as MCPToolLoader
    participant Graph as Agent Graph (DeepAgents or ReAct)
    participant LLM as LangChain Model
    participant Tool as _FastMCPTool
    participant FMCP as FastMCP Client
    participant S as MCP Server (HTTP/SSE)

    U->>CLI: Enter prompt
    CLI->>Builder: build_deep_agent(servers, model, instructions?)
    Builder->>Loader: get_all_tools()
    Loader->>FMCP: list_tools()
    FMCP->>S: HTTP(S)/SSE list_tools
    S-->>FMCP: tools + JSON-Schema
    FMCP-->>Loader: tool specs
    Loader-->>Builder: BaseTool[]
    Builder-->>CLI: (Graph, Loader)

    U->>Graph: ainvoke({messages:[user prompt]})
    Graph->>LLM: Reason over system + messages + tool descriptions
    LLM-->>Graph: Tool call (e.g., add(a=3,b=5))
    Graph->>Tool: _arun(a=3,b=5)
    Tool->>FMCP: call_tool("add", {a:3,b:5})
    FMCP->>S: POST /mcp tools.call("add", {...})
    S-->>FMCP: result { data: 8 }
    FMCP-->>Tool: result
    Tool-->>Graph: ToolMessage(content=8)

    Graph->>LLM: Continue with observations
    LLM-->>Graph: Final response "(3 + 5) * 7 = 56"
    Graph-->>CLI: messages (incl. final LLM answer)
Loading

3) Agent Control Loop (planning & acting)

stateDiagram-v2
    [*] --> AcquireTools
    AcquireTools: Discover MCP tools via FastMCP\n(JSON-Schema โžœ Pydantic โžœ BaseTool)
    AcquireTools --> Plan

    Plan: LLM plans next step\n(uses system prompt + tool descriptions)
    Plan --> CallTool: if tool needed
    Plan --> Respond: if direct answer sufficient

    CallTool: _FastMCPTool._arun\nโ†’ client.call_tool(name, args)
    CallTool --> Observe: receive tool result
    Observe: Parse result payload (data/text/content)
    Observe --> Decide

    Decide: More tools needed?
    Decide --> Plan: yes
    Decide --> Respond: no

    Respond: LLM crafts final message
    Respond --> [*]
Loading

4) Code Structure (types & relationships)

classDiagram
    class StdioServerSpec {
      +command: str
      +args: List[str]
      +env: Dict[str,str]
      +cwd: Optional[str]
      +keep_alive: bool
    }

    class HTTPServerSpec {
      +url: str
      +transport: Literal["http","streamable-http","sse"]
      +headers: Dict[str,str]
      +auth: Optional[str]
    }

    class FastMCPMulti {
      -_client: fastmcp.Client
      +client(): Client
    }

    class MCPToolLoader {
      -_multi: FastMCPMulti
      +get_all_tools(): List[BaseTool]
      +list_tool_info(): List[ToolInfo]
    }

    class _FastMCPTool {
      +name: str
      +description: str
      +args_schema: Type[BaseModel]
      -_tool_name: str
      -_client: Any
      +_arun(**kwargs) async
    }

    class ToolInfo {
      +server_guess: str
      +name: str
      +description: str
      +input_schema: Dict[str,Any]
    }

    class build_deep_agent {
      +servers: Mapping[str,ServerSpec]
      +model: ModelLike
      +instructions?: str
      +returns: (graph, loader)
    }

    StdioServerSpec <|-- ServerSpec
    HTTPServerSpec <|-- ServerSpec
    FastMCPMulti o--> ServerSpec : uses servers_to_mcp_config()
    MCPToolLoader o--> FastMCPMulti
    MCPToolLoader --> _FastMCPTool : creates
    _FastMCPTool ..> BaseTool
    build_deep_agent --> MCPToolLoader : discovery
    build_deep_agent --> _FastMCPTool : tools for agent
Loading

These diagrams reflect the current implementation:

  • Model is required (string provider-id or LangChain model instance).
  • MCP tools only, discovered at runtime via FastMCP (HTTP/SSE).
  • Agent loop prefers DeepAgents if installed; otherwise LangGraph ReAct.
  • Tools are typed via JSON-Schema โžœ Pydantic โžœ LangChain BaseTool.
  • Fancy console output shows discovered tools, calls, results, and final answer.

๐Ÿงช Development

# install dev tooling
pip install -e ".[dev]"

# lint & type-check
ruff check .
mypy

# run tests
pytest -q

๐Ÿ›ก๏ธ Security & Privacy

  • Your keys, your model โ€” we donโ€™t enforce a provider; pass any LangChain model.
  • Use HTTP headers in HTTPServerSpec to deliver bearer/OAuth tokens to servers.

๐Ÿงฏ Troubleshooting

  • PEP 668: externally managed environment (macOS + Homebrew) Use a virtualenv:

    python3 -m venv .venv
    source .venv/bin/activate
  • 404 Not Found when connecting Ensure your server uses a path (e.g., /mcp) and your client URL includes it.

  • Tool calls failing / attribute errors Ensure youโ€™re on the latest version; our tool wrapper uses PrivateAttr for client state.

  • High token counts Thatโ€™s normal with tool-calling models. Use smaller models for dev.


๐Ÿ“„ License

Apache-2.0 โ€” see LICENSE.


โญ Stars

Star History Chart

๐Ÿ™ Acknowledgments


Release History

VersionChangesUrgencyDate
v1.10.1### Security - **With `scan_tool_results=True`, `trace_tools` and an `observer` showed the raw tool result** -- the model got the redacted result, but MCP tools and wrapped native tools reported the result from inside the tool, before the scan, so the console line and the trace's `result_preview` held the PII or secret the scan had removed. They now show the result the model gets: the redacted text, or the withheld notice. `observe=True` traces were not affected. ### Fixed - **An MCP server aHigh10/24/2026
v1.9.0Runtime processes can pick their reasoning pattern. Traces keep the tenant and the session, record tool arguments as data and show refused calls and approval decisions. Plus fixes for `promptise run --check` with agent factories and a `Prompt` that reached the model twice. ### Upgrade notes - **A `tool.call` entry's `metadata["arguments"]` is JSON data, not text.** It was the Python repr of the call (`"{'sku': 'MS-30'}"`); it is now a dict for a structured call (`{"sku": "MS-30"}`), with nesteHigh10/23/2026
v1.7.1 Three security fixes: approval request ids are now single-use as the docs said, a classifier rule that raises no longer lets a call through, and API keys and JWTs can be revoked while an MCP server runs. ### Upgrade notes - **A second decision for the same approval request is refused.** `QueueApprovalHandler.submit_decision()` raises `ApprovalReplayError` for it (a `KeyError` subclass, so code that catches `KeyError` keeps working); before, it was ignored without a word. `PendingApprover.deciHigh10/23/2026
v1.6.0Python functions are tools: `from promptise import tool` declares one, with its schema taken from the type hints and the docstring and no `langchain_core` import. `MCPClient` reuses its HTTP connections over Streamable HTTP instead of opening one per request, `promptise runtime start --detach` on Windows no longer loses track of a runtime that has started, a `promptise run --tui` run ends after its program's last output line, and every page of docs.promptise.com has a title and description that High10/21/2026
v1.5.2`MCPClient` no longer reports a server's own error as a lost connection (a regression in 1.5.1), a stdio server answers the requests still running when its client closes stdin, `get_node_status()` reports an unreachable node as `NodeUnreachableError`, and an event or message trigger dead-letters every event its full buffer drops, also before its listener runs. ### Fixed - **`MCPClient` reported a server's JSON-RPC error with code -32000 as a lost connection** (new in 1.5.1, with mcp 1.x and 2.High10/21/2026
v1.5.0The Agent Runtime now does what its documentation says: unwired features (lifecycle hooks, rewind, distributed mode, the `promptise runtime stop | status | restart` commands) work, and the runtime docs were rewritten against the code. ### Upgrade notes These changes can alter the behavior of existing code or deployments: - **Control API errors no longer quote exceptions.** A failure caused by an exception inside the runtime (deploy, start, stop, restart, suspend, resume, secret rotation, inboHigh10/20/2026
v1.4.3 ### Fixed - `promptise run --tui` no longer shows a `NoMatches` traceback when it is closed at the moment its once-a-second status refresh runs. High10/18/2026
v1.4.1 ### Fixed - OpenAI and Azure OpenAI models now report token usage when they stream. With recent `langchain-openai` releases, models built from a provider id (`"openai:gpt-5-mini"`) left `stream_usage` unset, so every streamed call (`astream_with_tools`, and the chat, `-i` and terminal UI modes of `promptise run`) was recorded with 0 tokens and no cost. Pass `stream_usage=False` to opt out. High10/18/2026
v1.3.5A patch release. Upgrade with `pip install -U promptise`. Highlights: a code-action run that cannot fit its tool-call budget now raises `CodeActionBudgetError` instead of answering from partial data, and the model is no longer told the cap in a way that makes it cut its own work short; MCP server audit entries carry the error code the client received (`ACCESS_DENIED` vs `AUTHENTICATION_ERROR` and so on). Read **Changed** before upgrading. ## Fixed - **Code-action: a `max_tool_calls` too small High10/16/2026
v1.3.4A patch release with fixes found while running the promptise.com guides. Upgrade with `pip install -U promptise`. Highlights: `max_agent_iterations=N` now allows exactly N model calls; budget and hook stops raise `GraphBudgetExceededError` / `GraphStoppedError` instead of returning a raw tool result; invalid MCP tool calls over HTTP now go through auth, rate limiting and audit with a bounded error; credential redaction keeps JSON valid; context compaction no longer pushes models into re-read loHigh10/15/2026
v1.3.3A patch release with fixes found while writing and running the promptise.com guides. Upgrade with `pip install -U promptise`. Highlights: the agent runtime's mission judge, `max_invocations`, health actions, journal API, live instruction updates and MCP client cleanup now work; explicit server credentials (API keys) win over agent identity and forwarded caller tokens; standard RFC 6749 token requests; the debate, deliberate, research and autonomous reasoning patterns end with a real answer; codHigh10/11/2026
v1.3.1A patch release for 1.3.0. Upgrade with `pip install -U promptise`. The main fix: in 1.3.0, when the model left out an optional parameter, MCP tools sent it as `null`, so servers that validate input โ€” every MCPcast-generated server, and any tool with a typed optional parameter โ€” rejected the call. Tools now send only the arguments the model gave, invalid arguments come back to the model as a correctable error, and the model is offered each parameter's constraints. ## Fixed - **MCP tools sent `High10/11/2026
v1.1.1Patch release fixing a dependency-resolution bug present in v1.1.0. ## Fixed - **Cap `mcp<2.0`.** mcp 2.0 changed the low-level `Server()` constructor signature and renamed `ResourceTemplate.uriTemplate` โ†’ `uri_template`, which breaks the MCP server SDK. Because v1.1.0's `mcp>=1.9.0` had no upper cap, a fresh `pip install promptise` resolved to mcp 2.0 and the server SDK failed at runtime. Now pinned to `mcp>=1.9.0,<2.0`. Validated with the full test suite (**3493 passing**) against mcp 1.29.0High8/18/2026
v1.1.0Promptise Foundry **v1.1.0** โ€” the release that makes agents ready for real users: verifiable identity, multi-tenant isolation, and human approval enforced where the tool lives. ## Highlights **Agent Identity** โ€” every agent gets a stable, verifiable identity. Local, or backed by **Microsoft Entra ID, AWS IAM, Google Cloud, SPIFFE/SPIRE, or generic OIDC**, with per-resource credentials and token caching. Wired through `build_agent(identity=...)`, cross-agent calls, MCP server auth, the runtimeHigh7/17/2026
v1.0.0**Full Changelog**: https://github.com/promptise-com/Foundry/compare/v0.5.0...v1.0.0High4/24/2026
v0.5.0## ๐Ÿš€ Deep MCP Agent v0.5.0 โ€” Cross-Agent Communication Arrives **Release Date:** 2025-10-18 Deep MCP Agent 0.5 introduces **Cross-Agent Communication**, enabling one agent to call another as a tool โ€” no extra servers, no orchestration layers, just pure MCP over HTTP/SSE. --- ### โœจ Highlights * **Cross-Agent Communication:** Agents can now collaborate through new tools: * `ask_agent_<name>` โ€“ send a message to a specific peer and get its final answer. * `broadcast_to_agLow10/18/2025
v0.4.1## ๐Ÿงพ **Changelog โ€” v0.4.1 (2025-10-17)** ### ๐Ÿ› Bug Fixes * **LangGraph compatibility:** Fixed `TypeError` when falling back to `create_react_agent()` with `langgraph>=0.6`. The agent builder now dynamically detects supported parameters and omits deprecated ones, ensuring smooth operation across all LangGraph versions. * **Trace tool logging:** Improved `_after()` logic to skip `None` values when `trace_tools=True`, correctly displaying tool results instead of `None`. ### โš™๏ธ Low10/17/2025
v0.4.0# ๐Ÿš€ DeepMCPAgent 0.4.0 This release focuses on **stability, developer experience, and documentation**, making DeepMCPAgent easier to use in real projects. It includes bug fixes, tooling upgrades, CLI improvements, and better docs. --- ## โœจ Added * **CLI enhancements** * `deepmcpagent list-tools` to inspect available MCP tools. * `deepmcpagent run` for interactive agent sessions. * Proper `--version` flag with dynamic version info from `setuptools-scm`. * **Improved tooLow9/8/2025
v0.3.0## DeepMCPAgent 0.3.0 ### ๐Ÿš€ Features * **CLI** * Added global `--version` flag (prints package version). * Improved option parsing (`--stdio` / `--http`) with Typer `Annotated`. * **Tools** * Improved JSON Schema โ†’ Pydantic conversion: * Carry through defaults and descriptions. * Generate per-tool arg models (`Args_<tool>`). * Sanitize model names for Pydantic compatibility. ### ๐Ÿ›  Fixes * **Typing** * Added return type annotations to CLI commandsLow9/7/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

AutoGPTAutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.autogpt-platform-beta-v0.9.0
sdk-pythonA model-driven approach to building AI agents in just a few lines of code.harness-cli/v0.2.2
samplesAgent samples built using the Strands Agents SDK.main@2026-10-21
consolidation-memoryStore, consolidate, and recall coding agent memories with provenance tracking using SQLite and FAISS for fast, structured knowledge access.main@2026-08-23
quickstart-streaming-agentsBuild, deploy, and orchestrate event-driven agents natively on Apache Flinkยฎ and Apache Kafkaยฎmaster@2026-10-25

More in MCP Servers

litellmPython SDK, Proxy Server (AI Gateway) to call 100+ LLM APIs in OpenAI (or native) format, with cost tracking, guardrails, loadbalancing and logging. [Bedrock, Azure, OpenAI, VertexAI, Cohere, Anthropi
ruflo๐ŸŒŠ The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade archit
@claude-flow/cliRuflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code
claude-plugins-officialOfficial, Anthropic-managed directory of high quality Claude Code Plugins.