Extending G6¶
G6 ships with 200+ built-in components, but you are not limited to them. You can add your own capabilities as extensions — small packages that G6 discovers at runtime and exposes across every surface (MCP, REST, CLI).
You build on the installed app — you don't modify G6's source
G6 is proprietary software and does not accept external source contributions. Extensions are the supported way to add your own functionality: they live in your own g6ext.* namespace, ship as your package, and run in a sandbox — kept separate from G6's core mvp.* modules.
How extensions work¶
An extension is a folder you drop into ~/.g6/extensions/. On the next start G6:
- discovers it from its
manifest.json, - loads your
AIBlockand optional MCP tools / REST routes, - exposes it across MCP, REST, and the CLI like any built-in component,
- sandboxes it in a subprocess at the isolation level you choose, and
- hot-reloads it when you edit the files — no rebuild.
Every component in G6 is a harness — a unit that wraps execution with a declared contract, verification, and a recovery path (see Every component is a harness). Your extension plugs into the same surfaces as the built-ins.
Build your first extension¶
The step-by-step tutorial walks through a working text_summarizer extension — manifest, AIBlock, MCP tools, install, and tests:
What you can add¶
| Add | How |
|---|---|
| A new component (operations callable via MCP/REST/CLI) | block.py with an AIBlock subclass returning Result |
| MCP tools for Claude Code and other clients | tools.py with a register(server) function |
| REST endpoints | routes.py listed in your manifest |
| Tier-gated or sandboxed capabilities | tier and sandbox fields in manifest.json |
Related¶
- Build an Extension — the full tutorial
- Component Model —
AIBlock,Result, and contracts - Self-Hosting — running G6 on your own infrastructure
- Core Types — the SDK primitives you import (
mvp.core.ai_block,mvp.core.result)