From 174af74d43e0fa80e364498f5a8172af57217fc5 Mon Sep 17 00:00:00 2001 From: Jonathan Zhang Date: Fri, 12 Dec 2025 17:01:29 +0800 Subject: [PATCH 1/6] add mcp.json to .gitignore --- .gitignore | 3 ++- mini_agent/config/mcp.json | 29 ----------------------------- 2 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 mini_agent/config/mcp.json diff --git a/.gitignore b/.gitignore index d23f70a..29e5df9 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ Thumbs.db # Config (contains API keys) config.yaml +mcp.json # test file demo.py @@ -58,4 +59,4 @@ docs/assets/preview.html claude.md -.agent_memory.json \ No newline at end of file +.agent_memory.json diff --git a/mini_agent/config/mcp.json b/mini_agent/config/mcp.json deleted file mode 100644 index f618680..0000000 --- a/mini_agent/config/mcp.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "mcpServers": { - "minimax_search": { - "description": "MiniMax Search - Powerful web search and intelligent browsing ⭐", - "type": "stdio", - "command": "uvx", - "args": [ - "--from", - "git+https://github.com/MiniMax-AI/minimax_search", - "minimax-search" - ], - "env": { - "JINA_API_KEY": "", - "SERPER_API_KEY": "", - "MINIMAX_API_KEY": "" - }, - "disabled": true - }, - "memory": { - "description": "Memory - Knowledge graph memory system (long-term memory based on graph database)", - "command": "npx", - "args": [ - "-y", - "@modelcontextprotocol/server-memory" - ], - "disabled": true - } - } -} \ No newline at end of file From 641006c1d5b70a78e1ba0b199ccb69f0d354a5cd Mon Sep 17 00:00:00 2001 From: Jonathan Zhang Date: Fri, 12 Dec 2025 17:01:48 +0800 Subject: [PATCH 2/6] add mcp-example.json --- mini_agent/config/mcp-example.json | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 mini_agent/config/mcp-example.json diff --git a/mini_agent/config/mcp-example.json b/mini_agent/config/mcp-example.json new file mode 100644 index 0000000..0ed05aa --- /dev/null +++ b/mini_agent/config/mcp-example.json @@ -0,0 +1,29 @@ +{ + "mcpServers": { + "minimax_search": { + "description": "MiniMax Search - Powerful web search and intelligent browsing ⭐", + "type": "stdio", + "command": "uvx", + "args": [ + "--from", + "git+https://github.com/MiniMax-AI/minimax_search", + "minimax-search" + ], + "env": { + "JINA_API_KEY": "", + "SERPER_API_KEY": "", + "MINIMAX_API_KEY": "" + }, + "disabled": true + }, + "memory": { + "description": "Memory - Knowledge graph memory system (long-term memory based on graph database)", + "command": "npx", + "args": [ + "-y", + "@modelcontextprotocol/server-memory" + ], + "disabled": true + } + } +} From 491fd75b631b75483f2f9070bc60978c04525bac Mon Sep 17 00:00:00 2001 From: Jonathan Zhang Date: Fri, 12 Dec 2025 17:04:27 +0800 Subject: [PATCH 3/6] use mcp.example.json by default in pytests --- tests/test_integration.py | 8 ++++---- tests/test_mcp.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test_integration.py b/tests/test_integration.py index 7a2a36a..7a87ccf 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -72,16 +72,16 @@ async def test_basic_agent_usage(): # Load MCP tools (optional) - with timeout protection try: - # MCP tools are disabled by default to prevent test hangs - # Enable specific MCP servers in mcp.json if needed + # MCP tools are disabled by default to prevent test hangs. + # To enable, copy mcp-example.json to mcp.json and edit it. mcp_tools = await load_mcp_tools_async( - config_path="mini_agent/config/mcp.json" + config_path="mini_agent/config/mcp-example.json" ) if mcp_tools: print(f"✓ Loaded {len(mcp_tools)} MCP tools") tools.extend(mcp_tools) else: - print("⚠️ No MCP tools configured (mcp.json is empty)") + print("⚠️ No MCP tools configured (config is empty or disabled)") except Exception as e: print(f"⚠️ MCP tools not loaded: {e}") diff --git a/tests/test_mcp.py b/tests/test_mcp.py index 02df63e..d28c244 100644 --- a/tests/test_mcp.py +++ b/tests/test_mcp.py @@ -12,7 +12,7 @@ @pytest.fixture(scope="module") def mcp_config(): """Read MCP configuration.""" - mcp_config_path = Path("mini_agent/config/mcp.json") + mcp_config_path = Path("mini_agent/config/mcp-example.json") with open(mcp_config_path, encoding="utf-8") as f: return json.load(f) @@ -24,7 +24,7 @@ async def test_mcp_tools_loading(): try: # Load MCP tools - tools = await load_mcp_tools_async("mini_agent/config/mcp.json") + tools = await load_mcp_tools_async("mini_agent/config/mcp-example.json") print(f"Loaded {len(tools)} MCP tools") @@ -56,7 +56,7 @@ async def test_git_mcp_loading(mcp_config): try: # Load MCP tools - tools = await load_mcp_tools_async("mini_agent/config/mcp.json") + tools = await load_mcp_tools_async("mini_agent/config/mcp-example.json") print("\n✅ Loaded successfully!") print("\n📊 Statistics:") @@ -111,7 +111,7 @@ async def test_git_mcp_tool_availability(): print("\n=== Testing Git MCP Tool Availability ===") try: - tools = await load_mcp_tools_async("mini_agent/config/mcp.json") + tools = await load_mcp_tools_async("mini_agent/config/mcp-example.json") if not tools: pytest.skip("No MCP tools loaded") @@ -137,7 +137,7 @@ async def test_mcp_tool_execution(): print("\n=== Testing MCP Tool Execution ===") try: - tools = await load_mcp_tools_async("mini_agent/config/mcp.json") + tools = await load_mcp_tools_async("mini_agent/config/mcp-example.json") if not tools: print("⚠️ No MCP tools loaded, skipping execution test") @@ -180,7 +180,7 @@ async def main(): print("=" * 80) print("Running MCP Integration Tests") print("=" * 80) - print("\nNote: These tests require Node.js and will use MCP servers defined in mcp.json") + print("\nNote: These tests require Node.js and will use MCP servers defined in mcp-example.json or your local mcp.json") print("Tests will pass even if MCP is not configured.\n") await test_mcp_tools_loading() From fbaa02b05f2252720ef856ff0c55de8ec43e52fd Mon Sep 17 00:00:00 2001 From: Jonathan Zhang Date: Fri, 12 Dec 2025 17:05:19 +0800 Subject: [PATCH 4/6] use mcp.example.json by default in example --- examples/04_full_agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/04_full_agent.py b/examples/04_full_agent.py index f23f4a2..1ffbbaa 100644 --- a/examples/04_full_agent.py +++ b/examples/04_full_agent.py @@ -90,12 +90,12 @@ async def demo_full_agent(): # Load MCP tools (if configured) try: - mcp_tools = await load_mcp_tools_async(config_path="mini_agent/config/mcp.json") + mcp_tools = await load_mcp_tools_async(config_path="mini_agent/config/mcp-example.json") if mcp_tools: tools.extend(mcp_tools) print(f"✓ Loaded {len(mcp_tools)} MCP tools") else: - print("⚠️ No MCP tools configured (mcp.json is empty or disabled)") + print("⚠️ No MCP tools configured (config is empty or disabled)") except Exception as e: print(f"⚠️ MCP tools not loaded: {e}") From 45bae326ebc993a04b1feb179824d87f441d5ce9 Mon Sep 17 00:00:00 2001 From: Jonathan Zhang Date: Fri, 12 Dec 2025 17:05:48 +0800 Subject: [PATCH 5/6] update quick setup script to download mcp.example.json --- scripts/setup-config.ps1 | 4 ++-- scripts/setup-config.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/setup-config.ps1 b/scripts/setup-config.ps1 index edeae84..c2c62e6 100644 --- a/scripts/setup-config.ps1 +++ b/scripts/setup-config.ps1 @@ -63,9 +63,9 @@ try { Write-ColorOutput " ✗ Failed to download: config.yaml" -Color "Red" } -# Download mcp.json (optional) +# Download mcp.json (optional, from example template) try { - $mcpUrl = "$GITHUB_RAW_URL/mcp.json" + $mcpUrl = "$GITHUB_RAW_URL/mcp-example.json" $mcpPath = Join-Path $CONFIG_DIR "mcp.json" Invoke-WebRequest -Uri $mcpUrl -OutFile $mcpPath -UseBasicParsing Write-ColorOutput " ✓ Downloaded: mcp.json" -Color "Green" diff --git a/scripts/setup-config.sh b/scripts/setup-config.sh index cb523b3..078202b 100755 --- a/scripts/setup-config.sh +++ b/scripts/setup-config.sh @@ -48,8 +48,8 @@ else echo -e "${RED} ✗ Failed to download: config.yaml${NC}" fi -# Download mcp.json (optional) -if curl -fsSL "$GITHUB_RAW_URL/mcp.json" -o "$CONFIG_DIR/mcp.json" 2>/dev/null; then +# Download mcp.json (optional, from example template) +if curl -fsSL "$GITHUB_RAW_URL/mcp-example.json" -o "$CONFIG_DIR/mcp.json" 2>/dev/null; then echo -e "${GREEN} ✓ Downloaded: mcp.json${NC}" FILES_COPIED=$((FILES_COPIED + 1)) fi From b973c20feeaa7e30c856d3446d6ac6ea2d2b5ca8 Mon Sep 17 00:00:00 2001 From: Jonathan Zhang Date: Fri, 12 Dec 2025 17:05:54 +0800 Subject: [PATCH 6/6] update readme --- README.md | 9 +++++++++ README_CN.md | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/README.md b/README.md index 3eb3a73..a56b489 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,10 @@ api_base: "https://api.minimax.io" # Global model: "MiniMax-M2" ``` +(Optional) MCP tools (web search, memory): +- The setup script also downloads a template `mcp.json` to `~/.mini-agent/config/mcp.json`. +- Edit it to enable servers and add API keys, or leave it disabled to run without MCP tools. + **Start Using:** ```bash @@ -176,6 +180,11 @@ Copy-Item mini_agent\config\config-example.yaml mini_agent\config\config.yaml vim mini_agent/config/config.yaml # Or use your preferred editor ``` +(Optional) Configure MCP tools: +- Copy `mini_agent/config/mcp-example.json` to `mini_agent/config/mcp.json` (this file is gitignored). +- Edit `mini_agent/config/mcp.json` to enable MCP servers and set API keys. +- If you skip this, Mini Agent still runs but without MCP tools. + Fill in your API Key and corresponding API Base: ```yaml diff --git a/README_CN.md b/README_CN.md index 7512bae..a0e5e60 100644 --- a/README_CN.md +++ b/README_CN.md @@ -118,6 +118,10 @@ api_base: "https://api.minimaxi.com" # 国内版 model: "MiniMax-M2" ``` +(可选)MCP 工具(网页搜索、记忆等)配置: +- 配置脚本也会下载一个模板 `mcp.json` 到 `~/.mini-agent/config/mcp.json`。 +- 如需启用 MCP 服务器,请编辑该文件并填写 API Key;不配置也可正常运行(仅不加载 MCP 工具)。 + **开始使用:** ```bash @@ -176,6 +180,11 @@ Copy-Item mini_agent\config\config-example.yaml mini_agent\config\config.yaml vim mini_agent/config/config.yaml # 或使用您偏好的编辑器 ``` +(可选)配置 MCP 工具: +- 将 `mini_agent/config/mcp-example.json` 复制为 `mini_agent/config/mcp.json`(该文件已加入 gitignore)。 +- 编辑 `mini_agent/config/mcp.json`,启用需要的 MCP 服务器并填写 API Key。 +- 不配置也可运行,但不会加载 MCP 工具。 + 填入您的 API Key 和对应的 API Base: ```yaml