/ 目录 / 演练场 / Nanobot
● 社区 HKUDS ⚡ 即开即用

Nanobot

作者 HKUDS · HKUDS/nanobot

If FastMCP and Upsonic feel heavy: Nanobot is a few hundred lines of Python that gives you a working personal agent with MCP support.

Nanobot is an academic-style minimal agent framework. Strips most abstraction; you bring tools and an LLM, it gives you the loop. Use it when you want a teachable, hackable baseline for an MCP-aware agent.

为什么要用

核心特性

实时演示

实际使用效果

就绪

安装

选择你的客户端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "nanobot-mcp": {
      "command": "uvx",
      "args": [
        "nanobot",
        "serve",
        "--mcp"
      ]
    }
  }
}

打开 Claude Desktop → Settings → Developer → Edit Config。保存后重启应用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "nanobot-mcp": {
      "command": "uvx",
      "args": [
        "nanobot",
        "serve",
        "--mcp"
      ]
    }
  }
}

Cursor 使用与 Claude Desktop 相同的 mcpServers 格式。项目级配置优先于全局。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "nanobot-mcp": {
      "command": "uvx",
      "args": [
        "nanobot",
        "serve",
        "--mcp"
      ]
    }
  }
}

点击 Cline 侧栏中的 MCP Servers 图标,然后选 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "nanobot-mcp": {
      "command": "uvx",
      "args": [
        "nanobot",
        "serve",
        "--mcp"
      ]
    }
  }
}

格式与 Claude Desktop 相同。重启 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "nanobot-mcp",
      "command": "uvx",
      "args": [
        "nanobot",
        "serve",
        "--mcp"
      ]
    }
  ]
}

Continue 使用服务器对象数组,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "nanobot-mcp": {
      "command": {
        "path": "uvx",
        "args": [
          "nanobot",
          "serve",
          "--mcp"
        ]
      }
    }
  }
}

加入 context_servers。Zed 保存后热重载。

claude mcp add nanobot-mcp -- uvx nanobot serve --mcp

一行命令搞定。用 claude mcp list 验证,claude mcp remove 卸载。

使用场景

实战用法: Nanobot

Learn the agent loop by reading the source

👤 Developers ⏱ ~15 min intermediate

何时使用: You want to understand what FastMCP / Upsonic do under the hood.

步骤
  1. Read
    Open the main module — single-file core.✓ 已复制
    → Mental model
  2. Run
    Start the bot; call its MCP tools from Claude.✓ 已复制
    → Works
  3. Modify
    Add a tool or change the planner.✓ 已复制
    → Fork ready

结果: Working hackable baseline for your own agent.

组合

与其他 MCP 搭配,撬动十倍杠杆

nanobot-mcp + fastmcp-prefect

Prototype with Nanobot; harden with FastMCP for production

Combine nanobot-mcp with fastmcp-prefect: Prototype with Nanobot; harden with FastMCP for production✓ 已复制

工具

此 MCP 暴露的能力

工具输入参数何时调用成本
run (see docs) Run a task through the nanobot loop 1 call

成本与限制

运行它的成本

API 配额
Bound by LLM
每次调用 Token 数
Normal
费用
Free OSS
提示
Keep tool sets small — Nanobot is minimal, not magical

安全

权限、密钥、影响范围

凭据存储: LLM keys in env
数据出站: Configured provider

故障排查

常见错误与修复

Planner gets stuck

Add a step budget; minimal planners need explicit halts

替代方案

Nanobot 对比其他方案

替代方案何时用它替代权衡
FastMCPProduction serverMore framework

更多

资源

📖 阅读 GitHub 上的官方 README

🐙 查看未解决的 issue

🔍 浏览全部 400+ MCP 服务器和 Skills