nanobot
CLAUDE.md1.4k starsChanged 3 months agoApache-2.0View on GitHub
Nanobot is a standalone MCP (Model Context Protocol) host that enables building agents with MCP and MCP-UI. Unlike built-in MCP hosts in applications like VSCode, Claude, or ChatGPT, Nanobot is designed to be an open-source, deployable solution that combines MCP servers with LLMs to create agent experiences through external interfaces such as Obot. The project is written in Go. Technology Stack: - Go 1.26.0 with GORM (SQLite, MySQL, PostgreSQL) and goja (JavaScript runtime for hooks) Core Components: Key Architectural Patterns:
We split this CLAUDE.md into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 122
Test files are named *_test.go
- Very specific: line 123
Run all tests: go test ./...
- Very specific: line 124
Run specific package tests: go test ./pkg/agents
- Very specific: line 125
Run specific test: go test ./pkg/agents -run TestName
- Very specific: line 132
Update corresponding Go types in pkg/types/hooks.go
- Very specific: line 144
Use mcp.SessionFromContext(ctx) to get current session
- Distinctive: line 155
When implementing MCP features, refer to:
≈ “Common” is an estimate: at least 1 in 5 of the 25,680 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Nanobot is a standalone MCP (Model Context Protocol) host that enables building agents with MCP and MCP-UI. Unlike built-in MCP hosts in applications like VSCode, Claude, or ChatGPT, Nanobot is designed to be an open-source, deployable solution that combines MCP servers with LLMs to create agent experiences through external interfaces such as Obot. The project is written in Go.
Technology Stack:
- Go 1.26.0 with GORM (SQLite, MySQL, PostgreSQL) and goja (JavaScript runtime for hooks)
Build and Development Commands
Backend (Go)
# Build the nanobot binary
make
# Run nanobot with a configuration file
./bin/nanobot run ./nanobot.yaml
# Run Go tests
go test ./...
# Run a specific test
go test ./pkg/agents -run TestName
# Format Go code
gofmt -w .Architecture Overview
Backend Architecture
Core Components:
- Runtime (
pkg/runtime/) - Main orchestration layer that initializes the system. Creates and wires together the LLM client, tool service, agents, and sampling components. Manages the overall execution environment. - Agents (
pkg/agents/) - Agent execution engine that handles tool mapping, request population, and agent interactions. Responsible for running agents backed by LLMs with access to tools. - Tools Service (
pkg/tools/) - Central registry for tools and agents. Handles tool discovery, mapping, and execution delegation. Manages MCP server connections. - MCP Layer (
pkg/mcp/) - MCP protocol implementation including sessions, clients, servers, and wire protocols. Handles both stdio and HTTP transports. Key types:Session- Manages MCP session lifecycle and message routingClient- MCP client implementation for connecting to serversWire- Protocol transport abstraction (stdio/HTTP)
- LLM Integration (
pkg/llm/) - Abstraction over different LLM providers (OpenAI, Anthropic). Routes requests to appropriate providers based on model names. Handles both completion and response APIs. - Session Management (
pkg/session/,pkg/sessiondata/) - Manages user sessions, conversation state, and session-scoped data. Handles agent context, tool mappings, and resource mappings within sessions. Supports parent-child session relationships and database-backed OAuth token storage. - Server Layer (
pkg/server/) - HTTP server handling MCP protocol over HTTP. Routes requests for initialize, tools/list, tools/call, prompts/, resources/, etc. Manages session creation and request routing. - Built-in MCP Servers (
pkg/servers/) - Nanobot includes several built-in MCP servers:agent/- Exposes individual agents as MCP servers with chat capabilitiescapabilities/- Session initialization and capability management (workspace setup)meta/- Metadata and introspection tools (list_chats, update_chat, list_agents)resources/- Database-backed resource management (create_resource, delete_resource) with automatic mimetype detectionworkspace/- Workspace and session management (create/update/delete workspaces, session reading)
- Configuration (
pkg/config/) - YAML-based configuration loading and validation. Supports profiles, extends (inheritance), and environment variables. Seepkg/config/schema.yamlfor the complete schema.
Key Architectural Patterns:
- Tool Mappings - Tools from MCP servers are mapped to agent-accessible tools. The
BuildToolMappingsmethod creates this mapping by resolving tool references from agents and MCP servers. - Hooks - Lifecycle hooks for agents and MCP servers (config, request, response). Hooks are TypeScript/JavaScript functions that can modify configuration and messages. See
hooks.tsfor type definitions. - Sandboxing - MCP servers can run in Docker containers for isolation. The
pkg/mcp/sandbox/handles containerization and port mapping.
Nanobot does not bundle a frontend. External UIs communicate through MCP endpoints, /api/events, and the browser proxy routes.
Configuration
Configuration is YAML-based. Key top-level sections:
agents- Define agents with their models, tools, instructions, and behaviorsmcp-servers- MCP server configurations (command, URL, Docker image, etc.)prompts- Template definitionspublish- Defines what to expose when Nanobot itself acts as an MCP serverenv- Environment variable definitions with descriptions and defaultsauth- Authentication configuration (OAuth, remote headers)profiles- Configuration profiles for different environmentsextends- Inherit from other configuration files
Example minimal configuration:
agents:
myagent:
name: My Agent
model: gpt-4
mcpServers: my-mcp-server
mcpServers:
my-mcp-server:
url: https://example.com/mcpImportant Go Packages
pkg/types/- Core type definitions shared across the system (Config, Agent, Message, ToolCall, etc.)pkg/complete/- Utility package for handling option completion and mergingpkg/expr/- Expression evaluation for dynamic values in configurationspkg/schema/- JSON Schema validation and manipulationpkg/supervise/- Process supervision for running MCP server subprocessespkg/sampling/- Handles MCP sampling requests (LLM-in-the-loop)pkg/envvar/- Environment variable handling with descriptions and defaultspkg/cmd/- CLI command handling (routes frommain.go)
Entry Points and Special Modes
Main Entry Point: main.go routes commands to pkg/cmd
Special _exec Mode: Nanobot can act as a daemon wrapper for MCP server subprocesses. When invoked with _exec as the first argument, it handles stdio piping and process lifecycle management for MCP servers. This enables Nanobot to supervise and manage MCP server processes.
Testing
Go tests follow standard Go conventions:
- Test files are named
*_test.go - Run all tests:
go test ./... - Run specific package tests:
go test ./pkg/agents - Run specific test:
go test ./pkg/agents -run TestName
Common Patterns
Adding a New Agent Hook
- Define TypeScript types in
hooks.ts(root level) - Update corresponding Go types in
pkg/types/hooks.go - Implement hook handling in
pkg/agents/or relevant package - Hook execution is managed through
pkg/mcp/hooks.go
Adding a New Tool
- Tools come from MCP servers (external or built-in servers in
pkg/servers/) - Tool resolution happens in
pkg/tools/service.go
Working with Sessions
- Sessions are scoped to MCP connections
- Use
mcp.SessionFromContext(ctx)to get current session - Session state includes tool mappings, current agent, and custom attributes
- Parent sessions can be accessed via
Session.Parent - Root session can be accessed via
session.Root()
MCP Protocol Notes
Nanobot supports both MCP standard and MCP-UI extensions:
- Standard MCP: tools, prompts, resources, sampling
- MCP-UI: Elicitations (user input prompts), progress notifications, structured UI elements
When implementing MCP features, refer to:
- MCP types in
pkg/mcp/types.go - Message handling in
pkg/mcp/message.go - Protocol reference at
https://modelcontextprotocol.io
Code Style
- Go: Follow standard Go conventions, use
gofmt
Trending
Quiet since May.about the whole repository
Who's talking about nanobot-ai/nanobot
- @mcp-community.bsky.social“Exciting development in the MCP ecosystem: Nanobot, a project for turning MCP servers into Rich Agents. …”Bluesky · Sep 19, 2025 · 4 likes
- obot-platform/obot“feat: allow multi-user servers to have user-defined headers”GitHub · Apr 30, 2026 · 2 reactions
- clebersantz/nanobot-poc“Add ODOO CRM integration using AI Agent/RAG”GitHub · Feb 24, 2026 · 1 reactions
- Homebrew/homebrew-core“nanobot 0.0.78”GitHub · May 6, 2026
- Homebrew/homebrew-core“nanobot 0.0.77”GitHub · May 1, 2026
The biggest 5 of 45 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 45
Talked about on GitHub and Bluesky (45 times).
On GitHub · 44
- Apr 30, 2026feat: allow multi-user servers to have user-defined headers — obot-platform/obot2 reactions · 3 comments
- Feb 24, 2026Add ODOO CRM integration using AI Agent/RAG — clebersantz/nanobot-poc1 reaction
- May 6, 2026nanobot 0.0.78 — Homebrew/homebrew-core0 reactions · 1 comment
- May 1, 2026nanobot 0.0.77 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 28, 2026nanobot 0.0.76 — Homebrew/homebrew-core0 reactions · 1 comment
39 more on GitHub
- Apr 28, 2026nanobot 0.0.75 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 27, 2026nanobot 0.0.74 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 24, 2026nanobot 0.0.73 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 24, 2026enhance: implement explicit hook mutation permission — obot-platform/obot0 reactions
- Apr 23, 2026nanobot 0.0.72 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 23, 2026nanobot 0.0.71 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 22, 2026nanobot 0.0.70 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 22, 2026Update nanobot image for improved workflow skill — obot-platform/obot0 reactions
- Apr 22, 2026nanobot 0.0.69 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 17, 2026nanobot 0.0.68 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 16, 2026Add support for more LLM providers — obot-platform/obot0 reactions · 1 comment
- Apr 16, 2026nanobot 0.0.67 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 16, 2026Add Bifrost provider dialect and enable model providers in UI — obot-platform/obot0 reactions
- Apr 14, 2026nanobot 0.0.66 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 13, 2026nanobot 0.0.65 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 10, 2026nanobot 0.0.64 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 10, 2026nanobot 0.0.62 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 8, 2026Use Nanobot's new config format + model provider dialects — obot-platform/obot0 reactions · 3 comments
- Apr 6, 2026fix: skip enforcing message policies for thread title requests — obot-platform/obot0 reactions
- Mar 31, 2026enhance: support docx preview — obot-platform/obot0 reactions
- Mar 27, 2026nanobot 0.0.61 — Homebrew/homebrew-core0 reactions · 1 comment
- Mar 19, 2026nanobot 0.0.60 — Homebrew/homebrew-core0 reactions · 1 comment
- Mar 13, 2026enhance: hide BrowserView controls until the agent has a browser — obot-platform/obot0 reactions
- Mar 4, 2026ci: add cross-platform build matrix — obot-platform/nanobot0 reactions
- Mar 3, 2026nanobot 0.0.58 — Homebrew/homebrew-core0 reactions · 1 comment
- Feb 27, 2026nanobot 0.0.56 — Homebrew/homebrew-core0 reactions · 1 comment
- Feb 27, 2026fix: ui: use proper paths when connecting to Nanobot — obot-platform/obot0 reactions
- Feb 24, 2026enhance: display file metadata in nanobot files table — obot-platform/obot0 reactions · 1 comment
- Feb 14, 2026Is this the fake official website? — HKUDS/nanobot0 reactions · 3 comments
- Feb 8, 2026Nanobot vs Nanobot — HKUDS/nanobot0 reactions · 4 comments
- Feb 6, 2026nanobot 0.0.55 — Homebrew/homebrew-core0 reactions · 1 comment
- Feb 5, 2026nanobot 0.0.54 — Homebrew/homebrew-core0 reactions · 1 comment
- Feb 5, 2026nanobot 0.0.53 — Homebrew/homebrew-core0 reactions · 1 comment
- Feb 4, 2026nanobot 0.0.52 — Homebrew/homebrew-core0 reactions · 1 comment
- Feb 3, 2026nanobot 0.0.51 — Homebrew/homebrew-core0 reactions · 1 comment
- Jan 12, 2026nanobot 0.0.50 — Homebrew/homebrew-core0 reactions · 1 comment
- Jan 12, 2026Renovate Dashboard :robot: — jrmatherly/obot-entraid0 reactions · 3 comments
- Jan 11, 2026Renovate Dashboard — jrmatherly/obot-entraid0 reactions · 1 comment
- Jan 10, 2026fix(container): update image ghcr.io/nanobot-ai/nanobot ( v0.0.47 ➔ v0.0.49 ) — jrmatherly/talos-k8s-cluster0 reactions
On Bluesky · 1
- Sep 19, 2025Exciting development in the MCP ecosystem: Nanobot, a project for turning MCP servers into Rich Agents. Great to see the community building… — @mcp-community.bsky.social4 likes and reposts
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

