@martinloop/mcp 0.5.6 → 0.5.8
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/README.md +137 -175
- package/dist/arcade/resource.js +20 -20
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/resources.js +148 -160
- package/dist/server.js +192 -43
- package/dist/tools/execution-policy.js +1 -1
- package/dist/tools/get-status.d.ts +2 -4
- package/dist/tools/get-status.js +6 -3
- package/dist/tools/preflight.d.ts +1 -1
- package/dist/tools/run-loop.d.ts +1 -1
- package/dist/tools/run-loop.js +3 -1
- package/dist/tools/run-store.js +1 -1
- package/dist/tools/tool-support.d.ts +3 -2
- package/dist/tools/tool-support.js +9 -2
- package/dist/tools/workflow-governance.d.ts +1 -1
- package/dist/tools/workflow-governance.js +1 -1
- package/dist/vendor/adapters/openai-compatible.js +6 -6
- package/dist/vendor/adapters/verifier-only.js +1 -1
- package/dist/vendor/contracts/execution-policy.js +1 -1
- package/dist/vendor/contracts/exits.d.ts +1 -1
- package/dist/vendor/contracts/governance.d.ts +1 -1
- package/dist/vendor/contracts/index.d.ts +1 -1
- package/dist/vendor/contracts/index.js +1 -2
- package/dist/vendor/contracts/operator.d.ts +1 -1
- package/dist/vendor/contracts/operator.js +1 -2
- package/dist/vendor/core/compiler.d.ts +2 -2
- package/dist/vendor/core/compiler.js +3 -1
- package/dist/vendor/core/exits.js +9 -4
- package/dist/vendor/core/grounding.d.ts +1 -0
- package/dist/vendor/core/grounding.js +28 -1
- package/dist/vendor/core/index.d.ts +2 -2
- package/dist/vendor/core/index.js +29 -12
- package/dist/vendor/core/policy-compiler.js +17 -1
- package/dist/vendor/core/policy.d.ts +1 -1
- package/dist/vendor/core/policy.js +7 -5
- package/dist/vendor/presentation/motion.js +0 -4
- package/dist/workflow-state.js +1 -1
- package/package.json +95 -81
- package/server.json +21 -21
package/README.md
CHANGED
|
@@ -1,175 +1,137 @@
|
|
|
1
|
-
# @martinloop/mcp
|
|
2
|
-
|
|
3
|
-
You give an AI agent a coding task. It runs. You get a bill.
|
|
4
|
-
|
|
5
|
-
But did it actually work? Did it pass your tests? How much did it spend? What files did it touch? Did it loop 47 times trying the same broken approach?
|
|
6
|
-
|
|
7
|
-
You don't know. And that's the problem.
|
|
8
|
-
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
MartinLoop is
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
##
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
###
|
|
59
|
-
```sh
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
| Verifier says "command not found" | Generic "verification failed" | Carries specific failure context into the next allowed attempt |
|
|
139
|
-
| `git restore` fails mid-rollback | Throws, leaves dirty state | Retries once, falls back to `git checkout`, cleans up |
|
|
140
|
-
| Invalid `--profile` flag | Crashes | Warns, falls back to `minimal`, keeps running |
|
|
141
|
-
|
|
142
|
-
## Codex compatibility in 0.5.5
|
|
143
|
-
|
|
144
|
-
MartinLoop no longer assumes one Codex host or one fixed Codex flag set. The CLI resolves the exact Codex executable, reads its advertised capabilities, negotiates a supported write strategy, proves that strategy before reporting launch readiness, and reuses the same contract for the governed run.
|
|
145
|
-
|
|
146
|
-
That means MCP hosts can point MartinLoop at different Codex installations without requiring a documentation-specific approval or sandbox flag to exist everywhere.
|
|
147
|
-
|
|
148
|
-
## Presentation and evidence
|
|
149
|
-
|
|
150
|
-
MCP responses are Markdown-first for humans while retaining structured content for agents and automation. The presentation layer does not rewrite governed truth.
|
|
151
|
-
|
|
152
|
-
MartinLoop Arcade is a terminal-only experience. It does not run inside MCP and cannot influence MCP evidence, budgets, verification, or final outcomes.
|
|
153
|
-
|
|
154
|
-
## Who Uses This
|
|
155
|
-
|
|
156
|
-
- **Engineers running overnight agent loops** — you need a kill switch that actually works, and a receipt in the morning
|
|
157
|
-
- **Teams with shared API budgets** — you need per-task spend caps, not org-wide prayer
|
|
158
|
-
- **Anyone reviewing agent-generated PRs** — the dossier shows what the agent tried, what passed, and what didn't
|
|
159
|
-
- **Teams tired of stitching together point tools** — you want one execution-control lifecycle around coding-agent work from preflight through post-run analysis
|
|
160
|
-
|
|
161
|
-
## Requirements
|
|
162
|
-
|
|
163
|
-
- Node.js 20+
|
|
164
|
-
- One AI coding CLI: [Claude Code](https://docs.anthropic.com/claude-code), [Codex](https://github.com/openai/codex), or [Gemini CLI](https://github.com/google/gemini-cli)
|
|
165
|
-
|
|
166
|
-
## Links
|
|
167
|
-
|
|
168
|
-
- [martin-loop](https://www.npmjs.com/package/martin-loop) — the standalone CLI
|
|
169
|
-
- [MartinLoop for AI Agents](../../docs/for-agents.md)
|
|
170
|
-
- [GitHub](https://github.com/Keesan12/martin-loop) — source and issues
|
|
171
|
-
- [martinloop.com](https://martinloop.com)
|
|
172
|
-
|
|
173
|
-
## License
|
|
174
|
-
|
|
175
|
-
Apache-2.0
|
|
1
|
+
# @martinloop/mcp
|
|
2
|
+
|
|
3
|
+
You give an AI agent a coding task. It runs. You get a bill.
|
|
4
|
+
|
|
5
|
+
But did it actually work? Did it pass your tests? How much did it spend? What files did it touch? Did it loop 47 times trying the same broken approach?
|
|
6
|
+
|
|
7
|
+
You don't know. And that's the problem.
|
|
8
|
+
|
|
9
|
+
## What This Does
|
|
10
|
+
|
|
11
|
+
MartinLoop is a governed loop for AI coding agents. You tell it what to do, set a budget, and point it at your test suite. It runs the agent, checks your tests after every attempt, and stops when either the tests pass or the money runs out.
|
|
12
|
+
|
|
13
|
+
When it's done, you get a receipt — not a vague summary, but a structured record: dollars spent, attempts made, verification results, files changed, and whether you got what you asked for.
|
|
14
|
+
|
|
15
|
+
**One line to connect it:**
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
claude mcp add martin-loop -- npx -y @martinloop/mcp
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
That's it. Your agent now runs governed.
|
|
22
|
+
|
|
23
|
+
## Real Numbers From Real Runs
|
|
24
|
+
|
|
25
|
+
We tested this against live repos with real API spend:
|
|
26
|
+
|
|
27
|
+
| What happened | Without MartinLoop | With MartinLoop |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| Budget: $1.50 task | Agent spent **$28.42** | Agent stopped at **$1.20** |
|
|
30
|
+
| Failing verifier | Retried indefinitely | Stopped after 3 attempts with diagnosis |
|
|
31
|
+
| CLI not on PATH | "not available on PATH" (dead stop) | Auto-discovered in AppData, kept running |
|
|
32
|
+
| `bun run lint && bun run test` | Passed `&&` as a literal arg (always fails) | Routed through shell, worked |
|
|
33
|
+
|
|
34
|
+
These aren't hypotheticals. The $28 overshoot happened in production testing. We fixed the circuit breaker in `0.3.8`.
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
### Claude Code
|
|
39
|
+
```sh
|
|
40
|
+
claude mcp add martin-loop -- npx -y @martinloop/mcp
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Windows:
|
|
44
|
+
```sh
|
|
45
|
+
claude mcp add --transport stdio --scope user martin-loop -- cmd /c npx -y @martinloop/mcp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Codex
|
|
49
|
+
```sh
|
|
50
|
+
codex mcp add martin-loop -- npx -y @martinloop/mcp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Gemini CLI
|
|
54
|
+
```sh
|
|
55
|
+
gemini mcp add martin-loop -- npx -y @martinloop/mcp
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Any MCP Host
|
|
59
|
+
```sh
|
|
60
|
+
npx -y @martinloop/mcp
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## How a Governed Run Works
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
You: "Fix the auth bug. Budget $3. Verify: npm test"
|
|
67
|
+
|
|
68
|
+
martin_doctor → checks CLI, auth, environment
|
|
69
|
+
martin_plan → scopes the task, sets constraints
|
|
70
|
+
martin_preflight → validates before any spend
|
|
71
|
+
martin_run → agent works inside budget + verifier gates
|
|
72
|
+
martin_dossier → receipt: $1.40 spent, 2 attempts, tests pass
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Every attempt runs your verifier. Every dollar is tracked. If the agent drifts off-task, the scope contract catches it. If it blows the budget, the circuit breaker kills the subprocess mid-stream — not after the bill arrives.
|
|
76
|
+
|
|
77
|
+
## What Your Agent Gets
|
|
78
|
+
|
|
79
|
+
### 21 Tools
|
|
80
|
+
|
|
81
|
+
**Run the loop:**
|
|
82
|
+
`martin_doctor` `martin_plan` `martin_preflight` `martin_run` `martin_pause` `martin_continue` `martin_cancel`
|
|
83
|
+
|
|
84
|
+
**Inspect results:**
|
|
85
|
+
`martin_status` `martin_logs` `martin_dossier` `martin_eval` `martin_inspect` `martin_list_runs` `martin_get_run` `martin_get_attempt` `martin_get_verification_results` `martin_triage_runs`
|
|
86
|
+
|
|
87
|
+
**Ship the work:**
|
|
88
|
+
`martin_pr_summary` `martin_create_pr` `martin_review_pr`
|
|
89
|
+
|
|
90
|
+
### 11 Read-Only Resources
|
|
91
|
+
|
|
92
|
+
Your agent can pull context without side effects:
|
|
93
|
+
|
|
94
|
+
`martin://runs/latest` · `martin://runs/latest/proof-card` · `martin://runs/latest/budget-status` · `martin://runs/latest/verifier-evidence` · `martin://runs/recent` · `martin://server/health` · `martin://policies/current` · `martin://agent/next-step` · `martin://guides/mcp-usage` · `martin://guides/agent-start` · `martin://repo/risk-map`
|
|
95
|
+
|
|
96
|
+
### Configuration Profiles
|
|
97
|
+
|
|
98
|
+
Generate host config tuned to your workflow:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
npx martin-loop mcp print-config --host claude --profile minimal # run + inspect
|
|
102
|
+
npx martin-loop mcp print-config --host claude --profile diagnostic # + doctor + triage
|
|
103
|
+
npx martin-loop mcp print-config --host claude --profile full-local # all local tools
|
|
104
|
+
npx martin-loop mcp print-config --host claude --profile github-review # + PR workflow
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## What Happens When Things Go Wrong
|
|
108
|
+
|
|
109
|
+
MartinLoop doesn't just report failures — it tries to fix them:
|
|
110
|
+
|
|
111
|
+
| Failure | Old behavior | Now |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| CLI not on PATH | Error message, dead stop | Searches npm global, homebrew, nvm, scoop — uses what it finds |
|
|
114
|
+
| Verifier says "command not found" | Generic "verification failed" | Tells the next attempt: "bun is missing, install with `npm i -g bun`" |
|
|
115
|
+
| `git restore` fails mid-rollback | Throws, leaves dirty state | Retries once, falls back to `git checkout`, cleans up |
|
|
116
|
+
| Invalid `--profile` flag | Crashes | Warns, falls back to `minimal`, keeps running |
|
|
117
|
+
|
|
118
|
+
## Who Uses This
|
|
119
|
+
|
|
120
|
+
- **Engineers running overnight agent loops** — you need a kill switch that actually works, and a receipt in the morning
|
|
121
|
+
- **Teams with shared API budgets** — you need per-task spend caps, not org-wide prayer
|
|
122
|
+
- **Anyone reviewing agent-generated PRs** — the dossier shows what the agent tried, what passed, and what didn't
|
|
123
|
+
|
|
124
|
+
## Requirements
|
|
125
|
+
|
|
126
|
+
- Node.js 20+
|
|
127
|
+
- One AI coding CLI: [Claude Code](https://docs.anthropic.com/claude-code), [Codex](https://github.com/openai/codex), or [Gemini CLI](https://github.com/google/gemini-cli)
|
|
128
|
+
|
|
129
|
+
## Links
|
|
130
|
+
|
|
131
|
+
- [martin-loop](https://www.npmjs.com/package/martin-loop) — the standalone CLI
|
|
132
|
+
- [GitHub](https://github.com/Keesan12/martin-loop) — source and issues
|
|
133
|
+
- [martinloop.com](https://martinloop.com)
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
Apache-2.0
|
package/dist/arcade/resource.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { MARTIN_ARCADE_MIME_TYPE, MARTIN_ARCADE_RESOURCE_URI, supportsMartinArcadeApp } from "./capabilities.js";
|
|
2
|
-
const ARCADE_APP_HTML = `<!doctype html>
|
|
3
|
-
<html lang="en" data-martin-arcade-app>
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
7
|
-
<title>MartinLoop Arcade</title>
|
|
8
|
-
<style>
|
|
9
|
-
:root { color-scheme: light dark; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
|
|
10
|
-
body { margin: 0; min-height: 100vh; display: grid; place-items: center; background: Canvas; color: CanvasText; }
|
|
11
|
-
main { width: min(42rem, calc(100% - 2rem)); border: 1px solid currentColor; padding: 1.25rem; }
|
|
12
|
-
p { line-height: 1.5; }
|
|
13
|
-
</style>
|
|
14
|
-
</head>
|
|
15
|
-
<body>
|
|
16
|
-
<main aria-labelledby="arcade-title">
|
|
17
|
-
<h1 id="arcade-title">MartinLoop Arcade</h1>
|
|
18
|
-
<p>Presentation only. Governed run status and outcomes remain authoritative in MartinLoop.</p>
|
|
19
|
-
<p aria-live="polite" data-run-status>Waiting for authoritative run evidence.</p>
|
|
20
|
-
</main>
|
|
21
|
-
</body>
|
|
2
|
+
const ARCADE_APP_HTML = `<!doctype html>
|
|
3
|
+
<html lang="en" data-martin-arcade-app>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
7
|
+
<title>MartinLoop Arcade</title>
|
|
8
|
+
<style>
|
|
9
|
+
:root { color-scheme: light dark; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
|
|
10
|
+
body { margin: 0; min-height: 100vh; display: grid; place-items: center; background: Canvas; color: CanvasText; }
|
|
11
|
+
main { width: min(42rem, calc(100% - 2rem)); border: 1px solid currentColor; padding: 1.25rem; }
|
|
12
|
+
p { line-height: 1.5; }
|
|
13
|
+
</style>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<main aria-labelledby="arcade-title">
|
|
17
|
+
<h1 id="arcade-title">MartinLoop Arcade</h1>
|
|
18
|
+
<p>Presentation only. Governed run status and outcomes remain authoritative in MartinLoop.</p>
|
|
19
|
+
<p aria-live="polite" data-run-status>Waiting for authoritative run evidence.</p>
|
|
20
|
+
</main>
|
|
21
|
+
</body>
|
|
22
22
|
</html>`;
|
|
23
23
|
export function listArcadeResources(capabilities) {
|
|
24
24
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MARTIN_MCP_PACKAGE_VERSION = "0.5.
|
|
1
|
+
export declare const MARTIN_MCP_PACKAGE_VERSION = "0.5.8";
|
package/dist/package-version.js
CHANGED