contextpro-mcp 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ All notable changes to this project are recorded here. The project follows [Sema
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [1.5.0] - 2026-10-31
8
+
9
+ - `contextpro-mcp --help` and `--version` print usage and the version instead of starting a server on a folder named after the flag. Unknown options and a `--root` that does not exist now fail with a one-line error instead of creating directories.
10
+ - `init` writes a minimal config (`CONTEXTPRO_TOOL_PROFILE=lean`, no Ollama settings). `init vscode` uses VS Code's `servers` format, and `init vscode`/`init cursor` pass `--root ${workspaceFolder}`; an unexpanded `${...}` root falls back to the launch directory.
11
+ - A Git repository directly inside the home folder (for example `~/myapp`) is accepted as a project root.
12
+ - ContextPro writes `.contextpro/.gitignore`, so its local index state stays out of Git without editing the project's `.gitignore`.
13
+ - An empty `exact_references` result is labelled unverified when the compiler could not check some files, with a hint to install the project's dependencies.
14
+ - The README is now a one-minute quick start with verified commands for Claude Code, Codex, Cursor and OpenCode; internals moved to the configuration and agent guides.
15
+
7
16
  ## [1.4.0] - 2026-10-29
8
17
 
9
18
  - Upgraded zod to 4.6.7 to resolve GHSA-mrhx-c7xc-m3w5 (memory exhaustion when validating oversized constrained collections); tool behavior is unchanged, and nested object schemas are now advertised without `additionalProperties: false`.
package/INSTALL.md CHANGED
@@ -1,110 +1,197 @@
1
1
  # Install ContextPro
2
2
 
3
- These instructions target the current checkout. Use the local build to get changes under review; do not assume an npm package with the same version contains them. Use Node.js 24 LTS and npm; the package engine range is 20–26. Install from source until a registry release is announced.
3
+ ContextPro is published on npm as `contextpro-mcp`, and every client below starts it with `npx`. To run unreleased code from a checkout, see [Run from source](#run-from-source).
4
4
 
5
- ## Local build
5
+ ## Prerequisites
6
+
7
+ - Node.js 20–26 (24 LTS recommended) and npm. No API key or Ollama needed.
8
+ - For TypeScript/JavaScript compiler references, install the target project's dependencies (`npm install`). Without them, `tsconfig` `extends` and type packages don't resolve, and files can't be checked.
9
+
10
+ The examples use the unpinned package so they don't go stale. Teams that want reproducible setups can pin a release with `contextpro-mcp@<version>`.
11
+
12
+ ## Connect your client
13
+
14
+ The "project root" is the repository ContextPro indexes. Without `--root`, the root is the directory the client starts the server in. ContextPro refuses to start in `/` or in your home folder itself. A project folder directly inside your home folder (for example `~/myapp`) is accepted when it is a Git repository (has `.git`); a non-repository folder there (for example `~/Downloads`) is refused unless `CONTEXTPRO_ALLOW_UNSAFE_ROOT=true`. Global configs and GUI apps often start servers from your home folder, so they should pass `--root`.
15
+
16
+ ### Claude Code
17
+
18
+ Just for you, in one project:
6
19
 
7
20
  ```sh
8
- git clone https://github.com/AlaeddineMessadi/contextpro-mcp.git
9
- cd contextpro-mcp
10
- npm ci
11
- npm run build
12
- node build/index.js doctor --root /absolute/path/to/target-project
21
+ cd your-project
22
+ claude mcp add contextpro -e CONTEXTPRO_TOOL_PROFILE=lean -- npx -y contextpro-mcp --root "$PWD"
23
+ claude mcp list # contextpro: ... ✔ Connected
13
24
  ```
14
25
 
15
- Keep the actual Node executable path printed by `node -p 'process.execPath'`. Using it in all clients avoids differences between an interactive shell's Node and a desktop client's PATH. The server repairs incompatible SQLite dependencies in an isolated cache for the launching Node ABI. First repair requires npm and network access; see [native-module recovery](#native-module-recovery).
26
+ Put the server name before `-e`. The `-e` flag takes several values, so a name after it is read as an environment variable and the command fails with `Invalid environment variable format`.
16
27
 
17
- The target root is the repository being indexed, which can differ from the ContextPro checkout. Add `.contextpro/` to that project's `.gitignore`. The directory also contains memory and restore points; it is not entirely disposable.
28
+ For a team, commit the config and the agent instructions:
18
29
 
19
- ## Client configuration
30
+ ```sh
31
+ cd your-project
32
+ npx -y contextpro-mcp init claude # writes .mcp.json, AGENTS.md and CLAUDE.md
33
+ claude
34
+ ```
20
35
 
21
- Replace all placeholder paths. These examples launch the same local build and use the default workflow profile. Set the profile to `lean` for three initially advertised tools. Existing custom credentials and settings should be preserved.
36
+ Claude Code asks once to approve servers from a project `.mcp.json`. Until you start `claude` in the project and accept, `claude mcp list` shows "Pending approval". The generated config has no `--root`, so the root is the directory where you start `claude`: start it in the repository root. Started in a subdirectory, ContextPro silently indexes only that subdirectory. The same applies to any config without `--root`, such as OpenCode's `opencode.json`.
22
37
 
23
38
  ### Codex
24
39
 
25
- Merge this entry into the applicable Codex configuration, such as `~/.codex/config.toml`:
40
+ ```sh
41
+ codex mcp add contextpro --env CONTEXTPRO_TOOL_PROFILE=lean -- npx -y contextpro-mcp --root /absolute/path/to/project
42
+ ```
43
+
44
+ Codex reads `~/.codex/config.toml` by default (`$CODEX_HOME/config.toml` if set), which is global, so `--root` pins the project. Tool calls can still pass another `root`. The command writes:
26
45
 
27
46
  ```toml
28
47
  [mcp_servers.contextpro]
29
- command = "/absolute/path/to/node"
30
- args = ["/absolute/path/to/contextpro-mcp/build/index.js", "--root", "/absolute/path/to/target-project"]
48
+ command = "npx"
49
+ args = ["-y", "contextpro-mcp", "--root", "/absolute/path/to/project"]
31
50
 
32
51
  [mcp_servers.contextpro.env]
33
- CONTEXTPRO_TOOL_PROFILE = "workflow"
34
- CONTEXTPRO_PROVIDER = "ollama"
35
- CONTEXTPRO_EMBED_MODEL = "nomic-embed-text:latest"
52
+ CONTEXTPRO_TOOL_PROFILE = "lean"
36
53
  ```
37
54
 
38
- ### Claude Code
55
+ `codex mcp list` only prints the config; it does not start the server. Use the [smoke test](#verify) to check it starts. `Auth: Unsupported` is normal for a local (stdio) server.
39
56
 
40
- Merge into the target project's `.mcp.json`:
57
+ ### Cursor and other `mcpServers` JSON clients
58
+
59
+ `npx -y contextpro-mcp init cursor` writes `.cursor/mcp.json` with `--root ${workspaceFolder}`. That form has not yet been verified inside Cursor; the hand-written JSON below, with an absolute `--root`, is the verified path. Put it in `.cursor/mcp.json` or the client's own config file:
41
60
 
42
61
  ```json
43
62
  {
44
63
  "mcpServers": {
45
64
  "contextpro": {
46
- "command": "/absolute/path/to/node",
47
- "args": ["/absolute/path/to/contextpro-mcp/build/index.js", "--root", "/absolute/path/to/target-project"],
48
- "env": {
49
- "CONTEXTPRO_TOOL_PROFILE": "workflow",
50
- "CONTEXTPRO_PROVIDER": "ollama",
51
- "CONTEXTPRO_EMBED_MODEL": "nomic-embed-text:latest"
52
- }
65
+ "command": "npx",
66
+ "args": ["-y", "contextpro-mcp", "--root", "/absolute/path/to/project"],
67
+ "env": { "CONTEXTPRO_TOOL_PROFILE": "lean" }
53
68
  }
54
69
  }
55
70
  }
56
71
  ```
57
72
 
73
+ Keep `--root`: GUI apps may start servers from your home folder, where ContextPro refuses to start. If a client passes an unexpanded `${...}` variable as `--root`, ContextPro ignores it and uses the launch directory.
74
+
58
75
  ### OpenCode
59
76
 
60
- Merge into `opencode.json`:
77
+ ```sh
78
+ cd your-project
79
+ npx -y contextpro-mcp init opencode # writes opencode.json and AGENTS.md
80
+ opencode mcp list
81
+ ```
61
82
 
62
- ```json
63
- {
64
- "mcp": {
65
- "contextpro": {
66
- "type": "local",
67
- "command": ["/absolute/path/to/node", "/absolute/path/to/contextpro-mcp/build/index.js", "--root", "/absolute/path/to/target-project"],
68
- "enabled": true,
69
- "environment": {
70
- "CONTEXTPRO_TOOL_PROFILE": "workflow",
71
- "CONTEXTPRO_PROVIDER": "ollama",
72
- "CONTEXTPRO_EMBED_MODEL": "nomic-embed-text:latest"
73
- }
74
- }
75
- }
76
- }
83
+ ### VS Code
84
+
85
+ ```sh
86
+ cd your-project
87
+ npx -y contextpro-mcp init vscode # writes .vscode/mcp.json
77
88
  ```
78
89
 
79
- Restart the client after changes. A reconnect can reuse a cached launch command; `health` identifies the running executable and parser backend. Enable `health` through `discover_tools` if it is absent from the selected catalog.
90
+ The generated file uses VS Code's format (`servers`, `type: "stdio"`, `--root ${workspaceFolder}`). This setup has not yet been verified inside VS Code.
91
+
92
+ ### What `init` does
93
+
94
+ `npx -y contextpro-mcp init <claude|cursor|vscode|windsurf|opencode>` writes the client's project config with the `lean` profile and adds a managed ContextPro section to `AGENTS.md` (and `CLAUDE.md` for Claude). The VS Code and Cursor targets write `--root ${workspaceFolder}`; the Claude and OpenCode targets write no `--root`. The Windsurf target writes `.windsurf/mcp.json` and has not been verified inside Windsurf.
95
+
96
+ - It merges JSON without replacing other servers or an existing customized ContextPro entry.
97
+ - It also creates `.contextpro/config.json` (provider defaults and project identity), which the auto-written `.contextpro/.gitignore` covers.
98
+ - `AGENTS.md` gets a managed block at the top and existing content is preserved. `CLAUDE.md` gets the same block, so Claude Code may read it twice.
99
+ - Running it again is idempotent and preserves your own rules outside the managed markers.
100
+ - `--no-agent-instructions` skips `AGENTS.md`/`CLAUDE.md`; `--runner bunx` uses Bun instead of npx; `--root <dir>` targets another directory.
80
101
 
81
- ### Generated starters and packaged installs
102
+ The agent instructions matter: the MCP config exposes the tools, while `AGENTS.md`/`CLAUDE.md` tells the agent when to use them. The full workflow is served on demand as `contextpro://instructions`. To add the instructions by hand, copy [INSTRUCTIONS.md](INSTRUCTIONS.md). A separate skill is optional; it does not enable tools or repair retrieval.
82
103
 
83
- The CLI can generate starter configurations and managed project instructions:
104
+ ContextPro keeps its local state in `.contextpro/` and writes a `.contextpro/.gitignore` itself, so you don't need to change your `.gitignore`. Older versions: add `.contextpro/` to your .gitignore.
105
+
106
+ ## Verify
107
+
108
+ Smoke test for any client. Run it in your project; it starts the server, lists its tools and exits:
84
109
 
85
110
  ```sh
86
- node /absolute/path/to/contextpro-mcp/build/index.js init claude --root /absolute/path/to/target-project --runner npx
87
- node /absolute/path/to/contextpro-mcp/build/index.js init opencode --root /absolute/path/to/target-project --runner npx
111
+ printf '%s\n' \
112
+ '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"smoke","version":"0"}}}' \
113
+ '{"jsonrpc":"2.0","method":"notifications/initialized"}' \
114
+ '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
115
+ | CONTEXTPRO_TOOL_PROFILE=lean npx -y contextpro-mcp --root "$PWD" 2>/dev/null | grep -o '"name":"[a-z_]*"'
116
+ # expect four lines: "name":"contextpro" (the server info), then "name":"context", "name":"discover_tools", "name":"exact_references"
88
117
  ```
89
118
 
90
- Starters use a package runner, even when generated from a local checkout. Replace the generated launch command with the local examples above to run unreleased code. For a registry install, first verify access to the intended published package and pin its version deliberately.
119
+ Check storage with `doctor`:
91
120
 
92
- `init` merges JSON without replacing other servers or an existing customized ContextPro entry. It installs a managed `AGENTS.md` section and, for Claude, a `CLAUDE.md` section. `--no-agent-instructions` skips those sections. Repeated init preserves custom rules outside the markers. Codex configuration is manual; do not assume every client is supported by the generator.
121
+ ```sh
122
+ npx -y contextpro-mcp doctor --root /absolute/path/to/project
123
+ ```
93
124
 
94
- ## Verify once
125
+ Expect `Before: ok | storage=true | dbOpen=true` and `After: ok | …`. "Fix Applied: no" only means you didn't pass `--fix`.
95
126
 
96
- 1. Restart the client and confirm the expected server is connected.
97
- 2. Call `status` to inspect the root and index. In lean mode, enable it with `discover_tools(enable:["status"])`.
98
- 3. Read a known small source target with `context` in lean mode, or `explain` in workflow mode.
99
- 4. For first-time indexing or reported drift requiring a rebuild, enable/call `reindex`. `no_embed:true` builds structural evidence without eager corpus embeddings.
127
+ `npx -y contextpro-mcp --help` lists the commands, and `--version` prints the installed version.
100
128
 
101
- This is installation diagnosis, not a checklist for every coding task. Missing embeddings do not disable structural tools. For retrieval with no query embedding attempt, use `search(preset:"keyword_only")` or direct `context(targets:[...])`.
129
+ In the client, a first read looks like this. Use a line range: a whole file larger than `max_tokens` is omitted rather than cut.
102
130
 
103
- ## Optional model setup
131
+ ```js
132
+ context({ root: "/absolute/path/to/project", targets: [{ file: "src/index.ts", start: 1, end: 40 }], max_tokens: 1500 })
133
+ ```
134
+
135
+ Replace `src/index.ts` with a file in your project. For callers of a symbol:
136
+
137
+ ```js
138
+ exact_references({ root: "/absolute/path/to/project", file: "src/lib/foo.ts", symbol_name: "foo" })
139
+ ```
140
+
141
+ Without Ollama, `context()` results include a "Discovery used lexical fallback" notice. That is expected and doesn't affect `exact_references`.
142
+
143
+ To inspect the index, enable `status` with `discover_tools(enable:["status"])`. If the tool doesn't appear (some clients don't refresh their tool list), call it through `discover_tools({ root, call: { name: "status", arguments: {} } })`. For first-time indexing, or drift that needs a rebuild, enable and call `reindex`; `no_embed:true` builds structural data without embeddings. This is installation diagnosis, not something to run on every task.
144
+
145
+ ## Optional setup
146
+
147
+ ### Workflow profile
148
+
149
+ `CONTEXTPRO_TOOL_PROFILE` picks the starting tool list. `lean` (3 tools) is recommended. `workflow` (14 tools for discovery, reads, impact and validation) is the server default when no profile is set; `core` has 39 and `full` all 68. See [profiles](docs/configuration.md#profiles).
150
+
151
+ ### Semantic search with Ollama
152
+
153
+ Embeddings are optional. ContextPro tries a local Ollama at `OLLAMA_HOST` (default `http://127.0.0.1:11434`) automatically and falls back to keyword search when it's unavailable. Compiler references and structural search work either way. To enable semantic search, install Ollama and run `ollama pull nomic-embed-text`.
154
+
155
+ The defaults are already provider `ollama` and model `nomic-embed-text:latest`; set them explicitly only to pin or change them:
156
+
157
+ ```json
158
+ "env": {
159
+ "CONTEXTPRO_TOOL_PROFILE": "lean",
160
+ "CONTEXTPRO_PROVIDER": "ollama",
161
+ "CONTEXTPRO_EMBED_MODEL": "nomic-embed-text:latest"
162
+ }
163
+ ```
164
+
165
+ The `CONTEXTPRO_PROVIDER` and `CONTEXTPRO_EMBED_MODEL` lines above are the defaults. ContextPro needs its own embedding endpoint; it does not reuse a Claude or Codex session. Reindex after changing the model. For structural-only indexing with no embeddings, set `CONTEXTPRO_REINDEX_NO_EMBED=true` or pass `no_embed:true` to `reindex`.
166
+
167
+ Chat-assisted operations are optional. Leave `CONTEXTPRO_CHAT_RERANK` and `CONTEXTPRO_AUTO_HUBS` off unless needed. Hosted credentials can make a default chat model available even without an explicit chat-model setting, so omitting that setting is not a network-off switch. See [provider settings](docs/configuration.md#providers).
104
168
 
105
- For local semantic retrieval, install and start Ollama, then pull the configured embedding model, for example `nomic-embed-text`. ContextPro needs its own embedding endpoint; it does not reuse a Claude or Codex session.
169
+ ## Run from source
170
+
171
+ ```sh
172
+ git clone https://github.com/AlaeddineMessadi/contextpro-mcp.git
173
+ cd contextpro-mcp
174
+ npm ci
175
+ npm run build
176
+ node build/index.js doctor --root /absolute/path/to/your-project
177
+ node -p 'process.execPath'
178
+ ```
179
+
180
+ Use the printed Node executable and your checkout path in the client config. Using the same executable in every client avoids differences between your shell's Node and a desktop client's PATH. For example, in a Claude Code `.mcp.json`:
181
+
182
+ ```json
183
+ {
184
+ "mcpServers": {
185
+ "contextpro": {
186
+ "command": "/absolute/path/to/node",
187
+ "args": ["/absolute/path/to/contextpro-mcp/build/index.js", "--root", "/absolute/path/to/your-project"],
188
+ "env": { "CONTEXTPRO_TOOL_PROFILE": "lean" }
189
+ }
190
+ }
191
+ }
192
+ ```
106
193
 
107
- Chat-assisted operations are optional. Leave `CONTEXTPRO_CHAT_RERANK` and `CONTEXTPRO_AUTO_HUBS` off unless needed. Hosted credentials can make a default chat model available even without an explicit chat-model setting, so omitting that setting is not a universal network-off switch. See [provider settings](docs/configuration.md#providers).
194
+ Restart the client after changes. A reconnect can reuse a cached launch command; `health` (enable it through `discover_tools`) shows the running executable and parser backend. The server repairs incompatible SQLite bindings in an isolated cache for the launching Node ABI; the first repair needs npm and network access.
108
195
 
109
196
  ## Native-module recovery
110
197
 
@@ -120,9 +207,12 @@ Do not rebuild shared `node_modules` merely to satisfy one client: clients using
120
207
 
121
208
  ## Worktrees and common problems
122
209
 
123
- - **Tools absent after a startup/handshake failure:** run the configured Node executable and server path directly to inspect stderr. `ERR_MODULE_NOT_FOUND` with a missing checkout `node_modules` directory means the installation is incomplete, not a discovery-profile problem. In that checkout, restore the locked dependencies with `npm ci` using the configured Node runtime, run `npm run build`, then reconnect/restart the MCP server in the client. Keep the configured checkout's dependencies and build while clients use it; deleting them to free disk space prevents startup. Native ABI failures have the separate recovery procedure above.
124
- - **Wrong repository/worktree:** subagents must pass their absolute worktree `root` on every call. Shell `cd` does not retarget a shared MCP server. Linked worktrees require explicit roots, including reindex calls; verify the chosen checkout before attempting recovery. Client-advertised roots may describe the parent agent.
125
- - **Stale embeddings:** check provider/model settings, then reindex. Interactive search does not rebuild the whole vector corpus.
126
- - **Slow or failed calls:** inspect `health` and `status`; use bounded results and keyword-only discovery when the provider is unavailable. Do not loop blindly on connection errors.
127
- - **Agent ignores MCP:** install concise project rules from [INSTRUCTIONS.md](INSTRUCTIONS.md). Prefer MCP when it adds useful context; allow native reads for tiny known targets and incomplete evidence.
128
- - **Disk growth:** follow [maintenance](docs/maintenance.md). Preserve memory and restore points while cleaning regenerable artifacts.
210
+ - **`npm warn deprecated prebuild-install@7.1.3` from npx:** expected; it comes from a native dependency and does not affect ContextPro.
211
+ - **`Unsafe project root` at startup:** the server was started in `/`, in your home folder, or in a non-Git folder directly inside it, usually without `--root`. Add `--root /absolute/path/to/project`. If your project sits directly in your home folder and is not a Git repository, move it one level deeper, run `git init`, or set `CONTEXTPRO_ALLOW_UNSAFE_ROOT=true`.
212
+ - **`exact_references` finds nothing and warns that files could not be checked:** install the target project's dependencies (`npm install`) and retry.
213
+ - **Tools absent after a startup failure:** run the configured command directly to read stderr. From source, `ERR_MODULE_NOT_FOUND` with a missing `node_modules` means the checkout is incomplete: run `npm ci` and `npm run build` with the configured Node, then restart the client. Keep the checkout's dependencies and build while clients use it.
214
+ - **Wrong repository or worktree:** subagents must pass their absolute worktree `root` on every call. A shell `cd` does not retarget a shared MCP server. Linked worktrees require explicit roots, including for `reindex`. Client-advertised roots may describe the parent agent.
215
+ - **Local state:** `.contextpro/` in the project holds the index, memory and restore points. It is not entirely disposable; follow [maintenance](docs/maintenance.md) before deleting it. `~/.contextpro` holds the workspace registry and `~/.cache/contextpro` the native-binding cache.
216
+ - **Stale embeddings:** check provider and model settings, then reindex. Interactive search does not rebuild the whole vector corpus.
217
+ - **Slow or failed calls:** inspect `health` and `status`; use bounded results and keyword-only discovery when the provider is unavailable. Do not loop on connection errors.
218
+ - **Agent ignores ContextPro:** install the project rules with `init` or from [INSTRUCTIONS.md](INSTRUCTIONS.md).
package/INSTRUCTIONS.md CHANGED
@@ -4,7 +4,7 @@ Append the following policy to your client's project rules, such as `AGENTS.md`
4
4
 
5
5
  ## Choose the smallest useful request
6
6
 
7
- Use ContextPro for unfamiliar repository discovery, structural context and cross-file evidence. With the lean profile, use `context(query:...)` to find and read evidence together, or `context(targets:[...])` to batch known source targets. With the default workflow profile, use `task_pack` or compact `search`; use `explain` for known symbols and `skeleton(exported_only:true)` for TS/JS public APIs.
7
+ Use ContextPro for unfamiliar repository discovery, structural context and cross-file evidence. With the lean profile, use `context(query:...)` to find and read evidence together, or `context(targets:[...])` to batch known source targets. With the workflow profile (the server default when no profile is set; init installs lean), use `task_pack` or compact `search`; use `explain` for known symbols and `skeleton(exported_only:true)` for TS/JS public APIs.
8
8
 
9
9
  Pass the absolute active repository/worktree as `root` on every call. For `context`, use `max_tokens` from 512 to 12000 (default 4000, estimated UTF-8 bytes/4) and at most six exact targets. Include a known relative directory and concrete route or symbol names in discovery questions. Directory and named-usage hints influence ranking; they are not exhaustive scope or compiler references. Ask explicitly for an overview when you want a UI inventory. If evidence is omitted, narrow to exact targets or a native scope search instead of repeating the same broad query.
10
10
 
package/README.md CHANGED
@@ -1,165 +1,90 @@
1
1
  # ContextPro
2
2
 
3
- **Compiler-exact references and bounded source context for coding agents, in a three-tool lean profile.**
3
+ [![npm version](https://img.shields.io/npm/v/contextpro-mcp)](https://www.npmjs.com/package/contextpro-mcp)
4
+ [![CI](https://github.com/AlaeddineMessadi/contextpro-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/AlaeddineMessadi/contextpro-mcp/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/npm/l/contextpro-mcp)](LICENSE)
4
6
 
5
- ContextPro is a local MCP server for TypeScript and JavaScript repositories. When an agent asks "who calls this?", it answers with the TypeScript compiler instead of a name search: aliases, re-exports and same-named symbols are told apart, and every result states its scope and whether it was truncated. When an agent needs source, it returns budgeted slices instead of whole files.
7
+ **Exact find-all-references for your coding agent on TypeScript/JavaScript repos — answered by the TypeScript compiler, not grep.**
6
8
 
7
- [Get started](INSTALL.md) · [Agent guide](agent-guide.md) · [Benchmarks](docs/benchmarks/README.md) · [Documentation](docs/README.md) · [Contribute](CONTRIBUTING.md) · [Security](SECURITY.md)
9
+ ContextPro is a local [MCP](https://modelcontextprotocol.io) server for agents such as Claude Code, Codex, Cursor and OpenCode. Its compiler-backed "find all references" means a rename or refactor is far less likely to miss callers that import the function under another name or through a re-export (within the files the compiler can check). It also serves source reads with a size limit, so the agent gets the lines it needs instead of whole files. It runs on your machine and needs no API key.
8
10
 
9
- ## What it is good at
10
-
11
- - **Renames and refactors in TS/JS codebases.** `exact_references` resolves bindings with the compiler and reports per-file call totals, reference kinds and truncation, so an agent knows what it has not seen.
12
- - **Parallel agents on one repository.** Indexes are scoped per Git worktree, check saved-file drift and reconcile in the background.
13
- - **A small tool catalog.** The lean profile exposes three of the 68 tools; the rest are discovered only when needed.
14
- - **Inspectable evidence.** Responses separate compiler-resolved references, textual candidates and heuristic fallbacks, and report freshness.
11
+ ## Quick start
15
12
 
16
- Python references work through a configured Pyright; other languages fall back to structural and textual evidence.
13
+ Requirements: Node.js 20–26 (24 LTS recommended). No API key or Ollama needed. For compiler references, install the target project's dependencies first (`npm install`); otherwise files can't be checked.
17
14
 
18
- ## Honest results
15
+ **Fastest try (Claude Code):**
19
16
 
20
- ContextPro has not been shown to make agents finish tasks faster. Our own trials, published in [docs/benchmarks](docs/benchmarks/README.md), include the losses:
17
+ ```sh
18
+ cd your-project
19
+ claude mcp add contextpro -e CONTEXTPRO_TOOL_PROFILE=lean -- npx -y contextpro-mcp --root "$PWD"
20
+ claude mcp list # contextpro: ... ✔ Connected
21
+ ```
21
22
 
22
- | Measured | Result |
23
- | --- | --- |
24
- | Compiler reference checks on two fixtures (barrel aliases, same-named bindings) | 24 of 24 timed queries passed |
25
- | Response size on six retrieval tasks vs a scripted `rg`/`git` baseline | about 41% fewer response tokens, but about 6.8× slower per call |
26
- | Matched agent trials (2 read-only tasks), lean profile vs native tools | **23.8% more** total input, **19.2% more** wall time |
27
- | Matched agent trials (2 read-only tasks), workflow profile vs native tools | **128.7% more** total input |
28
- | Eight paired coding tasks, previous ContextPro build vs connected-retrieval candidate | previous build 1/8, candidate 0/8 (six on private repositories; see connected-evidence report) |
23
+ Keep the server name before `-e`, which would otherwise swallow it.
29
24
 
30
- Plain `grep` and file reads are often the cheapest choice when an agent already knows where to look. ContextPro is most useful when binding identity matters or the exact location is unknown. We welcome reproducible comparisons, including ones where another tool wins; see [how we compare](docs/comparison.md).
25
+ **Claude Code, whole team** (commits `.mcp.json` plus agent instructions in `AGENTS.md` and `CLAUDE.md`):
31
26
 
32
- ## Get started
27
+ ```sh
28
+ npx -y contextpro-mcp init claude
29
+ claude # start it in the repository root and approve "contextpro" once
30
+ ```
33
31
 
34
- Use **Node.js 24 LTS** and npm. Install from source until a registry release is announced; the version in `package.json` is not proof of a published npm package.
32
+ **Codex:**
35
33
 
36
34
  ```sh
37
- git clone https://github.com/AlaeddineMessadi/contextpro-mcp.git
38
- cd contextpro-mcp
39
- npm ci
40
- npm run build
41
- node build/index.js doctor --root /absolute/path/to/your-project
42
- node -p 'process.execPath'
35
+ codex mcp add contextpro --env CONTEXTPRO_TOOL_PROFILE=lean -- npx -y contextpro-mcp --root /absolute/path/to/project
43
36
  ```
44
37
 
45
- Use the printed Node executable and your checkout path in the client configuration. For example, in Claude Code's project `.mcp.json`:
38
+ **Cursor and other clients that read `mcpServers` JSON** (`.cursor/mcp.json` or the client's config file):
46
39
 
47
40
  ```json
48
- {
49
- "mcpServers": {
50
- "contextpro": {
51
- "command": "/absolute/path/to/node",
52
- "args": ["/absolute/path/to/contextpro-mcp/build/index.js", "--root", "/absolute/path/to/your-project"],
53
- "env": { "CONTEXTPRO_TOOL_PROFILE": "lean" }
54
- }
55
- }
56
- }
41
+ { "mcpServers": { "contextpro": {
42
+ "command": "npx",
43
+ "args": ["-y", "contextpro-mcp", "--root", "/absolute/path/to/project"],
44
+ "env": { "CONTEXTPRO_TOOL_PROFILE": "lean" } } } }
57
45
  ```
58
46
 
59
- Replace every placeholder, add `.contextpro/` to the target project's `.gitignore`, then restart the client. [Installation instructions](INSTALL.md) cover Codex, Claude Code, OpenCode, indexing and native-module recovery. [Project instructions](INSTRUCTIONS.md) teach agents when ContextPro is useful and when to verify with native tools.
60
-
61
- Install the project instructions as well as the server: connecting MCP exposes tools,
62
- while `AGENTS.md` / `CLAUDE.md` teaches the agent when to use them. The detailed
63
- workflow is available on demand through `contextpro://instructions`. A separate
64
- skill is optional; it does not enable tools or repair retrieval.
47
+ **OpenCode:** run `npx -y contextpro-mcp init opencode`, then `opencode mcp list`.
65
48
 
66
- ## A small interface for real coding work
49
+ **Try it.** Ask your agent:
67
50
 
68
- | Task | Start with | What to check |
69
- | --- | --- | --- |
70
- | Locate unfamiliar code and read evidence | `context(query:...)` | Retrieval is a ranked selection, not an exhaustive search |
71
- | Read several known targets | `context(targets:[...])` | Follow explicit omissions if more evidence is needed |
72
- | Find TS/JS references | `exact_references` | Declared scope, reference kinds and truncation |
73
- | Inspect an exported API | Discover `skeleton`, then use `exported_only:true` | Signatures do not prove behavior |
74
- | Assess a change | Discover `blast_radius` or `validate_scope` | Text matches are candidates; recommended checks still need to run |
75
- | Preserve a decision | Discover `memory_record_task` | Keep supporting evidence and revisit stale assumptions |
76
- | Inspect compiler errors or rename a binding | Discover `compiler_diagnostics` / `rename_preview` | TS/JS compiler or configured Pyright; inspect before `rename_apply` |
77
- | Record executed checks | `validate_scope`, then discover `validation_record` | Run checks in the coding host; receipts become stale when inputs change |
51
+ - "Use contextpro to find every caller of `<function>` in `<file>`."
52
+ - "Use contextpro to show me how `<feature>` works."
78
53
 
79
- Tool schemas are the argument reference. See the [agent guide](agent-guide.md) for examples, batching and context reuse.
54
+ [INSTALL.md](INSTALL.md) covers VS Code, team approval, a smoke test that works without any client, running from source and troubleshooting.
80
55
 
81
- | Profile | Initial interface |
82
- | --- | --- |
83
- | `lean` | `context`, `exact_references`, `discover_tools` |
84
- | `workflow` (default) | 14 tools for discovery, reads, impact and validation |
85
- | `core` | 39 tools: common workflows plus editing and graphs |
86
- | `full` | All 68 registered tools, including 5 deprecated aliases |
87
-
88
- Set `CONTEXTPRO_TOOL_PROFILE` in the server environment. `discover_tools(enable:[...])` enables tools without executing them. If the client cannot refresh its catalog, use the supported `discover_tools({root,call:{name,arguments}})` dispatcher with the returned expert schema.
89
-
90
- Experimental connected retrieval (`CONTEXTPRO_CONNECTED_CONTEXT=true`) combines ranked source, one-hop imports/callers and relevant tests in `context` and `task_pack`. It remains opt-in while task-level performance is evaluated. Discover `feature_brief` for a cached, source-cited feature map; model-written interpretations require a separate opt-in. Query-based `context` packets accept `previous_context_id` while the agent still holds that packet; omit it after context loss. Exact target reads remain stateless. See [configuration and freshness rules](docs/configuration.md).
91
-
92
- The optional `context.intent` hint (`lookup`, `change`, `debug`, `review`, `overview`, or `auto`) enables question-aware source and document retrieval for one query. Shared indexing/compiler work is also opt-in through `contextpro daemon start` and `CONTEXTPRO_DAEMON=true`. Evidence-backed memory and handoffs build on the existing SQLite/artifact architecture; experimental features such as local task coordination are documented in configuration. [Configuration](docs/configuration.md#experimental-development-context) explains setup, limits and rollback; these features do not establish a measured coding-speed improvement.
93
-
94
- ## Ask for the source you need
95
-
96
- Pass the absolute active repository or worktree as `root` on every call. Query
97
- budgets use `max_tokens` (512–12000, default 4000; estimated UTF-8 bytes divided by
98
- four). Exact batches accept up to six targets.
99
-
100
- This example uses ContextPro's own repository. In another project, use paths and
101
- declaration names observed in its source rather than guessed symbols.
102
-
103
- ```js
104
- context({
105
- root: "/absolute/path/to/contextpro-mcp",
106
- query: "src/core/agent-setup.ts mergeAgentInstructions preserve existing project rules",
107
- intent: "change",
108
- max_tokens: 2500
109
- })
110
- context({
111
- root: "/absolute/path/to/contextpro-mcp",
112
- targets: [{file: "src/core/agent-setup.ts", symbol: "mergeAgentInstructions"}],
113
- max_tokens: 1500
114
- })
115
- // Use compiler references when binding identity or cross-file callers matter.
116
- exact_references({
117
- root: "/absolute/path/to/contextpro-mcp",
118
- file: "src/core/agent-setup.ts",
119
- symbol_name: "mergeAgentInstructions",
120
- limit: 20
121
- })
122
- ```
123
-
124
- These are task-dependent choices, not a checklist: stop when enough evidence is
125
- available. If a broad query favors documentation, read the discovered source
126
- symbol or a narrow line range directly. If references time out, continue with
127
- bounded source/native tracing and disclose its limits; lowering `limit` changes
128
- the display window, not compiler workspace scope. Read each tool's schema:
129
- `max_tokens` is a `context` budget, not an argument for `status` or `exact_references`.
130
-
131
- Known directory prefixes and route topics help query discovery retain the requested
132
- implementation. A named component or compound error code supplies additional local
133
- text evidence. These are bounded ranking hints, not hard directory filters or
134
- compiler-resolved references; connected dependencies may still come from elsewhere.
135
- For a UI inventory, ask explicitly for an overview. For a bug, name the affected
136
- symbol and source area. Check citations and omissions, then narrow to exact targets
137
- when needed rather than repeating the same broad query.
56
+ ## What it is good at
138
57
 
139
- ## Evidence you can inspect
58
+ - **Safe renames and refactors.** The compiler tells apart aliased imports, re-exports and different functions that share a name, and the answer says how many results exist and whether any were cut off.
59
+ - **Reading just enough source.** The agent asks for a file, a symbol or a line range under a size budget and is told what was left out.
60
+ - **Several agents on one repository.** Each Git worktree gets its own index, kept up to date as files change.
61
+ - **A small tool list.** The recommended `lean` setup shows the agent three tools (`context`, `exact_references` and `discover_tools`); the other 65 stay hidden until the agent asks for them.
140
62
 
141
- ContextPro distinguishes source evidence, compiler-resolved references, textual candidates and heuristic fallbacks. Parser and TypeScript workers run in bounded child processes so a worker failure can be reported and recovered from without inherently terminating the MCP server.
63
+ Python references work through a configured Pyright; other languages fall back to structural and text search.
142
64
 
143
- Freshness checks cover saved files, not unsaved editor buffers. Per-file reconciliation is not an atomic snapshot of a repository being edited concurrently. Reference precision depends on language and scope; configured Python uses Pyright LSP, while unconfigured Python heuristics and imported SCIP data retain their distinct provenance.
65
+ ## Honest results
144
66
 
145
- Local-first does not mean sandboxed. Tools run with your user permissions. Hosted embedding or chat providers receive the inputs sent to them, and chat-assisted operations are optional. Read the [security model](SECURITY.md) and [provider configuration](docs/configuration.md) before using sensitive repositories.
67
+ ContextPro has not been shown to make agents finish tasks faster. Our own trials, published in [docs/benchmarks](docs/benchmarks/README.md), include the losses.
146
68
 
147
- ## Build with us
69
+ It is worth trying for renames and refactors where aliased or re-exported callers matter, or when you don't know where the code lives.
148
70
 
149
- Useful contributions include small bug reproductions, language fixtures, reference-completeness tests, realistic benchmarks, clearer setup guides and performance fixes with before/after evidence.
71
+ | Measured | Result |
72
+ | --- | --- |
73
+ | Compiler reference checks on two fixtures (barrel aliases, same-named bindings) | 24 of 24 timed queries passed |
74
+ | Response size on six retrieval tasks vs a scripted `rg`/`git` baseline | about 41% fewer response tokens, but about 6.8× slower per call |
75
+ | Matched agent trials (2 read-only tasks), lean profile vs native tools | **23.8% more** total input, **19.2% more** wall time |
76
+ | Matched agent trials (2 read-only tasks), workflow profile vs native tools | **128.7% more** total input |
150
77
 
151
- ```sh
152
- npm run build
153
- npm test
154
- npm run docs:check
155
- npm run release:check
156
- npm run pack:check
157
- ```
78
+ For simple lookups, plain grep is cheaper. We welcome reproducible comparisons, including ones where another tool wins; see [how we compare](docs/comparison.md).
158
79
 
159
- Start with [CONTRIBUTING.md](CONTRIBUTING.md), [open issues](https://github.com/AlaeddineMessadi/contextpro-mcp/issues) or the [roadmap](docs/roadmaps/contextpro-roadmap.md). [Maintenance](docs/maintenance.md) explains safe cleanup and runtime-specific testing.
80
+ ## Learn more
160
81
 
161
- For questions, see [support](SUPPORT.md). Report vulnerabilities privately through the process in [SECURITY.md](SECURITY.md). Community participation follows our [code of conduct](CODE_OF_CONDUCT.md).
82
+ - [Install and troubleshoot](INSTALL.md)
83
+ - [Agent guide](agent-guide.md): how agents should call the tools, with examples
84
+ - [Configuration](docs/configuration.md): tool profiles, providers and environment variables
85
+ - [Security model](SECURITY.md): what runs locally and what a hosted provider would see
86
+ - [All documentation](docs/README.md) · [Contributing](CONTRIBUTING.md) · [Support](SUPPORT.md)
162
87
 
163
88
  ## License and origins
164
89
 
165
- ContextPro began as a fork of [Context+](https://github.com/ForLoopCodes/contextplus) by ForLoop and has since been largely rewritten around compiler-backed references, worktree-scoped indexes and bounded retrieval. Upstream has been quiet since July 2026, so development continues here. It is distributed under the [MIT license](LICENSE). The original ForLoop copyright notice is preserved. See [NOTICE](NOTICE) for attribution. References to other projects do not imply endorsement.
90
+ ContextPro began as a fork of [Context+](https://github.com/ForLoopCodes/contextplus) by ForLoop and has since been largely rewritten. It is distributed under the [MIT license](LICENSE); the original ForLoop copyright notice is preserved, see [NOTICE](NOTICE).
package/SECURITY.md CHANGED
@@ -12,16 +12,18 @@ Include the affected version or commit, Node/OS/client versions, a minimal redac
12
12
 
13
13
  ## Supported versions
14
14
 
15
- Security fixes target the latest maintained release and `main`. Until the first registry release, identify reports by Git commit. Older versions do not have a promised backport window. Node.js 24 LTS is recommended; CI also checks the Node 20 engine floor. The package's older engine floor is a compatibility declaration, not a promise to maintain end-of-life runtimes.
15
+ Security fixes target the latest maintained release and `main`. Identify reports by npm version or Git commit. Older versions do not have a promised backport window. Node.js 24 LTS is recommended; CI also checks the Node 20 engine floor. The package's older engine floor is a compatibility declaration, not a promise to maintain end-of-life runtimes.
16
16
 
17
17
  ## Trust and data boundaries
18
18
 
19
19
  - **Same-user permissions.** ContextPro is a local stdio MCP process, not a sandbox. Filesystem, edit and command-related operations can use the launching user's access. Choose a trusted project root and review your client's tool permissions.
20
20
  - **Untrusted repositories.** Code, comments, docs, tool results and memory can contain malicious instructions. Agents must treat them as data. Installing dependencies or running a repository's tests, hooks, linters or commands may execute its code.
21
- - **Local state.** `.contextpro/` can contain indexed source, task artifacts, history, memory and restore points. Keep it out of Git and protect it like the repository. It is not entirely disposable cache. The workspace registry can reveal local project paths.
21
+ - **Local state.** `.contextpro/` can contain indexed source, task artifacts, history, memory and restore points. ContextPro writes `.contextpro/.gitignore` to keep it out of Git; protect it like the repository. It is not entirely disposable cache. The workspace registry can reveal local project paths.
22
22
  - **Providers.** Hosted embedding/chat endpoints receive their request inputs, which may include source code. Local Ollama is an option. Structural tools do not require an embedding endpoint; use direct reads or keyword-only retrieval to avoid query-embedding attempts. Merely omitting a chat-model setting is not a network-off guarantee when hosted credentials are present.
23
23
  - **Native dependency recovery.** Automatic ABI repair may invoke npm and download dependencies into an isolated cache. Set `CONTEXTPRO_NATIVE_AUTO_REPAIR=false` when installation must be managed explicitly.
24
24
  - **Diagnostics.** Opt-in tool traces and agent benchmark transcripts can reveal paths, arguments, source and usage metadata. Keep them private and redact before sharing. Do not upload `.env` files or account credentials.
25
25
  - **Correctness limits.** Freshness and scope checks reduce errors; they do not prove an arbitrary change safe. Unsaved buffers, concurrent edits, dynamic calls and incomplete imported indexes require verification.
26
+ - **Evidence labels.** Responses distinguish source evidence, compiler-resolved references, textual candidates and heuristic fallbacks. Freshness checks cover saved files, not unsaved editor buffers, and per-file reconciliation is not an atomic snapshot of a repository being edited concurrently. Configured Python uses Pyright LSP; unconfigured Python heuristics and imported SCIP data keep their own provenance labels.
27
+ - **Worker isolation.** Parser and TypeScript workers run in bounded child processes, so a worker failure is reported and recovered from without necessarily stopping the MCP server. This is fault isolation, not a security sandbox.
26
28
 
27
29
  See [configuration](docs/configuration.md) and [maintenance](docs/maintenance.md) for provider controls and safe cleanup. A clean dependency audit or secret scan is a point-in-time check, not a security certification.