Skip to content

nanoclaw-extras

What this does in one paragraph

This is a small set of standalone "extras" for NanoClaw, a house AI-harness project (part of the wider Codex-harness fleet). It gives NanoClaw's containerized agents access to the host machine's local Ollama models over MCP: extras/ollama-mcp.mjs is a zero-dependency stdio MCP server that bridges tools/call requests to Ollama's HTTP API (ollama_list_models, ollama_generate), and extras/wire-ollama.sh copies that bridge into every NanoClaw agent group and registers it as an MCP server via NanoClaw's own CLI (src/cli/client.ts). Nothing here talks to any external network service — only the local Ollama instance on the host, reached through host.docker.internal.

Not fleet-shared material

The wider Codex-harness-mirror fleet (Codex, Gemini/NanoClaw, Odysseus, Grok) shares a common brief and system-prompt set that is deliberately out of scope for this repo and parked for a separate effort. This repo only contains the Ollama-bridge extras, which are specific to NanoClaw's own CLI/group model and stand alone — they do not duplicate or depend on any fleet-shared brief material.

How this drops into a NanoClaw checkout

These two files are designed to live at extras/ inside an actual NanoClaw project checkout (that is why wire-ollama.sh reads extras/ollama-mcp.mjs and cds to $(dirname "$0")/.. to find src/cli/client.ts and groups/). To use them:

# from inside a NanoClaw checkout, after `pnpm run setup:auto`:
cp /path/to/nanoclaw-extras/extras/ollama-mcp.mjs extras/ollama-mcp.mjs
cp /path/to/nanoclaw-extras/extras/wire-ollama.sh extras/wire-ollama.sh
bash extras/wire-ollama.sh            # wire every existing agent group
bash extras/wire-ollama.sh <group-id> # wire just one group

Then, inside a NanoClaw chat, ask the agent to "list your ollama models" to verify the MCP server is registered and reachable.

Configuration

ollama-mcp.mjs reads two environment variables (set by wire-ollama.sh when it registers the MCP server — see .env.example):

Var Default Purpose
OLLAMA_HOST http://host.docker.internal:11434 Base URL of the host's Ollama instance
DEFAULT_MODEL qwen3:8b Model used when ollama_generate gets no model argument

Repository layout

extras/    ollama-mcp.mjs, wire-ollama.sh  (the shippable payload; drop into a NanoClaw checkout)
tests/     ollama-mcp.test.mjs (node:test), wire-ollama.test.sh + stub-client.mjs (hermetic bash E2E), run-tests.sh (single entry point)
archive/   superseded files, kept for history (never deleted; secrets scrubbed). Do NOT run.
docs/      technical + plain-language docs, architecture diagram, security notes, board, journal
TESTING.md the full testing matrix (unit + coverage + churn + E2E)

Never-delete / archive policy

Superseded files are never deleted — they move to archive/ with a history-encoding filename (...CURRENT-<date>.STALE-<date>.superseded-by-<reason>.ext) and a header block explaining what replaced them and why. Any secrets in an archived file are scrubbed the same as in live files.

Security

  • No secrets of any kind live in this repo. The bridge only talks to a local Ollama instance (no API key, no auth) over host.docker.internal; there is nothing to redact.
  • .env is gitignored; .env.example documents the two configuration variables above (neither is sensitive — they are a local URL and a model name — but the pattern matches the rest of the house fleet for consistency).
  • CI runs a secret-pattern grep and a Semgrep scan (see docs/technical/SECURITY.md).
  • See TESTING.md for the full 4-layer test matrix.