You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These patterns were discovered during three rounds of auditing this project. Include them in every audit pass.
211
+
212
+
### Common MCP Server Pitfalls
213
+
-**`server.tool()` is deprecated** — always verify tools use `server.registerTool()` with the config object pattern
214
+
-**Missing `isError: true`** — tool failure responses MUST include `isError: true` per MCP spec, otherwise clients can't distinguish failures from success
215
+
-**Annotations default to worst-case** — without `readOnlyHint`, every tool is treated as potentially destructive. Read-only tools (list, get, browse) need explicit `readOnlyHint: true`
216
+
-**`openWorldHint`** — tools that reach Docker registries, Git servers, or external URLs should be `openWorldHint: true`
217
+
-**Prompts referencing nonexistent tools** — always cross-check every tool name in prompts/skill against actual `registerTool()` calls
218
+
-**SSL bypass with native fetch** — Node.js native `fetch()` ignores `https.Agent`. Use `NODE_TLS_REJECT_UNAUTHORIZED` or undici's `dispatcher` option
219
+
220
+
### Common Code Quality Patterns
221
+
-**Inline interfaces drift** — tool files that define their own response interfaces will drift from the actual API. Use shared types
222
+
-**Magic numbers** — size conversions (1e6, 1e9, 1073741824) should use utility functions, not inline math. Watch for SI vs binary unit inconsistency
223
+
-**`toolHandler()` wrapper** — eliminates try-catch boilerplate and centralizes error formatting. Any raw try-catch in a tool handler is a red flag
224
+
-**Version string duplication** — read version from package.json at runtime instead of hardcoding in multiple files
225
+
-**Per-session overhead** — MCP servers with 100+ tools should share tool registrations across HTTP sessions, not re-register per connection
226
+
227
+
### Testing Gaps to Check
228
+
-**Tests exist but never run** — vitest config with thresholds means nothing if no test files exist and CI doesn't run tests
229
+
-**Tool handler tests need isError assertion** — if toolHandler was updated, the error test must verify `isError: true`
230
+
-**Integration tests need mocked client** — mock `getArcaneClient()` to return a fake with `get`/`post`/`delete` stubs
231
+
-**Prompt tests should verify tool names** — grep for `arcane_` in prompt content and cross-check against registered tools
232
+
233
+
### Security Items Easy to Miss
234
+
-**`.env` committed to git** — always check `git ls-files` for secrets, not just `.gitignore`
235
+
-**Config file permissions** — `~/.arcane/config.json` with API keys should be 600, not world-readable
236
+
-**Health endpoint metadata** — session counts, server internals should not be exposed without auth
237
+
-**Path traversal on browse endpoints** — any tool accepting a `path` parameter for file operations needs `..` validation
238
+
-**Rate limiting** — HTTP transport without rate limiting enables denial-of-service
239
+
240
+
### Audit Process Improvements
241
+
-**Run the audit in phases** — fix critical/high first, re-audit, then medium, then low. Don't try to fix everything in one pass
242
+
-**Use parallel agents in worktrees** — independent fixes (different files) can run simultaneously without merge conflicts
243
+
-**Cross-check tool counts** — `grep -c "registerTool(" src/tools/*.ts` should match documented counts
244
+
-**Verify CI actually runs** — a green CI that only builds and doesn't test gives false confidence
245
+
-**Check npm publish** — the published package may be stale if `npm publish` wasn't run after fixes
### [MEDIUM] TS-01: Interface definitions duplicated across tool files
69
-
-**File:** All 25 tool files define local interfaces
70
-
-**Description:** Each tool file has its own `Container`, `Volume`, etc. interfaces instead of importing from `src/types/generated/arcane-api.ts`. Drift risk.
71
-
-**Recommendation:** Refactor to shared types in a future release. Low urgency since interfaces are simple and the generated types have complex nested generics.
72
-
73
-
### [MEDIUM] PERF-01: New McpServer created per HTTP session
74
-
-**File:**`src/tcp-server.ts`
75
-
-**Description:** Each session creates a fresh McpServer + registers 180 tools. With 100 max sessions, this is non-trivial memory use.
76
-
-**Recommendation:** Profile actual memory usage under load before optimizing. The per-session isolation is a security benefit.
77
-
78
-
### [MEDIUM] TEST-03: Test coverage below 60% threshold
79
-
-**Description:** 50 tests cover utilities and config, but no tool modules or resources/prompts are tested.
80
-
-**Recommendation:** Add integration tests for 2-3 tool modules with mocked HTTP client.
81
-
82
71
### [LOW] CQ-03: Logger import boilerplate in 25 tool files
83
72
-**Description:** All tool files import logger for a single `logger.debug("Registered X tools")` call.
84
73
@@ -140,11 +129,15 @@ All critical and high issues from the v2.0.0 audit have been resolved:
140
129
- No path separator issues
141
130
- Portable plugin paths
142
131
143
-
### Testing: 50 tests, 4 files
132
+
### Testing: 79 tests, 8 files
144
133
- tool-helpers (success/error/isError/params)
145
134
- format (formatSize, formatSizeCompact, formatSizeMB, formatSizeGB, validatePath)
0 commit comments