contextful-mcp
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.
contextful-mcp
Project-agnostic MCP server for persona loading, doc search, code search, and cached test execution. Gives coding agents on-demand, ranked access to project context — without front-loading the entire context window at session start.
Token savings
Metric | Baseline | Result |
Effectiveness vs grep | Agent uses | 58.8% saved |
Effectiveness vs files | Agent reads whole files after locating them | 75.7% saved |
Quality (hit@5) | Result set contains the expected file or section | 89% |
Measured on 26 files, v0.4.0, 2026-04-06. Run bun benchmark.js --update-readme to regenerate.
See docs/benchmarks.md for methodology.
Related MCP server: contextsliver
Recommended workflow
get_status— check which features are available and whether a persona is already active.list_personas→load_persona— choose and load the right specialist for your task.search_docs— pull targeted doc sections before opening full files.search_code— find relevant code blocks before reading full files.Use
get_doc/get_code_fileonly when you need complete content.
Configuration
Configured exclusively via environment variables — no config files or CLI args.
Set vars in the env block of your .mcp.json (or equivalent host config).
Omitting a variable disables the corresponding feature and removes its tools entirely.
All environment variables
Variable | Type | Default | Description |
| string | server dir | Base dir for test commands and relative path resolution. Set to |
| JSON array | — | Directories containing |
| JSON array | — | Directories containing |
| JSON array | — | Directories to index for code search. Multiple entries are merged into one searchable index. |
| JSON array | auto-derived | Directories to watch for hot-reload. Defaults to the union of all configured content locations. |
| integer (≥5) |
| Maximum lines per code block. Increase for larger functions; decrease for faster scanning. |
| JSON array |
| File extensions to index. E.g. |
| JSON array | — | External URLs to fetch, strip, split into sections, and include in |
| integer (seconds) |
| How long to cache fetched URL content before re-fetching. |
| JSON object | — | Test runner config (see below). |
CONTEXTSERVER_TEST object fields
Key | Type | Default | Description |
| string[] |
| Shell commands to run, e.g. |
| string[] |
| Directories whose files are hashed to detect changes. If the hash matches the cache, tests are skipped. |
| string[] |
| File extensions to include when computing the hash. |
| string |
| Path to write the result cache (relative to |
| integer (ms) |
| Per-command timeout in milliseconds. Commands exceeding this are killed and marked failed. |
Example .mcp.json — single repo
{
"mcpServers": {
"contextful-mcp": {
"type": "stdio",
"command": "/path/to/contextful-mcp.exe",
"env": {
"CONTEXTSERVER_REPOROOT": ".",
"CONTEXTSERVER_DOCSLOCATIONS": "[\"./docs\"]",
"CONTEXTSERVER_PERSONASLOCATIONS": "[\"./agent_personas\"]",
"CONTEXTSERVER_CODELOCATIONS": "[\"./src\"]",
"CONTEXTSERVER_TEST": "{\"hashLocations\":[\"./src\",\"./tests\"],\"commands\":[\"bun test\"],\"hashExtensions\":[\".js\",\".ts\"]}"
}
}
}
}Example — multiple doc and code directories
Supply multiple paths in the JSON array. All are merged into a single searchable index.
"CONTEXTSERVER_DOCSLOCATIONS": "[\"./docs\", \"./packages/core/docs\", \"./packages/api/docs\"]",
"CONTEXTSERVER_CODELOCATIONS": "[\"./src\", \"./packages/core/src\", \"./packages/api/src\"]"Example — multi-repo (indexing two separate projects)
Use absolute paths to index sources from multiple repositories simultaneously.
The directory= filter in search_code lets agents scope queries to a specific repo.
"CONTEXTSERVER_REPOROOT": "/home/user/projects/backend",
"CONTEXTSERVER_CODELOCATIONS": "[\"/home/user/projects/backend/src\", \"/home/user/projects/frontend/src\"]",
"CONTEXTSERVER_DOCSLOCATIONS": "[\"/home/user/projects/backend/docs\", \"/home/user/projects/frontend/docs\"]"Tip: Use
search_code(query, directory="backend/")orsearch_code(query, directory="frontend/")to restrict results.
Example — indexing external URLs (e.g. API reference docs)
Fetched pages are stripped of HTML, split into sections, and surfaced in search_docs results.
"CONTEXTSERVER_URLS": "[\"https://developers.cloudflare.com/workers/runtime-apis/\", \"https://bun.sh/docs/bundler\"]",
"CONTEXTSERVER_URL_TTL": "3600"Example — Python/Go project
"CONTEXTSERVER_CODE_EXTENSIONS": "[\".py\", \".pyi\"]",
"CONTEXTSERVER_BLOCK_SIZE": "50"Tools reference
Tools are registered conditionally — only those whose feature group is configured appear in the agent's tool list.
Always available
Tool | Parameters | Description |
| — | Index stats (file count, block count, section count), which features are enabled, and the currently active persona. Check this before loading a persona — it may already be active. |
| — | Usage guide: all available tools, recommended workflow, and feature-specific tips. Call this first when new to the server. |
| — | Runtime performance metrics: per-tool call counts, average latency, index rebuild count, test cache hit rate. |
|
| Report a search result that was unhelpful or wrong. Logs structured feedback to stderr to help identify ranking gaps over time. |
Persona tools — requires CONTEXTSERVER_PERSONASLOCATIONS
Tool | Parameters | Description |
| — | Lists all persona names with their one-line purpose. Call this first to choose the right persona. |
|
| Load a named persona. Returns a compact card by default. Pass |
|
| Write a new structured persona |
Documentation tools — requires CONTEXTSERVER_DOCSLOCATIONS (or CONTEXTSERVER_URLS)
Tool | Parameters | Description |
| — | Lists all indexed documentation files with their titles. |
|
| Ranked section search across all doc files and any indexed URLs. Returns sections with source, heading, and score tier (strong/partial/weak). Sections are capped at ~600 chars; use |
|
| Full content of a doc file. Pass |
|
| Audits a doc's section structure for search quality: flags sections that are too long, too short, or misstructured for ranked retrieval. |
Code search tools — requires CONTEXTSERVER_CODELOCATIONS
Tool | Parameters | Description |
|
| Ranked code block search across all indexed source files. |
|
| Full content of an indexed source file. Use paths from |
Test tools — requires CONTEXTSERVER_TEST
Tool | Parameters | Description |
| — | Start here. Runs tests (or returns the cached result if nothing changed) and returns a compact pass/fail. On failure, lists each failing test with the file path and line number so you can go directly to the problem. Updates the cache. |
| — | Returns the full test output (all stdout + stderr). Call only after |
Notes
Lock files (e.g.
bun.lock,package-lock.json) and minified files (.min.js) are automatically excluded from the code index.Duplicate persona or doc names across multiple directories produce a warning to stderr; the last-loaded file wins.
Hot-reload watches configured locations for changes and rebuilds the index (debounced 2 s).
CONTEXTSERVER_WATCHLOCATIONSdefaults to the union of all content locations so it rarely needs to be set explicitly.All paths in array env vars may be absolute or relative to
CONTEXTSERVER_REPOROOT.CONTEXTSERVER_URLScontent is fetched at startup and on each hot-reload (within the TTL). On fetch failure the previous cached content is retained.
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
Team memory for AI coding agents and code reviews, reviewed by humans and served over MCP.
MCP server for building and testing AI agents with multi-model experimentation and insights.
shared AI-context layer for teams — persistent memory your agents search and update over MCP
Hosted MCP server and Agent Skills for specs, engineering threads, and project memory.
Related MCP Servers
- AlicenseAqualityCmaintenanceLocal-first MCP server that gives any AI coding agent per-project memory, workflow intelligence, and always-on, lossless token & context optimization.378 npm6MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that indexes codebases into a local graph and provides on-demand context retrieval for AI coding agents, reducing token usage by tracking session history and delivering only relevant code subgraphs.9 npmMIT
- AlicenseBqualityCmaintenanceEnables AI coding agents to maintain persistent project context, including rules, decisions, environment intelligence, and Git history, using a local-first MCP server with automatic project detection and token-efficient retrieval.13MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to locally search, query, and understand codebases with token-efficient context, dependency graphs, history, architecture diagrams, and metrics through MCP.15 npm3MIT