devworkspace 0.3.2 → 0.4.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 +57 -0
- package/README.md +24 -0
- package/dist/agents/claude/content.js +27 -4
- package/dist/agents/claude/content.js.map +1 -1
- package/dist/cli/args.d.ts +4 -0
- package/dist/cli/args.js +17 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/help.js +43 -4
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/render.d.ts +2 -0
- package/dist/cli/render.js +40 -1
- package/dist/cli/render.js.map +1 -1
- package/dist/cli/run.js +78 -4
- package/dist/cli/run.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/protocol.d.ts +35 -0
- package/dist/mcp/protocol.js +175 -0
- package/dist/mcp/protocol.js.map +1 -0
- package/dist/mcp/server.d.ts +25 -0
- package/dist/mcp/server.js +163 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/setup.d.ts +54 -0
- package/dist/mcp/setup.js +288 -0
- package/dist/mcp/setup.js.map +1 -0
- package/dist/mcp/tools.d.ts +8 -0
- package/dist/mcp/tools.js +446 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/types.d.ts +80 -0
- package/dist/mcp/types.js +15 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/services/taskContext.d.ts +28 -5
- package/dist/services/taskContext.js +420 -40
- package/dist/services/taskContext.js.map +1 -1
- package/docs/agents.md +32 -0
- package/docs/context-accuracy-report.md +60 -0
- package/docs/context-evaluation.md +170 -0
- package/docs/mcp.md +264 -0
- package/package.json +3 -1
package/docs/mcp.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# DevWorkspace Model Context Protocol (MCP) Integration
|
|
2
|
+
|
|
3
|
+
DevWorkspace includes a local-first Model Context Protocol (MCP) server that enables AI coding agents (such as Claude Code, OpenAI Codex, and Google Antigravity) to retrieve project architecture, role-sliced context, and file metadata automatically during development.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. What DevWorkspace MCP Is
|
|
8
|
+
|
|
9
|
+
The DevWorkspace MCP integration exposes DevWorkspace's deterministic context retrieval engine over the standard Model Context Protocol (MCP 2024-11-05). It allows AI agents to inspect:
|
|
10
|
+
|
|
11
|
+
- High-level project architecture and stack detection (`get_project_overview`)
|
|
12
|
+
- Natural-language task context with role slicing (`get_task_context` for `explorer`, `tester`, `reviewer`)
|
|
13
|
+
- Workspace-relative file context bounded to 32KB (`get_file_context`)
|
|
14
|
+
|
|
15
|
+
The developer does not need to manually copy and paste context into conversation prompts.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 2. Why It Runs Locally
|
|
20
|
+
|
|
21
|
+
DevWorkspace MCP is strictly local-first:
|
|
22
|
+
|
|
23
|
+
- **stdio transport only:** The server runs as a child process launched directly by your coding agent over standard input/output.
|
|
24
|
+
- **Zero open ports:** It does not bind a TCP listener, open HTTP ports, or require a reverse proxy / tunnel.
|
|
25
|
+
- **No cloud dependencies:** No cloud account, third-party server, or LLM API key is required to serve context.
|
|
26
|
+
- **Deterministic retrieval:** Context is derived offline from local repository evidence.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 3. Prerequisites
|
|
31
|
+
|
|
32
|
+
- **Node.js:** `>= 20.11.0`
|
|
33
|
+
- **DevWorkspace:** Installed locally in your project or globally (`npm install -D devworkspace` or `npm install -g devworkspace`).
|
|
34
|
+
- **An initialized project:** The project root must contain `.devworkspace/project.json` (created with `npx devworkspace init`).
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 4. Installation and Initialization
|
|
39
|
+
|
|
40
|
+
In an existing software repository:
|
|
41
|
+
|
|
42
|
+
### Bash / macOS / Linux:
|
|
43
|
+
```bash
|
|
44
|
+
# 1. Initialize DevWorkspace in your project
|
|
45
|
+
npx devworkspace init
|
|
46
|
+
|
|
47
|
+
# 2. Analyze the project layout and stack
|
|
48
|
+
npx devworkspace analyze
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Windows PowerShell:
|
|
52
|
+
```powershell
|
|
53
|
+
# 1. Initialize DevWorkspace in your project
|
|
54
|
+
npx devworkspace init
|
|
55
|
+
|
|
56
|
+
# 2. Analyze the project layout and stack
|
|
57
|
+
npx devworkspace analyze
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 5. Agent-Specific Setup
|
|
63
|
+
|
|
64
|
+
DevWorkspace provides single-command setup for supported AI coding agents.
|
|
65
|
+
|
|
66
|
+
### Claude Code
|
|
67
|
+
|
|
68
|
+
To configure Claude Code:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Preview planned changes without modifying files:
|
|
72
|
+
npx devworkspace setup --agent claude-code --check
|
|
73
|
+
|
|
74
|
+
# Apply configuration:
|
|
75
|
+
npx devworkspace setup --agent claude-code
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**What this configures:**
|
|
79
|
+
- Creates or updates `.mcp.json` at the project root:
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"devworkspace": {
|
|
84
|
+
"command": "devworkspace",
|
|
85
|
+
"args": ["mcp", "serve"]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
- Appends or updates instructions in `CLAUDE.md` directing Claude Code to invoke `get_project_overview` when starting work and `get_task_context` when addressing issues.
|
|
91
|
+
|
|
92
|
+
### OpenAI Codex
|
|
93
|
+
|
|
94
|
+
To configure OpenAI Codex:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Preview planned changes:
|
|
98
|
+
npx devworkspace setup --agent codex --check
|
|
99
|
+
|
|
100
|
+
# Apply configuration:
|
|
101
|
+
npx devworkspace setup --agent codex
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**What this configures:**
|
|
105
|
+
- Creates or updates `mcp.json` at the project root with the `devworkspace` server.
|
|
106
|
+
- Updates `AGENTS.md` with instructions on invoking DevWorkspace tools.
|
|
107
|
+
|
|
108
|
+
### Google Antigravity
|
|
109
|
+
|
|
110
|
+
To configure Google Antigravity:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Preview planned changes:
|
|
114
|
+
npx devworkspace setup --agent antigravity --check
|
|
115
|
+
|
|
116
|
+
# Apply configuration:
|
|
117
|
+
npx devworkspace setup --agent antigravity
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**What this configures:**
|
|
121
|
+
- Creates or updates `.antigravity/mcp.json` registering the local `devworkspace mcp serve` command.
|
|
122
|
+
- Updates `.antigravity/rules` instructing the agent when to call `get_project_overview` and `get_task_context`.
|
|
123
|
+
|
|
124
|
+
### Configure All Agents at Once
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npx devworkspace setup --agent all
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 6. How to Confirm the Server Is Connected
|
|
133
|
+
|
|
134
|
+
1. **Verify configuration files:**
|
|
135
|
+
Confirm `.mcp.json`, `mcp.json`, or `.antigravity/mcp.json` is present.
|
|
136
|
+
2. **Run a configuration check:**
|
|
137
|
+
```bash
|
|
138
|
+
npx devworkspace setup --agent claude-code --check
|
|
139
|
+
```
|
|
140
|
+
If all items report `UNCHANGED`, the configuration is verified.
|
|
141
|
+
3. **In Claude Code / Codex / Antigravity:**
|
|
142
|
+
Start your agent and run:
|
|
143
|
+
- Claude Code: `/mcp` displays active servers (`devworkspace: connected`).
|
|
144
|
+
- Or ask the agent: *"Call the get_project_overview tool to inspect the repository."*
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 7. How to Test a Context Request Manually
|
|
149
|
+
|
|
150
|
+
You can test requests by piping JSON-RPC lines to `devworkspace mcp serve`:
|
|
151
|
+
|
|
152
|
+
### Bash:
|
|
153
|
+
```bash
|
|
154
|
+
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05"}}\n{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_project_overview","arguments":{}}}\n' | npx devworkspace mcp serve
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Windows PowerShell:
|
|
158
|
+
```powershell
|
|
159
|
+
@'
|
|
160
|
+
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05"}}
|
|
161
|
+
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_project_overview","arguments":{}}}
|
|
162
|
+
'@ | npx devworkspace mcp serve
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 8. What the Agent Can and Cannot Access
|
|
168
|
+
|
|
169
|
+
### What the agent CAN access:
|
|
170
|
+
- **Project architecture summary:** Detected languages, web/UI frameworks, package structure, and health state.
|
|
171
|
+
- **Task context:** Facts, verification commands (`commands.json`), architectural decision records (`.devworkspace/decisions/`), and safety rules.
|
|
172
|
+
- **Specific source files:** Regular files within the project root, bounded to 32KB per call.
|
|
173
|
+
|
|
174
|
+
### What the agent CANNOT access:
|
|
175
|
+
- **No arbitrary shell execution:** The MCP server contains zero execution tools. It cannot run commands, scripts, or package managers.
|
|
176
|
+
- **No file modification:** All MCP tools are strictly read-only.
|
|
177
|
+
- **No access outside the workspace:** Path traversal (`..`), absolute paths, and symlink escapes are strictly blocked.
|
|
178
|
+
- **No credential access:** Environment files and private keys are barred by policy.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 9. Secret Exclusions and Workspace Boundaries
|
|
183
|
+
|
|
184
|
+
DevWorkspace enforces defense-in-depth security:
|
|
185
|
+
|
|
186
|
+
1. **Workspace Boundary:**
|
|
187
|
+
Every requested path is validated using canonical resolution (`resolveInside`) and symlink escape checks (`assertNoSymlinkEscape`). Requests attempting to escape the project root return a `Security Error`.
|
|
188
|
+
2. **Credential Exclusion Policy:**
|
|
189
|
+
The following file patterns are automatically blocked from `get_file_context`:
|
|
190
|
+
- `.env`, `.env.*` (except harmless templates like `.env.example`)
|
|
191
|
+
- `*.pem`, `*.key`, `*.p12`, `*.pfx`, `*.keystore`
|
|
192
|
+
- `id_rsa*`, `id_ed25519*`
|
|
193
|
+
- `credentials*`, `secrets*`, `service-account*.json`
|
|
194
|
+
- `.npmrc`, `.pypirc`, `.netrc`, `.htpasswd`
|
|
195
|
+
- `terraform.tfstate*`, `*.tfvars`
|
|
196
|
+
3. **Secret Redaction:**
|
|
197
|
+
Any detected secret patterns (API keys, private key blocks, AWS tokens, GitHub tokens, JWTs, URL credentials) are masked with `[REDACTED:<type>]` before context is returned.
|
|
198
|
+
4. **Prompt-Injection Resistance:**
|
|
199
|
+
All retrieved context is demarcated with `=== BEGIN UNTRUSTED DEVWORKSPACE CONTEXT ===` headers. The agent is explicitly instructed to treat repository content as untrusted evidence rather than executable instructions.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 10. Privacy and External Data Transmission
|
|
204
|
+
|
|
205
|
+
- **Local Execution:** DevWorkspace runs entirely on your local machine. It does not send telemetry, analytics, or file contents to any DevWorkspace server.
|
|
206
|
+
- **AI Provider Notice:** When an AI coding agent calls DevWorkspace MCP tools, the retrieved context enters the agent's context window. Depending on your agent configuration and AI provider (e.g., Anthropic, OpenAI, Google), the agent will send this context to its cloud model.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 11. Troubleshooting
|
|
211
|
+
|
|
212
|
+
| Issue | Cause | Resolution |
|
|
213
|
+
| --- | --- | --- |
|
|
214
|
+
| `File not found: project.json` | Running in an uninitialized directory | Run `npx devworkspace init` from the project root |
|
|
215
|
+
| `Refusing absolute path` | Path parameter was absolute | Pass workspace-relative paths, e.g., `src/index.ts` |
|
|
216
|
+
| `Security Policy Refusal` | File contains secrets (e.g., `.env`) | DevWorkspace refuses credential files by policy |
|
|
217
|
+
| Agent does not call MCP tools | Agent instructions missing or ignored | Run `npx devworkspace setup --agent <agent>` and ensure project instructions (`CLAUDE.md`, `AGENTS.md`) include DevWorkspace guidance |
|
|
218
|
+
| MCP server exits immediately | Stdio stream closed by parent | Ensure the parent agent keeps stdin open while communicating |
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 12. Uninstallation and Cleanup
|
|
223
|
+
|
|
224
|
+
To remove DevWorkspace MCP configuration:
|
|
225
|
+
|
|
226
|
+
1. Remove the `"devworkspace"` entry from `.mcp.json`, `mcp.json`, or `.antigravity/mcp.json`.
|
|
227
|
+
2. To remove DevWorkspace instructions from agent markdown files:
|
|
228
|
+
```bash
|
|
229
|
+
npx devworkspace reset --include-agent-files
|
|
230
|
+
```
|
|
231
|
+
(Only managed `<!-- devworkspace:start -->` and `<!-- devworkspace-mcp:start -->` blocks are removed; user content is preserved).
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 13. Known Client Limitations & PATH Requirements
|
|
236
|
+
|
|
237
|
+
- **CLI PATH requirement:** The generated MCP configuration specifies `"command": "devworkspace"`, which requires `devworkspace` to be discoverable in the coding agent's executable `PATH` (for instance, via `npm install -g devworkspace` or having the package manager's bin folder in PATH).
|
|
238
|
+
- If `devworkspace` is installed locally as a devDependency and not globally in PATH, adjust the agent configuration to use `npx`:
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"mcpServers": {
|
|
242
|
+
"devworkspace": {
|
|
243
|
+
"command": "npx",
|
|
244
|
+
"args": ["-y", "devworkspace", "mcp", "serve"]
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
- Alternatively, specify the absolute path to your Node.js runtime and the CLI bundle (e.g. `node /path/to/dist/cli/main.js mcp serve`).
|
|
250
|
+
- **Initialization Lifecycle:** MCP specification (2024-11-05) requires initialization prior to general requests. Calling `tools/list` or `tools/call` prior to completing the `initialize` handshake returns JSON-RPC error code `-32600` (`INVALID_REQUEST`). `ping` is supported both before and after initialization.
|
|
251
|
+
- **JSON-RPC Version:** MCP requires JSON-RPC 2.0. Clients sending invalid JSON-RPC receive standard error code `-32700` (`PARSE_ERROR`) or `-32600` (`INVALID_REQUEST`).
|
|
252
|
+
- **Interactive Verification:** Live interactive tool calling in Claude Code, OpenAI Codex, and Google Antigravity depends on the respective client applications executing in a compatible desktop or terminal environment. While standard stdio protocol compliance is fully covered by automated integration tests, live AI client behavior remains subject to agent-specific client updates and context window limits.
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## 14. Manual Debugging
|
|
257
|
+
|
|
258
|
+
To run the MCP server with diagnostic debug logging to stderr:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
# Debug mode writes protocol trace to stderr without corrupting stdout JSON-RPC
|
|
262
|
+
npx devworkspace mcp serve --debug
|
|
263
|
+
```
|
|
264
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devworkspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Project-local AI engineering workspace: deterministic repository discovery, portable project knowledge, tasks, decisions and verification gates for AI coding agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
"coverage": "vitest run --coverage",
|
|
37
37
|
"audit:security": "npm audit --omit=dev --audit-level=high",
|
|
38
38
|
"smoke": "node scripts/smoke.mjs",
|
|
39
|
+
"eval": "node scripts/eval-accuracy.mjs",
|
|
40
|
+
"eval:accuracy": "node scripts/eval-accuracy.mjs --json reports/context-accuracy-report.json --markdown docs/context-accuracy-report.md",
|
|
39
41
|
"release:check": "node scripts/release-check.mjs",
|
|
40
42
|
"prepack": "npm run build"
|
|
41
43
|
},
|