Sub-Family
Enables sending prompts and image inputs to Ollama-hosted models through OpenAI-compatible Chat Completions, with persistent sessions, bounded concurrency, health probing, and local trust handling.
Enables delegating prompts to OpenAI models through the OpenAI-compatible Chat Completions API, with sessions, vision where supported, token limits, and cloud trust redaction.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Sub-Family
English | Русский
Sub-Family is an MCP server that turns a YAML list of local and cloud LLMs into a family of delegates for Claude Code, with persistent sessions, bounded parallel fan-out, vision, and trust-aware redaction.
Claude Code / any MCP client
│ MCP over stdio
▼
sub-family-mcp
├── registry ...... family.yaml (members, trust, limits)
├── sessions ...... SQLite history per (member, session_id)
├── guard ......... secret redaction, hard blocks, image policy
└── HTTP client ... OpenAI-compatible Chat Completions
├── local farm: Ollama, LM Studio, vLLM, llama.cpp server
└── cloud APIs: DeepSeek, OpenAI, OpenRouter, any gatewayWhy it exists
Claude Code is good at planning and verification, but there are tasks it should not run on the primary model or on more local subagents:
The local farm is already busy. Spawning another local subagent competes for the same GPU and context. Sub-Family sends a whole batch to one member (local or cloud) with a hard concurrency limit, so fan-out does not melt the machine.
Subagents are heavier than a model call. A built-in subagent is a separate agent loop with its own tools and context. A family member is a direct chat completion: cheaper, faster, and predictable, with the main agent keeping the final judgement.
Not every task may go to the cloud. Screenshots, private code, and drafts belong on hardware you control; architecture reviews and large audits can use a cloud model. Trust tiers make that choice explicit, and redaction is applied before a prompt leaves the box.
Related MCP server: colmena-mcp
Features
YAML registry (default
~/.config/sub-family/family.yaml, or%APPDATA%\sub-family\family.yamlon Windows) with strict validation, model ids, base URLs, trust levels, cost tiers, capabilities, timeouts, and per-member concurrency.Cost-aware routing metadata: every member is
free,paid, orelectricity(self-hosted power only), and the agent sees the tier when it chooses a delegate. Omitted values are inferred from trust.Seven MCP tools: inspect the family, probe health, ask one member, run a parallel swarm, list sessions, read history, reset a session.
Persistent sessions in SQLite, keyed by
(member, session_id), with a sliding window and restart survival.Bounded parallel fan-out via
ask_family_swarm; a failing branch does not fail the call, and optional synthesis merges the successful outputs.Vision from local paths,
http(s)URLs, or base64 data URIs, restricted to members that declare thevisioncapability.Trust-aware security: secret redaction for untrusted cloud members, user-defined hard blocks for every member, image policy, and prompt limits.
No vendor SDK: one
httpxadapter covers every OpenAI-compatible endpoint, with explicit retries, timeouts, TLS, andextra_bodysupport.CLI and TUI: scriptable
sub-familycommands plus a full-screen Textual editor for members.stdio only: no daemon, no listening port, no server to keep alive.
Requires Python 3.11+, the official MCP Python SDK 2.x, and an OpenAI-compatible model endpoint. MIT licensed.
Quickstart
1. Install
# uv: https://docs.astral.sh/uv/
uv tool install sub-family-mcp # installs `sub-family` and `sub-family-mcp`
uvx sub-family-mcp --version # or run once without installinguvx sub-family-mcp starts the MCP server. The administrative commands use the
sub-family entry point installed by uv tool install.
Local development install:
git clone https://github.com/MistaKilla/Sub-Family-MCP.git
cd Sub-Family-MCP
uv sync --extra dev
uv run sub-family init2. Create the config
sub-family initThis writes a commented starter with two members:
big_brother— DeepSeekdeepseek-chatviaDEEPSEEK_API_KEY, trusted asuntrusted_cloud.lilbro— a local Qwen vision model athttp://192.168.1.50:11434. Replace this address with a real machine, or remove the member.
sub-family init refuses to overwrite an existing file unless you pass
--force; a .bak copy is kept.
3. Edit members
Use the TUI:
sub-family uiOr add a member from flags:
sub-family members add farm_two \
--base-url http://192.168.1.51:11434 \
--model qwen2.5-coder:7b \
--trust local \
--cost electricity \
--capability code \
--capability fastMember names are lowercase, start with a letter, and may contain digits, _,
or -.
4. Set API keys
Prefer environment variables:
export DEEPSEEK_API_KEY="sk-..."Or put keys in ~/.config/sub-family/.env, which the CLI and server load
automatically without overriding exported variables:
# ~/.config/sub-family/.env
DEEPSEEK_API_KEY=sk-...chmod 600 ~/.config/sub-family/.envLocal endpoints such as Ollama usually need no key. See
Configuration for api_key_env, custom headers, and
literal keys.
5. Check reachability
sub-family statusstatus probes every member's /models endpoint without generating tokens. It
exits non-zero if an enabled member is unreachable. Use
sub-family status --member lilbro or --json for a single member or
machine-readable output.
6. Connect Claude Code
claude mcp add --scope user sub-family -- uvx sub-family-mcpRestart Claude Code and ask it to call list_family:
Use list_family and tell me which models are available and what they are good at.For a custom config path, pass it after the package name:
claude mcp add --scope user sub-family -- \
uvx sub-family-mcp --config /absolute/path/to/family.yamlProject-scoped .mcp.json, environment expansion, and delegation recipes are
covered in Claude Code integration.
Minimal configuration
version: 1
members:
big_brother:
description: "Cloud heavyweight for architecture, hard debugging and code review."
base_url: "https://api.deepseek.com"
model: "deepseek-chat"
api_key_env: "DEEPSEEK_API_KEY"
trust: "untrusted_cloud"
cost: "paid"
capabilities: ["reasoning", "code", "long_context"]
max_clones: 5
timeout_s: 300
max_tokens: 8192
lilbro:
description: "Small local vision model for screenshots, diagrams and quick OCR."
base_url: "http://192.168.1.50:11434"
model: "qwen2.5-vl:7b"
trust: "safe_local"
cost: "electricity"
capabilities: ["vision", "fast", "chat"]
max_clones: 1
timeout_s: 120
max_tokens: 2048
sessions:
enabled: true
max_messages: 40
max_chars: 80000
ttl_days: 30
security:
redact_secrets: true
redact_trust: ["untrusted_cloud"]
deny_images_to_remote: false
max_image_mb: 20
expose_reasoning: false
swarm:
max_tasks: 12
max_result_chars: 12000
default_synthesize: falseThe full commented starter is in
examples/family.example.yaml, generated from
the same template as sub-family init. Every field, default, URL rule, and
backend example is documented in Configuration.
Tools
Tool | What it does | Use it when |
| Returns members, models, trust, cost, capabilities, context windows, clone limits, and enabled state. | Once per session, before choosing a delegate. |
| Probes each member's | Before a large fan-out, after a failure, or when a local machine may be offline. |
| Sends one prompt to one member; optional persistent session, images, system prompt, temperature, and token limit. | One well-scoped task: review, second opinion, screenshot analysis, focused generation. |
| Runs independent prompts against one member in parallel, bounded by | Three or more independent subtasks: audit five modules, test several files, compare approaches. |
| Lists persisted sessions, newest first, with message counts and previews. | Discovering an earlier session id, or checking whether a branch has history. |
| Returns recent messages of one session. | Recovering exact earlier context. Prefer letting |
| Deletes one session, or every session of a member with | A task is finished and stale context should not leak into later work. |
Common arguments:
ask_family:member,prompt,session_id,images(up to 8),system,temperature,max_tokens.ask_family_swarm:member,tasks(up toswarm.max_tasks),session_prefix,max_concurrency,context,synthesize.Session ids are 1-64 characters from letters, digits,
.,_,:,-, starting with a letter or digit.
A failed member call becomes an MCP tool error with an actionable message. A
failed swarm branch becomes a per-branch {ok: false, error: ...} result, so
the other branches still return.
Sessions and swarms
A session is a server-side conversation with one member. The primary model does not need to carry the transcript:
You: Use ask_family with member big_brother and session_id "billing-refactor":
review src/billing/parser.py for rounding and idempotency bugs.
Claude: [calls ask_family; gets a review]
You: Continue the same session. Propose a minimal patch for the top issue.The second request replays the first exchange from SQLite on the server. Claude
sees only the new answer, which keeps its context small. Sessions survive MCP
and Claude Code restarts, are isolated per member, and are trimmed to
sessions.max_messages / sessions.max_chars. Reset a finished session with
reset_session.
Swarm is for genuinely independent work:
You: Use ask_family_swarm with member big_brother, session_prefix "audit-may",
tasks:
1. Review src/auth for injection and session fixation.
2. Review src/billing for rounding and idempotency bugs.
3. Review migrations/ for destructive changes.
4. Review the HTTP retry logic for duplicate writes.
5. Review the Dockerfile for secrets and root user.
Use synthesize: true and return one prioritized report.What happens:
Five requests run concurrently, never more than
big_brother'smax_clones.Branch N gets session
audit-may-N, so each branch can be continued later.One failing branch does not fail the call; its result carries
ok: falseanderror.synthesize: truemakes one extra request that merges successful outputs.Per-branch content is truncated to
swarm.max_result_chars(default 12,000 characters) before it reaches the primary model.
Trust, cost, and security
Trust level | Intended use | Redaction by default | Images |
| Model on hardware you control. | None | Allowed. |
| Remote endpoint you operate. | None | Allowed with a warning. |
| Third-party API. | Secret patterns replaced. | Allowed with a warning; can be denied. |
Cost is a separate axis from trust:
Cost tier | Meaning | Typical member |
| No marginal cost (free API tier, included subscription). | OpenRouter free model, free cloud quota. |
| Metered per request/token. | DeepSeek, OpenAI, a paid gateway. |
| Self-hosted hardware; only power. | Ollama/LM Studio/vLLM on your own machines. |
If cost is omitted, Sub-Family infers it: safe_local becomes electricity,
everything else becomes paid. The list_family result includes cost and
cost_source (explicit or inferred) so the agent can prefer cheap members
for bulk work and reserve paid ones for hard tasks. This is routing metadata,
not billing: Sub-Family does not track or cap spend.
Before sending to an untrusted_cloud member, the guard redacts known credential
shapes (private keys, sk- keys, GitHub/AWS/Google/Slack tokens, JWTs, bearer
tokens, URL passwords, and common env-style assignments) and reports what it
changed. security.redact_trust extends that to other tiers.
security.blocked_patterns is a stronger tool: user-defined regexes are checked
for every member, including local ones, and a match refuses the call.
This is a seatbelt, not a sandbox. Redaction misses novel formats, short keys, secrets split across lines, and anything inside an image. Never paste real credentials into a prompt intending to rely on it. Read the full security model.
CLI overview
Global option: --config/-c points at a non-default family.yaml.
Command | Purpose |
| Write the commented starter config. |
| Open the Textual member editor (requires a TTY). |
| Probe reachability; exits 1 on failure. |
| Check config, storage, keys, and optionally probe endpoints. |
| List configured members. |
| Manage members. |
| Inspect or edit the config; |
| Inspect and clean SQLite history. |
| Print MCP registration JSON and the |
| Show resolved config, env, data, and database paths. |
| Run the MCP server over stdio. |
| Print the installed version. |
All commands are scriptable and print errors without tracebacks. members add
accepts repeated --capability flags; members edit changes only the fields
you pass. Full options are in Configuration or
sub-family <command> --help.
Supported backends
Any endpoint that implements OpenAI Chat Completions can be a member.
Backend | Example | Notes |
Ollama |
|
|
LM Studio |
| Start the local server and load the model. |
vLLM |
|
|
llama.cpp server |
| Use the OpenAI-compatible server mode. |
DeepSeek |
|
|
OpenAI |
| Standard API key. |
OpenRouter |
| Use a model id from its catalogue. |
Other gateways | Your OpenAI-compatible root | Use |
The base-URL rules and ready-to-copy YAML for each backend are in Configuration.
Troubleshooting quick hits
Symptom | First move |
|
|
HTTP 401 or 403 | Check |
HTTP 404, or | Fix |
Connection refused or timeout | Confirm the endpoint is running and bound beyond loopback; check firewall and |
Requests hit the wrong path | Set |
Images rejected | Add the |
Text was changed before sending | Inspect |
| It needs a TTY; use |
| Install uv, or use |
See Troubleshooting for exact messages and fixes.
Development
git clone https://github.com/MistaKilla/Sub-Family-MCP.git
cd Sub-Family-MCP
uv sync --extra dev
uv run pytest -q
uv run ruff check .
uv run ruff format --check .
uv run mypy srcThe test suite uses pytest-asyncio, respx for HTTP mocking, and in-memory
MCP clients; no live model endpoint is required. The Textual TUI is excluded
from strict mypy in pyproject.toml.
See CONTRIBUTING.md for development conventions and Architecture for the layer boundaries and request flow.
Documentation
Configuration — every field, paths, trust levels, backend examples, backup.
Architecture — layers, request flows, concurrency, SQLite schema, provider extension.
Security — threat model, redaction rules, image policy, API key storage, reporting.
Claude Code integration — registration,
CLAUDE.md, recipes, context cost, startup debugging.Troubleshooting — common errors and fixes.
Publishing — release checklist, PyPI trusted publishing, MCP Registry.
CHANGELOG.md — release history.
SECURITY.md — supported versions and private reporting.
License
MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Chat, image, video, and audio models from many vendors behind one remote MCP server and one key.
OpenAI-compatible BYOK LLM gateway: per-task routing, shadow evaluation, promotion gates.
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
AI routing, memory, guardrails, and governance. Routes across Claude, GPT, Gemini.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables Claude Code and Claude Desktop to delegate bounded, disposable tasks to local or cheap cloud models, with model scoring, guardrails, and cost-saved tracking.53MIT
- AlicenseBqualityBmaintenanceEnables Claude Code to act as a project manager that delegates coding tasks to a pool of worker agents (Codex and OpenCode) defined as aliases in a YAML config, handling priority-based budget routing, parallelism with queues, resumable sessions, isolated git worktrees, and non-destructive merges. It returns token-cheap result reports with diffs and costs, plus Windows toast notifications and papercraft-style HTML round summaries.17MIT
- FlicenseNot gradedqualityAmaintenanceEnables coding agents and OpenAI- or Anthropic-compatible clients to send chat requests through a single local pooled endpoint that spans free provider tiers, with keyless startup, automatic failover, model discovery, and capacity/health inspection tools.-
- AlicenseNot gradedqualityAmaintenanceEnables Claude Code and other MCP clients to offload bounded tasks to a local or cloud LLM (LM Studio, Ollama, vLLM, LiteLLM, OpenRouter, DeepSeek, Groq, Cerebras, OpenAI) so files are read and drafted outside the orchestrator's context window, cutting token costs. It also provides a cheap second model for code review, test stubs, commit messages, format conversion, and embeddings.MIT