Skip to content

Commit cde4f64

Browse files
ryaneggzhwchase17
andauthored
Add notes in README about MCP support
* Cloudflare MCP used * cleanup * Add example output * example log fixed, removed unused internet_search to not confuse example * Remove edit to reqs * Remove edit * Update to simplify mcp adapter example, adds to readme only * cleanup title and comments * Make more uniform with previous example lang * More direct linkage to lc-mcp-adapter repo * clean up example output to match some examples from docs * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: Harrison Chase <[email protected]>
1 parent 7bdd67d commit cde4f64

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,36 @@ You can also specify [custom sub agents](#subagents-optional) with their own ins
180180
Sub agents are useful for ["context quarantine"](https://www.dbreunig.com/2025/06/26/how-to-fix-your-context.html#context-quarantine) (to help not pollute the overall context of the main agent)
181181
as well as custom instructions.
182182

183+
## MCP
184+
185+
The `deepagents` library can be ran with MCP tools. This can be achieved by using the [Langchain MCP Adapter library](https://github.com/langchain-ai/langchain-mcp-adapters).
186+
187+
(To run the example below, will need to `pip install langchain-mcp-adapters`)
188+
189+
```python
190+
import asyncio
191+
from langchain_mcp_adapters.client import MultiServerMCPClient
192+
from deepagents import create_deep_agent
193+
194+
async def main():
195+
# Collect MCP tools
196+
mcp_client = MultiServerMCPClient(...)
197+
mcp_tools = await mcp_client.get_tools()
198+
199+
# Create agent
200+
agent = create_deep_agent(tools=mcp_tools, ....)
201+
202+
# Stream the agent
203+
async for chunk in agent.astream(
204+
{"messages": [{"role": "user", "content": "what is langgraph?"}]},
205+
stream_mode="values"
206+
):
207+
if "messages" in chunk:
208+
chunk["messages"][-1].pretty_print()
209+
210+
asyncio.run(main())
211+
```
212+
183213
## Roadmap
184214
- [ ] Allow users to customize full system prompt
185215
- [ ] Code cleanliness (type hinting, docstrings, formating)

0 commit comments

Comments
 (0)