Context Broker
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| REDIS_URL | No | Redis URL used for caching full load_chat_context responses when set. | |
| HF_HUB_OFFLINE | No | Set to 1 to disable Hugging Face downloads entirely. | |
| CONTEXT_BROKER_PORT | No | Port for network transports; serve defaults to 8771. | 8771 |
| TRANSFORMERS_OFFLINE | No | Set to 1 to disable Transformers downloads entirely. | |
| CONTEXT_BROKER_DEVICE | No | Torch device for the embedding model. | cpu |
| CONTEXT_BROKER_LLM_MODEL | No | Optional LLM model identifier exposed to MCP clients. | |
| CONTEXT_BROKER_REDIS_URL | No | Redis URL when backend is redis. | |
| CONTEXT_BROKER_TRANSPORT | No | Transport: stdio (default), sse, or streamable-http. | stdio |
| CONTEXT_BROKER_AUTH_TOKEN | No | Bearer token required on WS transport and dashboard when set. | |
| CONTEXT_BROKER_LOCAL_ONLY | No | Prefer cache-only loading, with one bootstrap download if missing. | 0 |
| CONTEXT_BROKER_LLM_API_KEY | No | Optional LLM API key. | |
| CONTEXT_BROKER_STORAGE_DIR | No | Base directory for global storage. | ~/.context-broker |
| CONTEXT_BROKER_LLM_BASE_URL | No | Optional LLM API endpoint URL. | |
| CONTEXT_BROKER_PROJECT_ROOT | No | Default project root. | Auto-detected |
| CONTEXT_BROKER_STORAGE_MODE | No | Storage mode: global, in-project, or both. | both |
| CONTEXT_BROKER_AUTO_LOAD_ENV | No | Load the nearest .env file at startup. | 1 |
| CONTEXT_BROKER_DEFAULT_QUERY | No | Default auto-context query. | main entry point configuration setup |
| CONTEXT_BROKER_DASHBOARD_HOST | No | Dashboard bind host. | 127.0.0.1 |
| CONTEXT_BROKER_DASHBOARD_PORT | No | Dashboard bind port. | 8770 |
| CONTEXT_BROKER_MEMORY_POOL_MB | No | Bounds estimated retained cache payloads for the shared service. | 256 |
| CONTEXT_BROKER_CONTEXT_BACKEND | No | Cross-chat backend: none, honcho, or redis. | none |
| CONTEXT_BROKER_EMBEDDING_MODEL | No | Sentence-transformers model for embeddings. | all-MiniLM-L6-v2 |
| CONTEXT_BROKER_INDEX_DISK_CACHE | No | Persist corpus embeddings under .cache/. | 1 |
| CONTEXT_BROKER_REDIS_KEY_PREFIX | No | Redis key prefix. | context-broker |
| CONTEXT_BROKER_USE_ACCOUNT_NAME | No | Use the OS account name as default user peer id. | 0 |
| CONTEXT_BROKER_SHARED_RUNTIME_DIR | No | Relocates the shared service runtime descriptor directory. | ~/.cache/context-broker/service |
| CONTEXT_BROKER_HONCHO_WORKSPACE_ID | No | Honcho workspace id. | context-broker |
| CONTEXT_BROKER_INDEX_MAX_FILE_BYTES | No | Skip files larger than N bytes (0 disables). | 2000000 |
| CONTEXT_BROKER_WORKTREE_SHARED_ROOT | No | Share index/cache/storage across linked git worktrees. | 1 |
| CONTEXT_BROKER_ACCOUNT_NAME_OVERRIDE | No | Explicit override for the resolved user peer id. | |
| CONTEXT_BROKER_EXIT_WHEN_PARENT_DIES | No | Exit when the launching editor/AI process disappears. | 1 |
| CONTEXT_BROKER_HONCHO_CONTEXT_TOKENS | No | Default Honcho context token budget. | 2000 |
| CONTEXT_BROKER_HONCHO_SESSION_PREFIX | No | Honcho session id prefix. | context-broker |
| CONTEXT_BROKER_INDEX_FOLLOW_SYMLINKS | No | Follow symlinks while collecting files. | 0 |
| CONTEXT_BROKER_CHAT_CACHE_TTL_SECONDS | No | TTL for the Redis chat-payload cache (0 disables). | 300 |
| CONTEXT_BROKER_AUTO_WARM_CACHE_ON_SAVE | No | Invalidates then warms the default-params chat cache on save. | 1 |
| CONTEXT_BROKER_HONCHO_LIMIT_TO_SESSION | No | Limit Honcho context/search to selected session. | 1 |
| CONTEXT_BROKER_QUERY_CACHE_MAX_ENTRIES | No | Queries keep at most this many entries per project. | 128 |
| CONTEXT_BROKER_REGEX_MAX_PATTERN_CHARS | No | Max caller regex length for find_in_codebase. | 2000 |
| CONTEXT_BROKER_UCR_PUBLIC_SURFACE_ONLY | No | Expose only the minimal UCR router surface. | 0 |
| CONTEXT_BROKER_ALLOW_UNAUTHENTICATED_BIND | No | Permit non-loopback binds without AUTH_TOKEN. | 0 |
| CONTEXT_BROKER_QUERY_CACHE_MAX_FILE_BYTES | No | Cap for disk query-cache files. | 4000000 |
| CONTEXT_BROKER_REGEX_MATCH_TIMEOUT_SECONDS | No | Per-file regex timeout (ReDoS guard). | 2.0 |
| CONTEXT_BROKER_PARENT_POLL_INTERVAL_SECONDS | No | Orphan-process poll interval. | 3 |
| CONTEXT_BROKER_ENABLE_PROGRESS_NOTIFICATIONS | No | Per-call MCP progress updates. | 0 |
| CONTEXT_BROKER_IDLE_RESOURCE_TIMEOUT_SECONDS | No | Release in-memory caches after this idle time (0 disables). | 900 |
| CONTEXT_BROKER_ROUTER_PLAN_CACHE_MAX_ENTRIES | No | Max in-memory routing plans (0 disables). | 128 |
| CONTEXT_BROKER_IDLE_RESOURCE_CLEANUP_INTERVAL_SECONDS | No | Idle cleanup check interval. | 30 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
For user-facing command help, open context-broker://commands or select the context-broker prompt. Terminal help: context-broker --help.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| extensions | {
"io.modelcontextprotocol/ui": {}
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| delegate_large_taskA | Offer to split a large task into 2–4 independent agents, then review the results. Call only for a large task with a user-specified exact model. Include the original goal, conversation decisions, constraints, relevant files, and acceptance criteria. This tool asks the user whether to split BEFORE starting agents. Decline/cancel or unavailable elicitation starts no agents. Workers return proposals; the host must integrate and execute verification before claiming completion. Never split dependent work or drop context to fit the input limit. |
| save_model_handoffA | Save before switching models. Pass exact messages and all known project state. State requires goal, messages (string-valued objects), decisions, constraints, facts, tasks, acceptance_criteria, and open_questions. Each task has task/status, failure_reason if failed, and evidence if completed. Include relevant file paths. Give the returned handoff_id to the next model. Existing snapshots are immutable. |
| load_model_handoffA | Load saved context before the new model continues. Never silently trims memory. Choose a byte budget fitting the host's output/context limits. A stale checkpoint or insufficient budget returns failed; recover context before continuing work. This restores supplied memory, not a model's private reasoning or unsaved history. |
| configure_history_indexingB | Ask the user Index / No index for this project's MCP history folder. No index still checks history directly for relevant prior issues. It deletes only the optional derived index, never chat records or handoffs. Call at setup or when the user wants to change this preference. Unsupported consent changes nothing. |
| lookup_project_historyB | Check this specific issue before new work. Return at most three relevant excerpts. Always reads/checks project history, even with indexing disabled. No match means no history is injected. Similarity is conservative keyword overlap, not a claim of semantic equivalence. Partial indicates scan limits or unreadable records. |
| search_codebase_toolC | Search the codebase using semantic similarity. |
| auto_searchC | Auto-search for entry points and configuration. |
| find_in_codebaseA | Find exact literal or regex pattern matches in the codebase. Runs entirely locally — no embedding model, no external LLM call. Returns file paths, line numbers, and context snippets for each match. Use this instead of search_codebase_tool when you need precise text matches (e.g. "session_id", "def authenticate", a specific import). |
| save_search_resultsC | Search and save results to JSON. |
| list_saved_resultsC | List saved JSON results for a project. |
| load_saved_resultsC | Load previously saved search results. |
| get_storage_configB | Get current storage configuration. |
| token_counterC | Get latest token usage report for editor integrations. |
| token_historyC | Show graph-ready token savings history across search requests. |
| token_integration_manifestC | Return integration options for GraphQL, LangGraph, and other agent runtimes. |
| route_taskC | Route a task to the smallest relevant MCP tool slice. |
| execute_planC | Execute a UCR plan through safety gates, delegating downstream calls as needed. |
| search_contextC | Search relevant project context through the UCR public surface. |
| explain_planC | Explain a UCR plan in client-neutral JSON. |
| execute_selected_toolC | Backward-compatible helper: run one selected tool through the safety gate. |
| get_route_metricsB | Return UCR route/execution metrics for observability dashboards. |
| benchmark_routerC | Run a lightweight in-process router benchmark. |
| context_backend_statusB | Show configured cross-chat context backend status. |
| save_chat_contextC | Save chat messages to the configured cross-chat context backend. |
| record_sessionA | Persist an ENTIRE chat history in one call.
Prefer this over a flurry of |
| record_turnA | Persist the most recent (user, assistant) exchange. Call this after EVERY response you give in a conversation, with the user's question and your reply, so the chat history accumulates across sessions. Each call APPENDS — prior turns are never overwritten. The same exchange is mirrored to a local JSON ledger under .context-broker/ chats/, and the chat cache is warmed automatically so the next load_chat_context is a cached hit. Use a stable |
| list_user_activityA | Show when each user last asked something in this project. Without |
| load_cross_session_contextA | Search every session of one project and return the most important matching turns across all of them. "Important" means: messages whose content matches |
| load_chat_contextC | Load cross-chat context from the configured context backend. |
| ensure_agents_md_toolB | Ensure AGENTS.md exists for a project. Creates it if missing. |
| validate_agents_md_toolB | Validate AGENTS.md for a project and report missing information. |
| generate_agents_md_toolB | Generate AGENTS.md for a project. Overwrites existing if force=True. |
| scan_projects_for_agents_mdC | Scan for projects missing AGENTS.md. |
| ensure_changelog_toolA | Ensure CHANGELOG.md exists and is up to date with git history. Creates CHANGELOG.md if missing, or appends new commits since the last update. Parses conventional commits (feat:, fix:, security:, etc.) and categorizes them. |
| validate_changelog_toolA | Validate that CHANGELOG.md is up to date with git history. Checks for undocumented commits and reports how many are missing. |
| generate_version_changelogC | Generate a changelog section for a specific version release. |
| get_changelog_stats_toolA | Get statistics about the current CHANGELOG.md. |
| ensure_feature_docs_toolB | Ensure documentation exists for all recent feature changes. Creates docs/{feature}/{feature}-{fix-type}.md for each detected feature change, or docs/{feature}/{fix-type}.md if no related docs exist yet. |
| scan_missing_docs_toolC | Scan for feature changes that are missing documentation. |
| get_docs_stats_toolC | Get statistics about feature documentation. |
| check_environmentA | Check this machine for everything context-broker needs to run. Reports missing required/optional dependencies (Python version, packages, embedding model cache, external tools). Nothing is installed by default. To install missing required Python packages, call again with install_missing=True; the tool then asks for explicit confirmation and only proceeds when confirm="yes". |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| context-broker | Show Context Broker commands, history controls, and model handoffs. |
| auto-search | Prompt requiring semantic code search before answer. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| commands_resource | Read the installed Context Broker commands without loading project memory. |
| auto_context_resource | Auto-provide code context on requests. |
| token_counter_resource | Provide latest token counter for editor dashboards. |
TDQS
Scored across 41 tools
Several tool clusters overlap heavily: record_turn, record_session, and save_chat_context all persist chat context; search_codebase_tool, find_in_codebase, auto_search, and search_context all search; and ensure/generate/validate variants exist across docs. Descriptions help somewhat, but an agent can easily misselect among similar persistence, search, and documentation tools.
Most names use snake_case with verb_noun structure, which is readable. However, the convention is inconsistent: several tools carry a redundant _tool suffix while others do not, and some names are noun-only (token_counter) or vague (auto_search, benchmark_router).
With 41 tools, the server is far beyond a typical well-scoped set and mixes context storage, search, model handoffs, documentation generation, UCR routing, token analytics, benchmarking, and environment checks. This breadth makes the surface feel heavy and harder to navigate than the core purpose requires.
The surface covers many operations across context recording/loading, search, handoffs, docs, token metrics, and environment checks. Notable lifecycle gaps remain, such as no delete/prune for saved context or saved results, no update for saved results, and no cleanup/removal operations for generated docs.