docs(integrations): add 10-line recipes for LlamaIndex/CrewAI/AutoGen/LangGraph - #62
docs(integrations): add 10-line recipes for LlamaIndex/CrewAI/AutoGen/LangGraph#62frantf0916 wants to merge 1 commit into
Conversation
…/LangGraph Closes afx-team#29 Add copy-paste "connect in 10 lines" guide pages (EN + zh mirror) for LlamaIndex, CrewAI, AutoGen, and LangGraph. Each snippet wraps an existing surface (MCP stdio server hebb-mcp, or REST API on localhost:8321) — no new runtime library code. Wire the new page into the VitePress sidebar (EN + zh via the shared guideSidebar), README integrations area, and examples/README. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
📝 WalkthroughWalkthroughAdds bilingual documentation for connecting LlamaIndex, CrewAI, AutoGen, and LangGraph to Hebb Mind through MCP or REST, plus sidebar and README links directing readers to the new integration guide. ChangesPython framework integrations
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 9
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@examples/README.md`:
- Around line 20-21: Make the “Python Framework Integration guide” entry in the
“Pick your starting point” section clickable by moving it outside the code block
as a Markdown link or embedding its destination directly in the entry, while
preserving the existing wording and target destination.
In `@repo_pages/guide/framework-integrations.md`:
- Around line 193-205: Replace the ASCII architecture diagrams in
repo_pages/guide/framework-integrations.md lines 193-205 and
repo_pages/zh/guide/framework-integrations.md lines 186-198 with Mermaid
diagrams. Preserve each diagram’s existing framework-to-MCP/REST API-to-hebb
service flow, HTTP/stdio labels, port 8321 details, and downstream
storage/embedder/searcher/tag graph relationships; translate the Chinese
diagram’s labels appropriately.
- Around line 41-65: The LlamaIndex MCP examples call tools directly instead of
demonstrating agent integration. In repo_pages/guide/framework-integrations.md
lines 41-65 and repo_pages/zh/guide/framework-integrations.md lines 38-61,
update each snippet to create a FunctionAgent with tools=tools and route the
memory write and search requests through that agent, mirroring the same flow in
both English and Chinese examples.
- Around line 162-167: Update the chat-model example after ChatOpenAI.bind_tools
in repo_pages/guide/framework-integrations.md (lines 162-167) and
repo_pages/zh/guide/framework-integrations.md (lines 156-161) to add a supported
tool-execution loop, such as a ToolNode graph or agent executor, that routes
model tool calls to the MCP tools and returns tool results for subsequent model
reasoning; preserve the existing write-and-recall behavior in both language
versions.
- Around line 106-108: Update the AutoGen description to refer to AssistantAgent
instead of ToolUseAssistant. Apply this consistency change in
repo_pages/guide/framework-integrations.md lines 106-108 and
repo_pages/zh/guide/framework-integrations.md lines 102-103, preserving the
surrounding MCP tool-loading details.
- Around line 78-87: Correct the CrewAI MCP setup in both
repo_pages/guide/framework-integrations.md (lines 78-87) and
repo_pages/zh/guide/framework-integrations.md (lines 74-83): install the CrewAI
MCP extra, import MCPServerAdapter from crewai_tools and StdioServerParameters
from mcp, and pass the configured stdio server parameters through the adapter
context manager instead of supplying a raw command mapping.
- Around line 15-16: Update the introductory runnable-example guidance in
repo_pages/guide/framework-integrations.md (lines 15-16) and
repo_pages/zh/guide/framework-integrations.md (lines 14-15) to document the
required model credentials: set OPENAI_API_KEY for provider-backed models, or
configure the local-model /proxy alternative. Keep the prerequisite instructions
clear and consistent in both English and Chinese guides.
- Around line 110-123: The AutoGen MCP examples use unsupported transport
parameters and unpinned package versions. In
repo_pages/guide/framework-integrations.md lines 110-123 and
repo_pages/zh/guide/framework-integrations.md lines 105-118, update the
installation commands to compatible 0.4.x autogen-agentchat/autogen-ext versions
and revise StdioServerParams to use only the supported command, args, env, and
read_timeout_seconds parameters; leave transport handling to mcp_server_tools.
In `@repo_pages/zh/guide/framework-integrations.md`:
- Around line 5-15: 统一修改该中文页面中的说明性文字,将 Agent、agent、embedding、WIP skeleton
等非产品或代码标识的英文术语翻译为中文,并覆盖评论指出的后续段落(166-169);保留 Hebb Mind、hebb-mcp、API
路径、包名、类名及代码块中的标识符不变,确保整篇 repo_pages 中文页面不在中文句子中混用英文。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 107e53f8-3dab-4260-8bf2-9e0d1350f019
📒 Files selected for processing (5)
README.mdexamples/README.mdrepo_pages/.vitepress/config.mtsrepo_pages/guide/framework-integrations.mdrepo_pages/zh/guide/framework-integrations.md
| Want to wire Hebb Mind into LlamaIndex / CrewAI / AutoGen / LangGraph? | ||
| ──→ Python Framework Integration guide |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make the starting-point entry clickable.
This new entry is plain text inside a code block, so readers cannot follow it from the “Pick your starting point” section. Add a Markdown link outside the code block or include the destination directly in the entry.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@examples/README.md` around lines 20 - 21, Make the “Python Framework
Integration guide” entry in the “Pick your starting point” section clickable by
moving it outside the code block as a Markdown link or embedding its destination
directly in the entry, while preserving the existing wording and target
destination.
| Each snippet below wraps one of these surfaces for a popular framework. They are | ||
| copy-paste runnable against a locally running Hebb Mind service. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files 'repo_pages/guide/framework-integrations.md' 'repo_pages/zh/guide/framework-integrations.md' || true
echo "== line counts =="
for f in repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md; do
if [ -f "$f" ]; then
wc -l "$f"
fi
done
echo "== relevant snippets =="
for f in repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md; do
if [ -f "$f" ]; then
echo "--- $f lines 1-130 ---"
sed -n '1,130p' "$f" | nl -ba -v1
fi
done
echo "== search env/keys/openai in repo_pages guide =="
rg -n "OPENAI_API_KEY|api_key|api-key|OPENAI|openai|model credential|credential|copy-paste|runnable|http://localhost:8321" repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md || true
echo "== inspect framework/integration sections around OpenAI-backed recipes =="
for f in repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md; do
if [ -f "$f" ]; then
echo "--- $f lines 1-230 ---"
sed -n '1,230p' "$f" | nl -ba -v1
fi
doneRepository: afx-team/hebb-mind
Length of output: 2486
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== try LFS skip/smudge workarounds =="
git config --local lfs.fetchexclude "$(git ls-files | rg '(^|/)eval/data/' || true | tr '\n' ',' | sed 's#,$##')" 2>/dev/null || true
git lfs install --force 2>/dev/null || true
git fetch origin --depth 1 --no-tags 2>/dev/null || true
git checkout --force --no-lazy-remote -- .repo_pages 2>/dev/null || true
echo "== files =="
git ls-files 'repo_pages/guide/framework-integrations.md' 'repo_pages/zh/guide/framework-integrations.md' || true
echo "== line counts =="
for f in repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md; do
if [ -f "$f" ]; then
wc -l "$f"
fi
done
echo "== credential/openai mentions =="
rg -n "OPENAI_API_KEY|api_key|api-key|OPENAI|openai|model credential|credential|copy-paste|runnable|http://localhost:8321" repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md || true
echo "== first 230 lines =="
for f in repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md; do
if [ -f "$f" ]; then
echo "--- $f ---"
sed -n '1,230p' "$f" | nl -ba -v1
fi
doneRepository: afx-team/hebb-mind
Length of output: 2486
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== local git lfs config =="
git config --local --list 2>/dev/null | rg 'lfs\.' || true
echo "== current tree blobs/objects for target files if tracked =="
git ls-tree -r HEAD -- 'repo_pages/guide/framework-integrations.md' 'repo_pages/zh/guide/framework-integrations.md' || true
echo "== try read via object db if present =="
for blob in $(git ls-tree -r HEAD -- 'repo_pages/guide/framework-integrations.md' 'repo_pages/zh/guide/framework-integrations.md' | awk '{print $3}'); do
if [ -n "${blob:-}" ] && [ -f ".git/objects/${blob:0:2}/${blob:2}" ]; then
echo "--- blob ${blob:0:2}/${blob:2} ---"
git cat-file -p "$blob" | sed -n '1,260p'
else
echo "missing blob ${blob:0:2}/${blob:2}"
fi
done
echo "== try read via show if available =="
for path in repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md; do
if git cat-file -e "$path" 2>/dev/null; then
echo "--- $path ---"
git show "$path" | sed -n '1,260p'
else
echo "$path not present in HEAD"
fi
doneRepository: afx-team/hebb-mind
Length of output: 2486
🌐 Web query:
github.com/afx-team/hebb-mind repo_pages/guide/framework-integrations.md framework integrations OPENAI_API_KEY
💡 Result:
In the Hebb Mind framework, the OPENAI_API_KEY is used to enable advanced "agentic" features, specifically consolidation, conflict resolution, importance scoring, and automatic tag extraction [1][2]. Hebb Mind operates with zero external services by default, meaning ingest, vector search, CRUD operations, and the Web Console do not require an API key [1][3][4]. When you choose to use a hosted LLM provider (like OpenAI) for the advanced features mentioned above, you must configure the framework using the following CLI commands [5][2]: 1. Set the LLM model (e.g., GPT-4o): hebb config set llm_model openai/gpt-4o 2. Set your API key: hebb config set llm_api_key sk-your-openai-key If you are using a local model or a proxy server, you do not need to provide an llm_api_key [5][1][2]. The framework utilizes LiteLLM to support various providers, and for non-OpenAI endpoints, you may also need to configure the llm_base_url [6][1]. You can verify that the configuration is successful and the LLM is loaded by running the command hebb doctor [2].
Citations:
- 1: https://afx-team.github.io/hebb-mind/faq.html
- 2: https://afx-team.github.io/hebb-mind/troubleshooting.html
- 3: https://github.com/afx-team/hebb-mind
- 4: https://afx-team.github.io/hebb-mind/
- 5: https://afx-team.github.io/hebb-mind/quick-start.html
- 6: https://afx-team.github.io/hebb-mind/guide/configuration.html
Document the model credential requirement for the runnable examples. The guide claims copy-paste runnable snippets but does not mention the provider/model credential prerequisites (OPENAI_API_KEY or the local-model /proxy alternative) that the framework’s LLM config requires. Add this setup detail to both the English and Chinese guides.
📍 Affects 2 files
repo_pages/guide/framework-integrations.md#L15-L16(this comment)repo_pages/zh/guide/framework-integrations.md#L14-L15
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@repo_pages/guide/framework-integrations.md` around lines 15 - 16, Update the
introductory runnable-example guidance in
repo_pages/guide/framework-integrations.md (lines 15-16) and
repo_pages/zh/guide/framework-integrations.md (lines 14-15) to document the
required model credentials: set OPENAI_API_KEY for provider-backed models, or
configure the local-model /proxy alternative. Keep the prerequisite instructions
clear and consistent in both English and Chinese guides.
| LlamaIndex talks to MCP servers through `llama-index-tools-mcp`. We start the | ||
| `hebb-mcp` stdio server, load its tools, and hand them to an agent that can now | ||
| write and recall memories. | ||
|
|
||
| ```bash | ||
| pip install llama-index llama-index-tools-mcp llama-index-llms-openai | ||
| ``` | ||
|
|
||
| ```python | ||
| import asyncio | ||
| from llama_index.tools.mcp import McpToolSpec, BasicMCPClient | ||
|
|
||
| async def main(): | ||
| # 1. Connect to the hebb-mcp stdio server (use `which hebb-mcp` for the absolute path) | ||
| client = BasicMCPClient(command_or_url="hebb-mcp") | ||
| tools = await McpToolSpec(client).to_tool_list_async() # -> [write_memory, search_memory, ...] | ||
| search = next(t for t in tools if t.metadata.name == "search_memory") | ||
|
|
||
| # 2. Write a memory, then recall it through the loaded tool | ||
| write = next(t for t in tools if t.metadata.name == "write_memory") | ||
| print(await write.acall(content="User prefers dark mode and compact layout", | ||
| tags=["preference", "ui"], importance=7.5)) | ||
| print(await search.acall(query="UI preferences", top_k=5)) | ||
|
|
||
| asyncio.run(main()) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate and inspect the referenced guide excerpts and nearby context.
for f in repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md; do
echo "===== $f ====="
sed -n '1,110p' "$f" | cat -n
echo
done
echo "===== references to FunctionAgent/FastAgent/Agent / agent context ====="
rg -n "FunctionAgent|FastAgent|Agent|agent|llamaindex_mcp|McpToolSpec|BasicMCPClient" repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md 2>/dev/null || trueRepository: afx-team/hebb-mind
Length of output: 2486
🌐 Web query:
LlamaIndex MCP FunctionAgent BasicMCPClient McpToolSpec documentation
💡 Result:
LlamaIndex provides support for Model Context Protocol (MCP) servers through the llama-index-tools-mcp package [1][2]. The key components for integrating these tools into LlamaIndex agents are BasicMCPClient and McpToolSpec [1][2]. BasicMCPClient The BasicMCPClient is responsible for connecting to and interacting with an MCP server [2][3]. It supports various transport methods, including SSE (Server-Sent Events), HTTP, and local stdio processes [4][5]. Once connected, it provides low-level access to the server's capabilities, including: - list_tools and call_tool [6][5] - list_resources and read_resource [6][5] - list_prompts and get_prompt [5] McpToolSpec McpToolSpec acts as a bridge that converts tools from an MCP client into LlamaIndex's FunctionTool objects, making them compatible with LlamaIndex agents [6][2]. Key parameters for McpToolSpec include [6]: - client: The BasicMCPClient instance (required) [6]. - allowed_tools: An optional list of specific tool names to include [6][2]. - include_resources: A boolean flag to determine whether to include resources in the tool list [6][2]. - global_partial_params and partial_params_by_tool: Dictionaries for applying partial parameters to tools [6]. Typical Workflow To use MCP tools with an agent, you generally follow these steps [1][2]: 1. Connect to the MCP server using BasicMCPClient [1][5]. 2. Create an McpToolSpec instance using the client [1][5]. 3. Convert the MCP tools into a format usable by LlamaIndex using to_tool_list (synchronous) or to_tool_list_async (asynchronous) [2][3]. 4. Pass the resulting list of tools to an agent, such as a FunctionAgent [1][2]. Example Code Snippet from llama_index.tools.mcp import BasicMCPClient, McpToolSpec from llama_index.core.agent.workflow import FunctionAgent from llama_index.llms.openai import OpenAI # Connect to the MCP server mcp_client = BasicMCPClient("http://127.0.0.1:8000/sse") # Create the tool spec mcp_tool_spec = McpToolSpec(client=mcp_client) # Convert to LlamaIndex tools tools = await mcp_tool_spec.to_tool_list_async # Use in an agent agent = FunctionAgent( llm=OpenAI(model="gpt-4o"), tools=tools,) Alternatively, for a simpler setup, you can use the helper function get_tools_from_mcp_url (or its async version aget_tools_from_mcp_url) to fetch tools directly from an MCP URL [2][3].
Citations:
- 1: https://developers.llamaindex.ai/python/framework/module_guides/mcp/llamaindex_mcp/
- 2: https://pypi.org/project/llama-index-tools-mcp/
- 3: https://github.com/run-llama/llama_index/tree/main/llama-index-integrations/tools/llama-index-tools-mcp
- 4: https://github.com/run-llama/llama_index/blob/7fd33e00/llama-index-integrations/tools/llama-index-tools-mcp/README.md
- 5: https://developers.llamaindex.ai/python/examples/tools/mcp/
- 6: https://developers.llamaindex.ai/python/framework-api-reference/tools/mcp/
Use a LlamaIndex agent for the MCP tool examples.
Both snippets load MCP tools but then call write.acall(...) and search.acall(...) directly, so they do not show agent integration. Mirror the same FunctionAgent(... tools=tools) flow in both English and Chinese snippets.
📍 Affects 2 files
repo_pages/guide/framework-integrations.md#L41-L65(this comment)repo_pages/zh/guide/framework-integrations.md#L38-L61
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@repo_pages/guide/framework-integrations.md` around lines 41 - 65, The
LlamaIndex MCP examples call tools directly instead of demonstrating agent
integration. In repo_pages/guide/framework-integrations.md lines 41-65 and
repo_pages/zh/guide/framework-integrations.md lines 38-61, update each snippet
to create a FunctionAgent with tools=tools and route the memory write and search
requests through that agent, mirroring the same flow in both English and Chinese
examples.
| ```bash | ||
| pip install crewai crewai-tools | ||
| ``` | ||
|
|
||
| ```python | ||
| from crewai import Agent, Task, Crew | ||
| from crewai.tools import MCPServerAdapter | ||
|
|
||
| # 1. Start the hebb-mcp stdio server and load its tools | ||
| with MCPServerAdapter({"command": "hebb-mcp"}) as tools: # -> [write_memory, search_memory, ...] |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== candidate files =="
git ls-files | rg '^repo_pages/(guide/|zh/guide/)framework-integrations\.md$' || true
echo "== current snippets =="
for f in repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md; do
if [ -f "$f" ]; then
echo "--- $f ---"
nl -ba "$f" | sed -n '60,105p'
fi
done
echo "== nearby package mentions =="
rg -n "crewai-tools|crewai_tools|crewai\.tools|MCPServerAdapter|StdioServerParameters|package:.*crewai|crewai/mcp|hebb-mcp" repo_pages -S || trueRepository: afx-team/hebb-mind
Length of output: 2486
🌐 Web query:
CrewAI MCP tools MCPServerAdapter StdioServerParameters crewai_tools
💡 Result:
In CrewAI, the MCPServerAdapter is a utility class provided by the crewai-tools library that enables agents to use Model Context Protocol (MCP) servers as tools [1][2]. It serves as a bridge, managing the lifecycle of MCP server connections and exposing the server's tools to the CrewAI framework [3][1]. Core Components and Usage: 1. MCPServerAdapter: This class manages the connection to an MCP server [3][1]. It is recommended to use it as a context manager (using the with statement), which ensures the connection starts automatically and closes correctly when the operation is complete [1][4][5]. 2. StdioServerParameters: This class, imported from the mcp library, is used to configure MCP servers that communicate over standard input and output streams (stdio), which is common for local scripts or executables [6][1]. 3. Configuration: - For stdio transport: Requires StdioServerParameters specifying the command, args, and optionally env variables [6][1]. - For sse or streamable-http transports: Configured by passing a dictionary with the server url and transport type [1][4][5]. Example Integration Pattern: python from crewai_tools import MCPServerAdapter from mcp import StdioServerParameters import os # Define server parameters for a local stdio MCP server server_params = StdioServerParameters( command="python3", args=["servers/your_server.py"], env={"UV_PYTHON": "3.12", os.environ}, ) # Use MCPServerAdapter to access tools with MCPServerAdapter(server_params) as tools: # 'tools' is now a list of CrewAI-compatible tools # Pass them directly to your agent agent = Agent(..., tools=tools) Advanced Functionality: - Manual Lifecycle Management: If you need finer control, you can instantiate the MCPServerAdapter object manually, call .start() to initiate the connection, access the .tools attribute, and ensure you call .stop() to release resources [6][7]. - Multiple Servers: You can pass a list of server configurations (either dictionaries or StdioServerParameters objects) to MCPServerAdapter to aggregate tools from multiple MCP servers simultaneously [4][5]. For installation, ensure you have the necessary dependencies: pip install --upgrade "crewai-tools[mcp]" [8].
Citations:
- 1: https://docs.crewai.com/v1.15.5/en/mcp/overview
- 2: https://docs.crewai.com/v1.15.4/en/mcp/overview
- 3: https://github.com/crewAIInc/crewAI-tools/blob/main/crewai_tools/adapters/mcp_adapter.py
- 4: https://docs.crewai.com/edge/en/mcp/multiple-servers
- 5: https://docs.crewai.com/v1.15.4/en/mcp/multiple-servers
- 6: https://docs.crewai.com/en/mcp/stdio
- 7: https://github.com/crewAIInc/crewAI/tree/main/lib/crewai-tools
- 8: https://community.crewai.com/t/agents-can-discover-use-tools-hosted-on-model-context-protocol-mcp-server/5254
🌐 Web query:
crewAI-tools MCPServerAdapter import crewai_tools.MCPServerAdapter documentation
💡 Result:
The MCPServerAdapter is a class provided by the crewai-tools library designed to manage the lifecycle of Model Context Protocol (MCP) servers and integrate their tools into CrewAI agents [1][2]. Key documentation and usage details include: Lifecycle Management The recommended way to use MCPServerAdapter is as a Python context manager (using the with statement), which automatically handles starting and stopping the connection [2][3]. Example: with MCPServerAdapter(server_params) as tools: # tools is available here... Manual Management: For complex scenarios, you can manually manage the connection using the start and stop methods [2][3]. It is critical to call stop within a try...finally block to ensure that connections are closed and resources are properly released [3][4][5]. Configuration and Transports MCPServerAdapter supports several transport mechanisms [2]: - Stdio: For local MCP servers [3]. - Server-Sent Events (SSE): For remote servers [2][5]. - Streamable HTTPS: For remote servers, allowing for flexible or potentially bi-directional communication [2][6][7]. Optional Configuration: You can specify a connect_timeout parameter (default is 30 seconds) to customize how long the adapter waits to establish a connection [2]. Advanced Features - Multiple Servers: You can connect to multiple MCP servers simultaneously by passing a list of server parameter dictionaries to the adapter, which then aggregates the tools from all sources [8][9]. - Tool Filtering: You can filter the available tools either by passing a list of specific tool names to the constructor or by using dictionary-style indexing on the adapter [1][2].
Citations:
- 1: https://github.com/crewAIInc/crewAI-tools/blob/main/crewai_tools/adapters/mcp_adapter.py
- 2: https://docs.crewai.com/v1.15.5/en/mcp/overview
- 3: https://docs.crewai.com/en/mcp/stdio
- 4: https://docs.crewai.com/v1.11.0/en/mcp/stdio
- 5: https://docs.crewai.com/v1.10.1/en/mcp/sse
- 6: https://docs.crewai.com/v1.14.1/en/mcp/streamable-http
- 7: https://docs.crewai.com/edge/en/mcp/streamable-http
- 8: https://docs.crewai.com/edge/en/mcp/multiple-servers
- 9: https://docs.crewai.com/v1.15.4/en/mcp/multiple-servers
🌐 Web query:
github crewAIInc crewAI-tools mcp_adapter.py MCPServerAdapter __init__ StdioServerParameters source
💡 Result:
The MCPServerAdapter class in crewAI-tools, defined in crewai_tools/adapters/mcp_adapter.py, acts as a bridge between CrewAI and external MCP (Model Context Protocol) servers [1][2]. Its init method is designed to initialize the connection to these servers by accepting specific configuration parameters [1]. The constructor is defined as follows: def init( self, serverparams: StdioServerParameters | dict[str, Any],):... The serverparams argument accepts either an instance of StdioServerParameters (from the mcp library) for STDIO-based servers or a dictionary (e.g., {"url": "http://localhost:8000/sse"}) for SSE-based servers [1][3][4]. Key implementation details of the init method include: 1. Dependency Check: It verifies if the mcp package is available; if not, it prompts the user to install it using uv [1]. 2. Initialization: It stores the provided server parameters, initializes an underlying MCP adapter with the specified configuration, and automatically calls self.start to establish the connection and discover available tools [1]. 3. Cleanup Handling: The adapter is designed to be used either as a context manager (using the with statement) or manually, in which case it is recommended to wrap usage in a try...finally block to ensure that self.stop is explicitly called to terminate the server process and release resources [1][3][5]. The StdioServerParameters class itself is used to define the command, arguments, and environment variables required to launch a local MCP server process [3].
Citations:
- 1: https://github.com/crewAIInc/crewAI-tools/blob/3acf5493/crewai_tools/adapters/mcp_adapter.py
- 2: https://deepwiki.com/crewAIInc/crewAI-tools/2.2-mcp-server-adapter
- 3: https://docs.crewai.com/en/mcp/stdio
- 4: https://github.com/crewaiinc/crewai-tools
- 5: https://p.rst.im/q/GitHub.Com/crewAIInc/crewAI-tools
🌐 Web query:
CrewAI stdio MCP install "crewai-tools[mcp]"
💡 Result:
To use Model Context Protocol (MCP) servers with CrewAI, including those utilizing Stdio (Standard Input/Output) transport, you must install the necessary extra dependencies. Installation To enable MCP support in crewai-tools, run the following command in your terminal [1][2][3]: pip install crewai-tools[mcp] Alternatively, if you are using uv, you can run: uv add crewai-tools --extra mcp Additionally, it is recommended to install the mcp library itself for basic integration [4][5]: uv add mcp Usage Overview There are two primary ways to integrate MCP servers into your CrewAI workflow: 1. DSL Integration (Recommended for most use cases) You can define MCP servers directly within your Agent configuration using the mcps field. CrewAI handles the connection lifecycle automatically [6]. from crewai import Agent from crewai.mcp import MCPServerStdio # Example using DSL agent = Agent( role="Research Analyst", mcps=[ MCPServerStdio( command="python", args=["path/to/server.py"], env={"API_KEY": "your_key"}) ]) 2. MCPServerAdapter (Advanced control) For scenarios requiring manual connection management, use the MCPServerAdapter class. It is highly recommended to use a context manager (with statement) to ensure the server process is properly started and stopped [7][8][6]. from mcp import StdioServerParameters from crewai_tools import MCPServerAdapter stdio_params = StdioServerParameters( command="uvx", args=["--quiet", "server-name@0.1.0"], env={"VAR": "value"}) with MCPServerAdapter(server_params=stdio_params) as mcp_server: tools = mcp_server.tools # Use tools in your agent... If you manage the connection manually without a context manager, you must call mcp_server_adapter.stop to release resources [7][8][9].
Citations:
- 1: https://pypi.org/project/crewai-tools/
- 2: https://github.com/crewAIInc/crewAI-tools
- 3: https://github.com/crewAIInc/crewAI-tools/blob/3acf5493/README.md
- 4: https://docs.crewai.com/v1.15.5/en/mcp/overview
- 5: https://docs.crewai.com/v1.11.0/en/mcp/overview
- 6: https://docs.crewai.com/v1.15.2/en/mcp/dsl-integration
- 7: https://docs.crewai.com/en/mcp/stdio
- 8: https://docs.crewai.com/v1.15.1/en/mcp/stdio
- 9: https://github.com/crewAIInc/crewAI-tools/blob/main/crewai_tools/adapters/mcp_adapter.py
Correct the CrewAI MCP setup in both guides.
repo_pages/guide/framework-integrations.mdandrepo_pages/zh/guide/framework-integrations.md: install the crewAI MCP extra, importMCPServerAdapterfromcrewai_tools, importStdioServerParametersfrommcp, and pass the stdio params through the adapter context manager.
📍 Affects 2 files
repo_pages/guide/framework-integrations.md#L78-L87(this comment)repo_pages/zh/guide/framework-integrations.md#L74-L83
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@repo_pages/guide/framework-integrations.md` around lines 78 - 87, Correct the
CrewAI MCP setup in both repo_pages/guide/framework-integrations.md (lines
78-87) and repo_pages/zh/guide/framework-integrations.md (lines 74-83): install
the CrewAI MCP extra, import MCPServerAdapter from crewai_tools and
StdioServerParameters from mcp, and pass the configured stdio server parameters
through the adapter context manager instead of supplying a raw command mapping.
| AutoGen **0.4+** (the `autogen-agentchat` / `autogen-ext[mcp]` packages) loads | ||
| MCP tools with `mcp_server_tools`. We connect to `hebb-mcp` over stdio and give | ||
| the tools to a `ToolUseAssistant`. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== candidate files =="
git ls-files 'repo_pages/**/guide/framework-integrations.md' 'repo_pages/**/guide/framework-integrations.md' | sed 's#^\./##'
echo "== English target lines =="
cat -n repo_pages/guide/framework-integrations.md | sed -n '80,130p'
echo "== Chinese target lines =="
cat -n repo_pages/zh/guide/framework-integrations.md | sed -n '75,115p'
echo "== ToolUseAssistant and AssistantAgent mentions =="
rg -n "ToolUseAssistant|AssistantAgent|mcp_server_tools" repo_pages || true
echo "== repository examples/tests snippets for AutoGen MCP if present =="
git ls-files | rg -i "autogen|AutoGen|agentchat|mcp" | head -100 || trueRepository: afx-team/hebb-mind
Length of output: 2486
🌐 Web query:
AutoGen MCP tools mcp_server_tools AssistantAgent ToolUseAssistant
💡 Result:
In AutoGen, the integration of Model Context Protocol (MCP) servers is facilitated through the autogen-ext[mcp] extension package [1][2]. This extension allows AutoGen agents to utilize tools hosted on MCP servers seamlessly [3][1]. Key components and usage patterns include: mcp_server_tools This is a factory function used to connect to an MCP server and retrieve a list of available tool adapters [1]. It supports various server connection types, including StdioServerParams (for command-line based servers), SseServerParams, and StreamableHttpServerParams (for network-based servers) [3][1]. Once retrieved, these tool adapters can be passed directly into an AssistantAgent's tools parameter [3][4][1]. Usage with AssistantAgent To enable an assistant to use MCP tools, you instantiate an AssistantAgent and provide the list generated by mcp_server_tools to the tools argument [3][4]. For example: from autogen_ext.tools.mcp import StdioServerParams, mcp_server_tools from autogen_agentchat.agents import AssistantAgent server_params = StdioServerParams(command="uvx", args=["mcp-server-fetch"]) tools = await mcp_server_tools(server_params) agent = AssistantAgent(name="fetcher", model_client=model_client, tools=tools) McpWorkbench Alternatively, for more complex scenarios or when managing multiple MCP servers, the McpWorkbench class can be used [5][6]. It acts as a manager for MCP sessions and can be passed to an AssistantAgent via the workbench argument, allowing the agent to interact with multiple MCP servers as a unified workbench [5][6]. Important Considerations - Installation: You must install the required extension using pip install -U "autogen-ext[mcp]" [1]. - Security: Always exercise caution and only connect to trusted MCP servers, as they may execute commands in your local environment or have access to sensitive information [1][6]. - Session Management: For scenarios where state must be preserved across multiple tool calls (e.g., browser sessions), you can create and share an MCP client session across tool adapters [4].
Citations:
- 1: https://github.com/microsoft/autogen/blob/027ecf0a/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_factory.py
- 2: https://www.gettingstarted.ai/autogen-mcp/
- 3: https://microsoft.github.io/autogen/stable/reference/python/autogen_ext.tools.mcp.html
- 4: https://microsoft.github.io/autogen/stable/_modules/autogen_ext/tools/mcp/_factory.html
- 5: https://microsoft.github.io/autogen/dev/reference/python/autogen_ext.tools.mcp.html
- 6: https://www.repoportal.com/en/microsoft-autogen
🌐 Web query:
"ToolUseAssistant" "autogen"
💡 Result:
In the AutoGen framework, specifically within its core agent architecture, ToolUseAgent is a specialized agent designed to handle tool-based task execution [1][2]. Key aspects of the ToolUseAgent and tool usage in AutoGen include: Functionality The ToolUseAgent is responsible for coordinating the interaction between an LLM and defined tools [1]. When it receives a task, it utilizes its configured model client to generate a list of function calls based on the available tools [1][2]. It then executes these tools and, depending on the configuration, may generate a reflection on the execution results before returning a final response to the user [1][2]. Evolution in AutoGen The implementation of tool use has evolved significantly across AutoGen versions: - In earlier versions (e.g., AutoGen v0.2), tool use often required registering tools across multiple agents (e.g., one agent to call the tool and another to execute it) or using a UserProxyAgent to perform execution [3][4]. - In more recent versions (e.g., AutoGen v0.4+ and AgentChat), the process has been simplified [5]. The AssistantAgent has been enhanced to automatically call and execute tools, reducing the need for separate executor agents [6][5]. Configuration and Control - Tool Schema: Tools are defined as schemas that the model uses to understand what actions it can perform [1][7]. The AssistantAgent can automatically convert Python functions into tools, generating the necessary schema from function signatures and docstrings [6]. - Reflection: Developers can configure agents to reflect on tool outputs by setting parameters like reflect_on_tool_use=True, which instructs the model to summarize or process tool results rather than just returning the raw output [6][5]. - Intervention: Because the ToolUseAgent (or AssistantAgent) controls the execution flow, developers can implement intervention handlers to intercept tool calls—for example, to prompt a human user for approval before a tool is actually executed [7]. In summary, while ToolUseAgent serves as a foundational component for structured tool-based interaction in the core framework [1][2], modern high-level usage often leverages the AssistantAgent's built-in capabilities to streamline the execution of tools [6][5].
Citations:
- 1: https://microsoft.github.io/autogen/stable/user-guide/core-user-guide/components/tools.html
- 2: https://microsoft.github.io/autogen/0.5.7/user-guide/core-user-guide/components/tools.html
- 3: https://github.com/microsoft/autogen/blob/0.2/website/docs/tutorial/tool-use.ipynb
- 4: https://microsoft.github.io/autogen/0.2/docs/tutorial/tool-use/
- 5: https://microsoft-autogen-85.mintlify.app/guides/tool-integration
- 6: https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/agents.html
- 7: https://microsoft.github.io/autogen/stable/user-guide/core-user-guide/cookbook/tool-use-with-intervention.html
🌐 Web query:
"ToolUseAssistant" "autogen_ext.tools.mcp" "mcp_server_tools"
💡 Result:
In AutoGen, the autogen_ext.tools.mcp module provides functionality to integrate Model Context Protocol (MCP) servers into AutoGen agents [1][2]. The mcp_server_tools function is a key helper within this module, designed to facilitate the easy addition of MCP tools to an agent [3][4]. ### Key Components * mcp_server_tools: This factory function connects to a specified MCP server (supporting Stdio, SSE, or Streamable HTTP connections), automatically retrieves all available tools from that server, and returns a list of tool adapters [1][3]. These adapters can be directly passed to an AutoGen agent's tools list, enabling the agent to execute them [2][3]. * McpWorkbench: This is a more comprehensive wrapper used as a context manager [5]. It not only provides an interface to list and call tools but also supports other MCP capabilities such as resources, resource templates, and prompts [5][6]. It is often used in conjunction with a WorkbenchAgent for managing complex interactions [6][7]. ### Prerequisites To use these features, you must install the MCP extension for AutoGen: pip install "autogen-ext[mcp]" [3][7] ### Usage Example The mcp_server_tools function is commonly used for direct tool integration [4]. from autogen_ext.tools.mcp import mcp_server_tools, StdioServerParams from autogen_agentchat.agents import AssistantAgent from autogen_ext.models.openai import OpenAIChatCompletionClient # Define connection parameters for an MCP server server_params = StdioServerParams(command="npx", args=["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]) # Retrieve and use tools tools = await mcp_server_tools(server_params) agent = AssistantAgent(name="tool_user", model_client=OpenAIChatCompletionClient(model="gpt-4o"), tools=tools) ### Security Warning When connecting to MCP servers, especially using StdioServerParams, only connect to trusted servers, as these may execute commands in your local environment [3][5].
Citations:
- 1: https://microsoft.github.io/autogen/stable/reference/python/autogen_ext.tools.mcp.html
- 2: https://microsoft.github.io/autogen/dev/reference/python/autogen_ext.tools.mcp.html
- 3: https://github.com/microsoft/autogen/blob/027ecf0a/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_factory.py
- 4: https://www.gettingstarted.ai/autogen-mcp/
- 5: https://github.com/microsoft/autogen/blob/027ecf0a/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_workbench.py
- 6: https://microsoft.github.io/autogen/0.7.2/user-guide/core-user-guide/components/workbench.html
- 7: is AutoGen latest version support MCP integrate microsoft/autogen#7150
Use AssistantAgent consistently in both AutoGen descriptions.
mcp_server_tools is documented for passing tools into AssistantAgent; replace the ToolUseAssistant wording in the English page and keep the Chinese description consistent.
📍 Affects 2 files
repo_pages/guide/framework-integrations.md#L106-L108(this comment)repo_pages/zh/guide/framework-integrations.md#L102-L103
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@repo_pages/guide/framework-integrations.md` around lines 106 - 108, Update
the AutoGen description to refer to AssistantAgent instead of ToolUseAssistant.
Apply this consistency change in repo_pages/guide/framework-integrations.md
lines 106-108 and repo_pages/zh/guide/framework-integrations.md lines 102-103,
preserving the surrounding MCP tool-loading details.
| ```bash | ||
| pip install "autogen-agentchat==0.4.*" "autogen-ext[openai,mcp]" | ||
| ``` | ||
|
|
||
| ```python | ||
| import asyncio | ||
| from autogen_agentchat.agents import AssistantAgent | ||
| from autogen_ext.models.openai import OpenAIChatCompletionClient | ||
| from autogen_ext.tools.mcp import StdioServerParams, mcp_server_tools | ||
|
|
||
| async def main(): | ||
| # 1. Discover the hebb-mcp tools over stdio | ||
| params = StdioServerParams(command="hebb-mcp", args=[], read_transport="stdio", write_transport="stdio") | ||
| tools = await mcp_server_tools(params) # -> [write_memory, search_memory, ...] |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Files:"
fd -a 'framework-integrations\.md$' . | sed 's#^\./##'
echo
echo "English lines 95-130:"
sed -n '95,130p' repo_pages/guide/framework-integrations.md | cat -n
echo
echo "Chinese lines 95-130:"
sed -n '95,130p' repo_pages/zh/guide/framework-integrations.md | cat -nRepository: afx-team/hebb-mind
Length of output: 2486
🌐 Web query:
AutoGen 0.4.5 mcp_server_tools StdioServerParams read_transport write_transport
💡 Result:
In AutoGen 0.4.x, the components StdioServerParams, mcp_server_tools, and related MCP tool adapters facilitate connecting AutoGen agents to Model Context Protocol (MCP) servers [1][2]. StdioServerParams This class defines the configuration for connecting to an MCP server via standard input/output (stdio) [3]. Key attributes include: - command: The command to execute (e.g., "npx", "uvx", "docker") [4]. - args: A list of arguments passed to the command [4]. - env: A dictionary of environment variables for the process [4]. - read_timeout_seconds: A float defining the timeout for reading from the server (default is 5 seconds) [3]. mcp_server_tools This factory function is used to initialize connections and retrieve a list of available tools from an MCP server [2][5]. It accepts server_params (which can be StdioServerParams, SseServerParams, or StreamableHttpServerParams) and an optional existing ClientSession [1][2]. It returns a list of tool adapters (e.g., StdioMcpToolAdapter) that can be directly passed to an AutoGen agent [6][2]. Regarding read_transport and write_transport The AutoGen MCP implementation abstracts the low-level transport mechanisms. The mcp_server_tools function and the underlying adapter classes (like StdioMcpToolAdapter) handle the creation of the MCP session and the required read_transport and write_transport interfaces internally via the mcp Python library's session management [6][2][7]. Users generally do not need to manually configure or interact with read_transport or write_transport parameters; they are managed automatically when you initialize the server connection using StdioServerParams and mcp_server_tools [2][7]. To use these features, ensure the mcp extra for the autogen-ext package is installed: pip install -U "autogen-ext[mcp]" [2][7]
Citations:
- 1: https://microsoft.github.io/autogen/stable/reference/python/autogen_ext.tools.mcp.html
- 2: https://github.com/microsoft/autogen/blob/027ecf0a/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_factory.py
- 3: https://microsoft.github.io/autogen/stable/_modules/autogen_ext/tools/mcp/_config.html
- 4: https://mintlify.wiki/microsoft/autogen/guides/mcp-servers
- 5: https://microsoft.github.io/autogen/dev/reference/python/autogen_ext.tools.mcp.html
- 6: https://microsoft.github.io/autogen/stable/_modules/autogen_ext/tools/mcp/_factory.html
- 7: https://microsoft.github.io/autogen/stable/_modules/autogen_ext/tools/mcp/_stdio.html
🏁 Script executed:
#!/bin/bash
set -euo pipefail
git fetch --depth=1 origin main 2>/dev/null || true
git checkout -b temp_checkout main 2>/dev/null || true
echo "Files:"
fd -a 'framework-integrations\.md$' . | sed 's#^\./##'
echo
echo "English lines 95-130:"
sed -n '95,130p' repo_pages/guide/framework-integrations.md | cat -n
echo
echo "Chinese lines 95-130:"
sed -n '95,130p' repo_pages/zh/guide/framework-integrations.md | cat -n
echo
echo "AutoGen packages in docs/pipeline/requirements:"
rg -n 'autogen(-agentchat|\.agentchat)?(==|>=|~=|==0\.4|0\.4\.)|autogen-ext|mcp_server_tools|StdioServerParams|read_transport|write_transport' repo_pages . --glob '!eval/**' --glob '!node_modules/**' 2>/dev/nullRepository: afx-team/hebb-mind
Length of output: 2486
🌐 Web query:
site:microsoft.github.io/autogen/reference/python/autogen_ext.tools.mcp StdioServerParams read_transport
💡 Result:
read_transport does not appear in autogen_ext.tools.mcp.StdioServerParams. The documented field is read_timeout_seconds (default 5). StdioServerParams inherits from mcp.StdioServerParameters and is described as the STDIO MCP connection params. (microsoft.github.io)
If you meant a transport-related setting, the closest match in the docs is read_timeout_seconds.
Citations:
🌐 Web query:
Site:pypi.io/pypi/autogen-ext/0.4.5 JSON StdioServerParams read_transport write_transport
💡 Result:
In autogen-ext 0.4.5, StdioServerParams is the MCP STDIO config and only adds read_timeout_seconds; I don’t see read_transport or write_transport on that class. (pypi.org)
So if you’re looking for JSON transport, it’s not configured via StdioServerParams in 0.4.5. (microsoft.github.io)
Citations:
- 1: https://pypi.org/project/autogen-ext/?utm_source=openai
- 2: https://microsoft.github.io/autogen/dev/reference/python/autogen_ext.tools.mcp.html?utm_source=openai
🌐 Web query:
Autogen 0.4.0a11 StdioServerParams read_transport write_transport autogen-ext 0.4.0a11
💡 Result:
In the AutoGen 0.4.x ecosystem, specifically within the autogen-ext package, StdioServerParams is a configuration class used to connect AutoGen agents to Model Context Protocol (MCP) servers operating over standard I/O (STDIO) [1][2][3]. Key details regarding your query include: 1. StdioServerParams: This class inherits from the MCP library's StdioServerParameters [1][4]. It allows you to define how an MCP server is executed, including the command to run, arguments (args), environment variables (env), current working directory (cwd), and encoding settings [2][5][6]. It also includes a configurable read_timeout_seconds property (defaulting to 5) [1][2][5]. 2. Transport Mechanisms: The AutoGen MCP implementation handles the underlying communication transport automatically once you provide the StdioServerParams to a factory function, such as mcp_server_tools or when using an McpWorkbench [3][7][6]. These functions manage the creation of the StdioMcpToolAdapter, which abstracts the read and write transport logic (handling the stdin/stdout streams of the subprocess) [3][8][7]. You do not need to manually configure read_transport or write_transport; the library manages these pipes internally [8][7]. 3. Versioning (0.4.0a11): Version 0.4.0a11 is an alpha release within the 0.4.x lifecycle (which introduced a complete architecture redesign) [9]. Documentation and features for MCP integration, including StdioServerParams, are consistent with the established structure of the autogen-ext package, which provides these extended capabilities [1][3][10]. To use MCP tools in this version, ensure you have the necessary extras installed: pip install -U "autogen-ext[mcp]" You can then define your server parameters and connect them as follows: from autogen_ext.tools.mcp import StdioServerParams, mcp_server_tools server_params = StdioServerParams( command="npx", args=["@modelcontextprotocol/server-filesystem", "/path/to/files"]) # Use in your agent setup tools = await mcp_server_tools(server_params)
Citations:
- 1: https://microsoft.github.io/autogen/stable/_modules/autogen_ext/tools/mcp/_config.html
- 2: https://microsoft.github.io/autogen/stable/reference/python/autogen_ext.tools.mcp.html
- 3: https://microsoft.github.io/autogen/stable/_modules/autogen_ext/tools/mcp/_factory.html
- 4: https://microsoft.github.io/autogen/dev/_modules/autogen_ext/tools/mcp/_config.html
- 5: https://microsoft.github.io/autogen/dev/reference/python/autogen_ext.tools.mcp.html
- 6: https://mintlify.wiki/microsoft/autogen/guides/mcp-servers
- 7: https://github.com/microsoft/autogen/blob/027ecf0a/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_factory.py
- 8: https://microsoft.github.io/autogen/stable/_modules/autogen_ext/tools/mcp/_stdio.html
- 9: https://devblogs.microsoft.com/autogen/autogen-reimagined-launching-autogen-0-4/
- 10: https://pypi.org/project/autogen-ext/
🌐 Web query:
Autogen 0.3.6 autogen_ext.tools.mcp StdioServerParams read_transport write_transport
💡 Result:
In AutoGen (autogen-ext), StdioServerParams is a configuration class used to connect to a Model Context Protocol (MCP) server over STDIO [1][2]. It is defined in the autogen_ext.tools.mcp module [2]. Based on the official AutoGen documentation and source code, StdioServerParams inherits from the mcp.StdioServerParameters class [1]. It allows you to specify the command and arguments necessary to launch the MCP server process [2][3]. Regarding your query about "read_transport" and "write_transport": these specific attributes are not primary parameters of the StdioServerParams configuration class in the AutoGen SDK [2]. The AutoGen implementation of MCP handles the STDIO transport (communication via standard input and output streams) internally when you provide the command and arguments [4][5]. The primary attributes for StdioServerParams include [2]: - command: The command to execute to start the MCP server [2]. - args: A list of arguments to pass to the command [2]. - env: Optional environment variables for the server process [2]. - cwd: Optional current working directory for the process [2]. - read_timeout_seconds: A configurable timeout for read operations (defaults to 5 seconds) [1][2]. - encoding and encoding_error_handler: Configuration for character encoding [2]. If you are interacting with MCP servers in AutoGen, you typically pass these parameters to an McpWorkbench or use them with helper functions like mcp_server_tools [5][3][6]. The underlying transport mechanics—including how data is read from and written to the process—are abstracted away by the MCP client implementation (McpSessionActor) and the underlying mcp-python library [4][7].
Citations:
- 1: https://microsoft.github.io/autogen/stable/_modules/autogen_ext/tools/mcp/_config.html
- 2: https://microsoft.github.io/autogen/stable/reference/python/autogen_ext.tools.mcp.html
- 3: https://github.com/microsoft/autogen?tab=readme-ov-file
- 4: https://microsoft.github.io/autogen/stable/_modules/autogen_ext/tools/mcp/_workbench.html
- 5: https://www.aidoczh.com/autogen/stable/_modules/autogen_ext/tools/mcp/_factory.html
- 6: https://microsoft.github.io/autogen/0.6.2/user-guide/core-user-guide/components/workbench.html
- 7: https://github.com/microsoft/autogen/releases
Use the 0.4.x MCP parameter API in both AutoGen guides.
repo_pages/guide/framework-integrations.md#L110-L123andrepo_pages/zh/guide/framework-integrations.md#L105-L118pass unsupportedread_transport/write_transportarguments toStdioServerParams; AutoGen’s MCP params expose command/args/env/read_timeout_seconds, with transport handling abstracted bymcp_server_tools.- Pin
autogen-agentchat/autogen-extto compatible 0.4.x versions in both files to avoid resolving incompatible releases.
📍 Affects 2 files
repo_pages/guide/framework-integrations.md#L110-L123(this comment)repo_pages/zh/guide/framework-integrations.md#L105-L118
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@repo_pages/guide/framework-integrations.md` around lines 110 - 123, The
AutoGen MCP examples use unsupported transport parameters and unpinned package
versions. In repo_pages/guide/framework-integrations.md lines 110-123 and
repo_pages/zh/guide/framework-integrations.md lines 105-118, update the
installation commands to compatible 0.4.x autogen-agentchat/autogen-ext versions
and revise StdioServerParams to use only the supported command, args, env, and
read_timeout_seconds parameters; leave transport handling to mcp_server_tools.
| # 2. Bind them to a chat model and do a write + recall round-trip | ||
| from langchain_openai import ChatOpenAI | ||
| llm = ChatOpenAI(model="gpt-4o-mini").bind_tools(tools) | ||
| write = next(t for t in tools if t.name == "write_memory") | ||
| print(await write.ainvoke({"content": "User prefers dark mode", "tags": ["ui"], "importance": 7.5})) | ||
| print(await llm.ainvoke("What UI does the user prefer? Use your Hebb Mind tool.")) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== candidate files =="
fd -a 'framework-integrations\.md$' . | sed 's#^\./##'
echo
echo "== relevant sections =="
for f in repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md; do
if [ -f "$f" ]; then
echo "--- $f ---"
nl -ba "$f" | sed -n '120,185p'
fi
done
echo
echo "== imports/tool definitions/usages in repo_pages/guide/framework-integrations.md =="
rg -n "langchain|ToolNode|bind_tools|search_memory|write_memory|create_function_tool_agent|create_react_agent|Graph|conditional|astart|agent_executor|LangGraph|mcp" repo_pages/guide/framework-integrations.md repo_pages/zh/guide/framework-integrations.md || trueRepository: afx-team/hebb-mind
Length of output: 2486
🌐 Web query:
LangGraph agents bind_tools ToolNode conditional routing invokes tools example
💡 Result:
In LangGraph, creating an agent that uses tools involves binding tools to the LLM, executing those tools with a ToolNode, and using conditional routing to loop between the agent and the tool execution [1][2]. The fundamental workflow is: 1. Bind Tools: Use model.bind_tools(tools) to inform the LLM about available tools [2][3][4]. 2. Create Nodes: Define an agent node (to invoke the LLM) and a ToolNode (a prebuilt node that automatically executes requested tool calls) [1][5][4]. 3. Configure Conditional Routing: Use the prebuilt tools_condition function to check if the last message contains tool calls [6][7]. This function routes to "tools" if calls are present or "end" if they are not [6][7]. Here is a concise implementation example: from langgraph.graph import StateGraph, START, END from langgraph.prebuilt import ToolNode, tools_condition from langchain_openai import ChatOpenAI # 1. Bind tools to the model model = ChatOpenAI(model="gpt-4o").bind_tools(tools) # 2. Define the agent node def call_model(state): response = model.invoke(state["messages"]) return {"messages": [response]} # 3. Build the graph graph = StateGraph(State) graph.add_node("agent", call_model) graph.add_node("tools", ToolNode(tools)) # 4. Define the routing logic graph.add_edge(START, "agent") graph.add_conditional_edges("agent", tools_condition) graph.add_edge("tools", "agent") # Loop back to agent after tool execution app = graph.compile The tools_condition helper simplifies routing by returning "tools" if the last message has tool_calls, or END if it does not, which is the standard pattern for ReAct-style agent loops [6][1][7]. If custom logic is required, you can replace tools_condition with a custom function that inspects state["messages"][-1].tool_calls [8][4].
Citations:
- 1: https://www.bethecoder.com/applications/tutorials/agentic-ai/langgraph/langgraph-tool-calling-agent.html
- 2: https://www.crewship.dev/learn/langgraph-tools
- 3: https://langchain-opentutorial.gitbook.io/langchain-opentutorial/17-langgraph/01-core-features/03-langgraph-agent
- 4: https://fridaynight.wiki/langgraph/04-tools-and-agents
- 5: https://github.com/agentspan-ai/agentspan/blob/main/sdk/python/examples/langgraph/05_tool_node.py
- 6: https://reference.langchain.com/python/langgraph.prebuilt/prebuilt/tool_node/tools_condition
- 7: https://reference.langchain.com/python/langgraph.prebuilt/tool_node/tools_condition
- 8: https://docs.langchain.com/oss/python/langgraph/quickstart
Add an execution loop that invokes the MCP tools after bind_tools().
bind_tools() only produces tool-call requests; the model will not call search_memory unless the code routes tool calls to ToolNode/a supported agent constructor. Apply the same graph or agent-executor pattern in both repo_pages/guide/framework-integrations.md and the Chinese copy.
📍 Affects 2 files
repo_pages/guide/framework-integrations.md#L162-L167(this comment)repo_pages/zh/guide/framework-integrations.md#L156-L161
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@repo_pages/guide/framework-integrations.md` around lines 162 - 167, Update
the chat-model example after ChatOpenAI.bind_tools in
repo_pages/guide/framework-integrations.md (lines 162-167) and
repo_pages/zh/guide/framework-integrations.md (lines 156-161) to add a supported
tool-execution loop, such as a ToolNode graph or agent executor, that routes
model tool calls to the MCP tools and returns tool results for subsequent model
reasoning; preserve the existing write-and-recall behavior in both language
versions.
| ## How it works | ||
|
|
||
| ``` | ||
| LlamaIndex / CrewAI / AutoGen / LangGraph | ||
| │ (stdio) | ||
| v | ||
| hebb-mcp (MCP server) ──or── httpx/requests ──> REST API | ||
| │ (HTTP) │ (port 8321) | ||
| v v | ||
| hebb service (REST API on 8321, OS background service) | ||
| │ | ||
| Storage / Embedder / Searcher / Tag graph | ||
| ``` |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Replace both ASCII architecture diagrams with Mermaid.
repo_pages/guide/framework-integrations.md#L193-L205: convert the English flow to Mermaid.repo_pages/zh/guide/framework-integrations.md#L186-L198: convert the Chinese flow to Mermaid.
As per coding guidelines: repo_pages/**/*.md must use mermaid for architecture and data-flow diagrams.
📍 Affects 2 files
repo_pages/guide/framework-integrations.md#L193-L205(this comment)repo_pages/zh/guide/framework-integrations.md#L186-L198
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@repo_pages/guide/framework-integrations.md` around lines 193 - 205, Replace
the ASCII architecture diagrams in repo_pages/guide/framework-integrations.md
lines 193-205 and repo_pages/zh/guide/framework-integrations.md lines 186-198
with Mermaid diagrams. Preserve each diagram’s existing framework-to-MCP/REST
API-to-hebb service flow, HTTP/stdio labels, port 8321 details, and downstream
storage/embedder/searcher/tag graph relationships; translate the Chinese
diagram’s labels appropriately.
Source: Coding guidelines
| # 在 Python Agent 框架中使用 Hebb Mind | ||
|
|
||
| Hebb Mind 目前对外提供两套接口,任何 Python agent 框架都能直接调用,无需安装原生适配包: | ||
|
|
||
| - **MCP stdio 服务**(`hebb-mcp`),暴露 `write_memory` / `search_memory` / | ||
| `consolidate` / `ingest_conversation` 四个工具(见 [MCP 集成](./mcp-integration.md))。 | ||
| - **REST API**,地址 `http://localhost:8321` —— `POST /api/v1/search`(body | ||
| `{"query": ..., "top_k": ...}`)与 `POST /api/v1/memories`。 | ||
|
|
||
| 下面每个框架给一段可直接复制运行的示例,均假设本地 Hebb Mind 服务已在 | ||
| `http://localhost:8321` 运行。 |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Keep the Chinese page Chinese outside code and product identifiers.
The prose mixes English terms such as Agent, agent, embedding, and WIP skeleton into Chinese sentences. Translate these descriptions consistently; package names, class names, and code identifiers may remain unchanged.
As per coding guidelines: repo_pages/**/*.md must not mix Chinese and English in the same document (per-language pages only).
Also applies to: 166-169
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@repo_pages/zh/guide/framework-integrations.md` around lines 5 - 15,
统一修改该中文页面中的说明性文字,将 Agent、agent、embedding、WIP skeleton
等非产品或代码标识的英文术语翻译为中文,并覆盖评论指出的后续段落(166-169);保留 Hebb Mind、hebb-mcp、API
路径、包名、类名及代码块中的标识符不变,确保整篇 repo_pages 中文页面不在中文句子中混用英文。
Source: Coding guidelines
"## docs(integrations): copy-paste "connect in 10 lines" recipes for LlamaIndex / CrewAI / AutoGen / LangGraph\n\n> Closes #29\n\n### \u6982\u8ff0\n\n\u4e3a LlamaIndex\u3001CrewAI\u3001AutoGen\u3001LangGraph \u56db\u4e2a Python agent \u6846\u67b6\u65b0\u589e"\u7ea6 10 \u884c\u53ef\u590d\u5236"\u7684\u63a5\u5165\u793a\u4f8b\u6587\u6863\u9875\uff08EN + zh \u955c\u50cf\uff09\uff0c\u5728\u539f\u751f per-framework adapter \u843d\u5730\u524d\uff0c\u5148\u628a"\u8d34\u6bb5\u4ee3\u7801\u5c31\u80fd\u8fde\u4e0a"\u7684\u95e8\u69db\u6253\u4e0b\u6765\u3002**\u7eaf\u6587\u6863\u4efb\u52a1\uff0c\u96f6\u8fd0\u884c\u65f6\u4ee3\u7801**\u2014\u2014\u6240\u6709\u793a\u4f8b\u90fd\u590d\u7528\u5df2\u53d1\u5e03\u7684 MCP stdio server\uff08
hebb-mcp\uff09\u4e0e REST API\uff08/api/v1\uff09\uff0c\u4e0d\u5f15\u5165\u65b0\u5e93\u4ee3\u7801\u3002\n\n\u6bcf\u4e2a\u6846\u67b6\u6311\u6469\u64e6\u6700\u4f4e\u7684\u63a5\u53e3\u8def\u5f84\uff1a\n| \u6846\u67b6 | \u8def\u5f84 | \u63a5\u53e3 |\n|------|------|------|\n| LlamaIndex | MCP\uff08MCPClient\uff09 |hebb-mcpstdio \u2192McpToolSpec|\n| CrewAI | MCP\uff08MCPServerAdapter\uff09 |hebb-mcpstdio \u2192Agent(tools=...)|\n| AutoGen 0.4+ | MCP\uff08mcp_server_tools\uff09 |hebb-mcpstdio \u2192StdioServerParams|\n| LangGraph | MCP\uff08langchain-mcp-adapters\uff09 |hebb-mcpstdio \u2192get_tools()|\n\nREST API \u4f5c\u4e3a\u515c\u5e95\u8def\u5f84\u5728\u6bcf\u4e2a\u6846\u67b6\u4e0b\u4e5f\u7ed9\u51fa\u4e86\u8bf4\u660e\u3002\n\n### \u6539\u52a8\u6587\u4ef6\n\n- \u65b0\u589erepo_pages/guide/framework-integrations.md\u2014\u2014 EN \u6587\u6863\u9875\n- \u65b0\u589erepo_pages/zh/guide/framework-integrations.md\u2014\u2014 zh \u955c\u50cf\u9875\uff08\u7eaf\u4e2d\u6587\uff0c\u4e0d\u6df7\u8bed\u8a00\uff09\n- \u6539repo_pages/.vitepress/config.mts\u2014\u2014 sidebarguideSidebar()\u52a0\u4e00\u884c\uff0cEN + zh \u81ea\u52a8\u751f\u6548\n- \u6539README.md\u2014\u2014 Installation Paths \u6bb5\u843d\u540e\u52a0\u4e00\u6761\u6307\u5411\u65b0\u9875\u7684\u94fe\u63a5\n- \u6539examples/README.md\u2014\u2014 "Pick your starting point" \u4e0e Contributing \u6bb5\u5404\u52a0\u4e00\u6761\u94fe\u63a5\n\n### \u9a8c\u6536\u6807\u51c6\u5bf9\u7167\uff08issue #29\uff09\n\n- [x] \u65b0\u589e EN \u6587\u6863\u9875repo_pages/guide/\uff0c\u542b LlamaIndex / CrewAI / AutoGen / LangGraph \u56db\u6bb5 ~10 \u884c snippet\n- [x] zh \u955c\u50cf\u9875repo_pages/zh/guide/\uff0c\u540c\u6837\u56db\u6bb5 snippet\uff0c\u65e0\u4e2d\u82f1\u6df7\u6392\uff08\u9075\u5faa CLAUDE.md L69\uff09\n- [x] \u6bcf\u6bb5 snippet \u5747\u5bf9\u672c\u5730http://localhost:8321\u53ef\u8fd0\u884c\uff0c\u53ea\u7528\u5df2\u6709\u63a5\u53e3\uff08MCP \u5de5\u5177search_memory/write_memory\uff0c\u6216 RESTPOST /api/v1/search\u3001POST /api/v1/memories\uff09\n- [x] \u65b0\u9875\u52a0\u5165 VitePress sidebar\uff08config.mts\uff09\uff0cEN + zh \u5747\u751f\u6548\n- [x] README.md \u96c6\u6210\u533a\u4e0e examples/README.md \u5747\u6dfb\u52a0\u94fe\u63a5\n- [x] \u672a\u5f15\u5165\u4efb\u4f55\u8fd0\u884c\u65f6\u5e93\u4ee3\u7801\uff08\u4ec5\u6587\u6863\uff09\n\n### \u8bbe\u8ba1\u8bf4\u660e\n\n- \u63a5\u53e3\u7b7e\u540d\u7cbe\u786e\u5bf9\u9f50\u6e90\u7801\uff1asnippet \u4e2d\u7684\u5de5\u5177\u540d\u4e0e\u53c2\u6570\uff08write_memory(content, tags, importance)\u3001search_memory(query, top_k)\uff09\u5747\u53d6\u81easrc/hebb/mcp/server.py\u5b9e\u9645\u7b7e\u540d\uff0c\u975e\u51ed\u8bb0\u5fc6\u675c\u64b0\u3002\n- AutoGen \u7248\u672c\u663e\u5f0f\u9501\u5b9a\uff1aissue \u672a\u6307\u5b9a\u7248\u672c\uff0c\u672c PR \u9009 0.4+ \u5e76\u5728\u6587\u6863\u4e2d\u52a0::: warning\u63d0\u793a 0.2 \u65e7\u7248\u7684\u5dee\u5f02\uff0c\u907f\u514d\u8e29\u5751\u3002\n- \u4e0d\u89e6\u78b0 WIP \u9aa8\u67b6\uff1aexamples/05_langchain_adapter.py\u7684\u539f\u751fBaseRetriever\u9002\u914d\u5668\u660e\u786e\u5217\u5728 issue \u7684 out of scope\uff0c\u672c PR \u4ec5\u5728 LangGraph \u6bb5\u843d\u4ee5 tip \u5f62\u5f0f\u8bf4\u660e\u5b83\u662f\u72ec\u7acb\u540e\u7eed\u4efb\u52a1\u3002\n- \u98ce\u683c\u5bf9\u9f50\uff1a\u65b0\u9875\u7ed3\u6784\uff08Prerequisites tip / Available surfaces / \u6bcf\u6846\u67b6\u4e00\u8282 / Which surface \u8868 / How it works \u56fe\uff09\u4e0e\u5df2\u6709mcp-integration.md\u4fdd\u6301\u4e00\u81f4\uff0c\u542b\u7edd\u5bf9\u8def\u5f84\u63d0\u793a\u3002\n\n### \u6d4b\u8bd5\u8ba1\u5212\n\n- [ ] \u672c\u5730pipx install hebb-mind && hebb setup && hebb service install\uff0c\u786e\u8ba4localhost:8321\u53ef\u8fbe\n- [ ] \u56db\u6bb5 snippet \u9010\u4e00\u76f4\u63a5python\u8dd1\u901a\uff08write + search \u5f80\u8fd4\uff09\u2014\u2014 \u9700\u5bf9\u5e94\u6846\u67b6\u5df2pip install\n- [ ]cd repo_pages && npm install && npm run dev\uff0c\u786e\u8ba4\u65b0\u9875\u5728 VitePress \u7ad9\u70b9 EN + zh \u4fa7\u8fb9\u680f\u5747\u51fa\u73b0\u4e14\u94fe\u63a5\u53ef\u8fbe\n- [ ] GitHub Actions \u7684 docs build / conventional-commit \u68c0\u67e5\u901a\u8fc7\n\n---\n\ud83e\udd16 \u7531\u5c0f\u864e \ud83d\udc2f \u534f\u52a9\u8d77\u8349\u3002Snippet \u672a\u5728 CI \u73af\u5883\u5b9e\u8dd1\uff08\u672c\u673a\u672a\u5b89\u88c5\u56db\u4e2a\u6846\u67b6\u7684\u4f9d\u8d56\uff09\uff0c\u8bf7\u7ef4\u62a4\u8005\u6309\u300c\u6d4b\u8bd5\u8ba1\u5212\u300d\u9010\u9879\u9a8c\u8bc1\u540e\u518d\u5408\u5e76\uff1b\u5982\u53d1\u73b0\u67d0\u6846\u67b6 API \u5df2\u53d8\uff0c\u6b22\u8fce\u6307\u51fa\uff0c\u6211\u636e\u6b64\u4fee\u6b63\u3002"Summary by CodeRabbit
New Features
Documentation