Context Mode
OfficialServer Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CONTEXT_MODE_DIR | No | Absolute writable root for context-mode storage. Sessions and stats use <root>/sessions; indexed content uses <root>/content. Empty or whitespace-only values are treated as unset; non-empty values must be absolute. ~ is not expanded. Defaults to the adapter default, e.g. ~/.codex/context-mode or ~/.claude/context-mode. | |
| CTX_FETCH_STRICT | No | Set to 1 to block loopback + RFC1918 + ULA in addition to the always-blocked ranges for ctx_fetch_and_index. Useful when context-mode runs as a shared service rather than on a developer's own machine. | |
| CONTEXT_MODE_PLATFORM | No | Platform identifier used to pin context-mode platform detection (for example "copilot-cli", "antigravity-cli", or "codex") so the correct adapter is resolved even when multiple supported clients are co-installed. | |
| CTX_FETCH_ALLOW_PROXY | No | Set to exactly 1 to allow egress through a proxy for ctx_fetch_and_index. With the proxy in place the in-subprocess DNS-rebinding defense no longer applies to that fetch. | |
| CONTEXT_MODE_PROJECT_DIR | No | Absolute path to the project root. Read by every adapter, so one env var covers the whole surface. Needed when the host (e.g. GitHub Copilot CLI plugin installs) launches the MCP server with its working directory set to the plugin installation root. | |
| CONTEXT_MODE_CODE_ECHO_MAX | No | Character budget for the fenced source block from ctx_execute / ctx_execute_file. 0 suppresses it. Only a run of digits is accepted; empty, whitespace-only, negative and non-numeric values keep the default. | 2000 |
| CONTEXT_MODE_ALLOW_WEBFETCH | No | Set to exactly 1 to disable PreToolUse redirects of curl, wget, inline fetch() and WebFetch into the equivalent ctx_* call. All-or-nothing; no per-domain or per-tool exclusion. | |
| CONTEXT_MODE_COMMAND_ECHO_MAX | No | Character budget for the $ <command> line in each ctx_batch_execute section and each ## Commands entry. 0 suppresses both. Same parsing rules as CONTEXT_MODE_CODE_ECHO_MAX. | 500 |
| CONTEXT_MODE_SUBAGENT_ROUTING | No | Set to 0 (or false/off/no, case-insensitive) to disable appending the context-mode routing block to Agent (subagent) spawn prompts. | 1 |
| CONTEXT_MODE_AGY_EXEC_TIMEOUT_MS | No | Pre-#959 alias, honored under Antigravity CLI while CONTEXT_MODE_DEFAULT_EXEC_TIMEOUT_MS is unset or unusable. | |
| CONTEXT_MODE_DEFAULT_EXEC_TIMEOUT_MS | No | Opt-in execution budget (ms) for ctx_execute / ctx_execute_file / ctx_batch_execute when the call passes no timeout. Must be a positive integer no greater than 2147483647; anything else falls back to the host default. | |
| CONTEXT_MODE_EXTERNAL_MCP_NUDGE_EVERY | No | Cadence (in tool calls) at which the PreToolUse hook re-injects the "wrap large external-MCP payloads in ctx_execute" guidance. Range [1, 100]; invalid values fall back to 10. | 10 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| prompts | {
"listChanged": false
} |
| resources | {
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| ctx_executeA | Run code in a sandboxed subprocess. Languages: javascript, shell, typescript, python, perl. Only what you console.log() enters your conversation — the bytes your code processes stay in the sandbox. WHEN:
WHEN NOT:
RETURNS: Only what your code prints. Wrap risky calls in try/catch — uncaught errors go to stderr. Drill in via ctx_search(queries: [...]). EXAMPLE: ctx_execute(language: "javascript", code: "const out = require('child_process').execSync('npm test', {encoding:'utf8', stdio:['ignore','pipe','pipe']}); console.log(out.split('\n').filter(l => /(FAIL|✗|×|Error:|Tests +.*(failed|passed))/i.test(l)).slice(0, 60).join('\n'))") |
| ctx_execute_fileA | Read a file into a sandboxed FILE_CONTENT variable and run code over it. Only what you console.log() enters your conversation — the file bytes stay in the sandbox. Same principle as ctx_execute, scoped to one named file. WHEN:
WHEN NOT:
RETURNS: Only what your code prints. FILE_CONTENT holds the raw bytes inside the sandbox; nothing else leaves. Auto-indexed output returns searchable section titles + previews instead of raw stdout. EXAMPLE: ctx_execute_file(path: "huge.log", language: "javascript", code: "const errs = FILE_CONTENT.split('\n').filter(l => /ERROR|FATAL/.test(l)); console.log( |
| ctx_indexA | Store content in a searchable knowledge base (BM25 over FTS5). Splits markdown by headings, keeps code blocks intact, persists the raw chunks. The full content stays in storage — retrieve any section on-demand via ctx_search; nothing is summarized or truncated. WHEN:
WHEN NOT:
RETURNS:
Indexing metadata: chunk counts, source label, and the exact ctx_search call shape. Raw content is NOT echoed back. With EXAMPLE: ctx_index(content: "# React useEffect\n\nThe Effect Hook lets you ...", source: "react-useeffect-docs") EXAMPLE: ctx_index(path: "/path/to/large-spec.md", source: "openapi-v2-spec") |
| ctx_searchA | Search the unified knowledge base: content you indexed plus auto-captured session memory (decisions, errors, blockers, plans, user prompts, compaction guides — 26 categories). Stemming, trigram and typo-tolerant matchers rank each query. WHEN:
WHEN NOT:
RETURNS:
Per-query ranked sections with window-extracted snippets. Use 2-4 technical terms per query. Labels: EXAMPLE: ctx_search(queries: ["root cause", "proposed fix"], source: "issue-#683") |
| ctx_fetch_and_indexA | Fetches URL content, converts HTML to markdown (JSON chunked by key paths, plain text indexed directly), persists it in a searchable knowledge base, returns a small preview window per source. Raw page bytes never enter your conversation — they live in storage, retrievable via ctx_search. Every fetch is cached on disk for 24h by default; override per-call with WHEN:
WHEN NOT:
RETURNS:
Per-source preview windows around indexable headings plus indexing metadata (chunk counts, source labels, cache). Raw content is NOT echoed back. EXAMPLE: ctx_fetch_and_index( requests: [{url: "https://react.dev/...", source: "react"}, {url: "https://vuejs.org/...", source: "vue"}], concurrency: 5 ) |
| ctx_batch_executeA | Run multiple commands in ONE call. Every command's output is auto-indexed into the knowledge base; pass WHEN:
WHEN NOT:
RETURNS: Auto-indexed section list per command label, plus top matches per query. Raw output is NOT echoed in full. EXAMPLE: ctx_batch_execute( commands: [ {label: "issue 1", command: "gh issue view 1"}, {label: "issue 2", command: "gh issue view 2"} ], queries: ["root cause", "proposed fix"], concurrency: 2 ) |
| ctx_statsA | Returns context consumption statistics for the current session. Shows total bytes returned to context, breakdown by tool, call counts, estimated token usage, and context savings ratio. |
| ctx_doctorA | Diagnose context-mode installation. Runs all checks server-side and returns a plain-text status report with [OK]/[FAIL]/[WARN] prefixes (renderer-safe across MCP clients). No CLI execution needed. |
| ctx_purgeA | DESTRUCTIVE: permanently delete indexed content. Cannot be undone. Requires confirm:true and exactly one scope. WHEN:
WHEN NOT:
SCOPES (pass exactly one):
CONTRACT:
RETURNS: A summary of removed rows + the resolved scope. EXAMPLE: ctx_purge(confirm: true, sessionId: "7c8a-1234-5678-9abc-def012345678") |
| ctx_insightA | Opens the context-mode Insight dashboard (https://context-mode.com/insight) in your default browser — a dashboard launcher for the hosted analytics layer, not a Q&A engine. Insight surfaces per-engineer productive rate, retry waste, blocker detection, and role-narrowed views for CTO, EM, IC, CISO, FinOps, and DevOps. For natural-language queries over your indexed content, use ctx_search. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 10 tools
Each tool has a clearly distinct role, helped by explicit WHEN/WHEN NOT guidance: ctx_execute vs ctx_execute_file vs ctx_batch_execute are cleanly separated by scope (inline code, single file, multi-command), and ctx_index vs ctx_fetch_and_index differ by local vs URL source. ctx_search, ctx_purge, ctx_stats, ctx_doctor, and ctx_insight each occupy unique ground, with ctx_insight explicitly disclaiming overlap with ctx_search.
All ten tools share the ctx_ prefix and use lowercase snake_case throughout, e.g. ctx_execute_file, ctx_fetch_and_index, ctx_batch_execute. The verb/noun mix (execute, search, purge vs doctor, insight, stats) is still readable and internally consistent.
Ten tools is a well-scoped set for a context/knowledge-management server. Each tool earns its place across capture, query, diagnostics, and maintenance roles with no filler.
The knowledge lifecycle is largely covered: capture (ctx_index, ctx_fetch_and_index), retrieval (ctx_search), deletion (ctx_purge), plus stats/doctor observability. Minor gaps remain — no explicit tool to list or update/re-index existing sources (staleness is only flagged), but agents can work around these via re-indexing.