@reworkdigital.io/rework-proof-mcp 1.2.1 → 1.3.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/README.md CHANGED
@@ -22,6 +22,34 @@ does **not** claim.
22
22
 
23
23
  No API key. No account. Every tool here reads public endpoints.
24
24
 
25
+ ### Or use the hosted server
26
+
27
+ The same four tools are served at a URL, for clients that take a remote
28
+ server (Claude's connectors, for one) and for anyone who would rather not
29
+ install anything:
30
+
31
+ ```
32
+ https://api.reworkdigital.io/mcp
33
+ ```
34
+
35
+ It speaks MCP's Streamable HTTP transport: POST one JSON-RPC message, get one
36
+ JSON response. No login, no session, no cookies. To see the tools it offers:
37
+
38
+ ```bash
39
+ curl -s https://api.reworkdigital.io/mcp -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
40
+ ```
41
+
42
+ Both servers read their tools from the same file,
43
+ [`src/mcp-spec.json`](src/mcp-spec.json), so a tool is described the same way
44
+ whichever one you use. One difference is worth knowing. With this package,
45
+ `lookup_rework_attestation` hashes the credential on your machine and sends
46
+ only the digest. With the hosted server the credential travels to REWORK,
47
+ which hashes it there and stores nothing; pass `digest` yourself if you would
48
+ rather it never left.
49
+
50
+ Every tool only reads, and each one says so (`readOnlyHint`), so a client can
51
+ run them without asking each time.
52
+
25
53
  ## Tools
26
54
 
27
55
  | Tool | What it does |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reworkdigital.io/rework-proof-mcp",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "mcpName": "io.github.reworkio/rework-proof",
5
5
  "description": "MCP server for verifying REWORK credentials — check whether delivered work is genuinely the author's.",
6
6
  "license": "MIT",
@@ -1,6 +1,6 @@
1
1
  {
2
- "$comment": "The one definition of what counts as a DECLARED AI assistant in a commit message. Every runtime that reads commit messages for REWORK Proof loads this file and nothing else, so a commit reads the same from the Action, the App and the MCP server. Each `tools[].pattern` is a regular expression fragment written in the subset that JavaScript and Python evaluate identically: no lookbehind, no named groups, no flags inline. Matching is always case-insensitive. `patterns` are tried in order and the first hit is the verdict; `{{tools}}` expands to the alternation of every tool pattern. A match means the author DECLARED the tool in the message. No match means nothing was declared; it never means nothing was used.",
3
- "version": 1,
2
+ "$comment": "The one definition of what counts as a DECLARED AI assistant in a commit message. Every runtime that reads commit messages for REWORK Proof loads this file and nothing else, so a commit reads the same from the Action, the App and the MCP server. Each `tools[].pattern` is a regular expression fragment written in the subset that JavaScript and Python evaluate identically: no lookbehind, no named groups, no flags inline. Matching is always case-insensitive. `patterns` are tried in order and the first hit is the verdict; `{{tools}}` expands to the alternation of every tool pattern. A match means the author DECLARED the tool in the message. No match means nothing was declared; it never means nothing was used. Version 2 (2026-11-23) adds more tools and the trailers that projects' own AI policies ask for (`Assisted-by:`, `Generated-by:`, `AI-assisted: true`). Each tool added then carries the `source` its trailer was read from; `observed` means the exact text was read there, `assumed` means it was seen only in passing or is inferred. A tool whose name is an ordinary word or a first name is matched on its address or bot login only, never on the name.",
3
+ "version": 2,
4
4
  "tools": [
5
5
  {
6
6
  "name": "Claude",
@@ -88,6 +88,171 @@
88
88
  "pattern": "\\bSWE-agent\\b",
89
89
  "example": "Co-authored-by: SWE-agent <swe-agent@example.invalid>",
90
90
  "evidence": "assumed"
91
+ },
92
+ {
93
+ "name": "OpenHands",
94
+ "pattern": "\\bOpenHands\\b|openhands@all-hands\\.dev",
95
+ "example": "Co-authored-by: openhands <openhands@all-hands.dev>",
96
+ "evidence": "observed",
97
+ "source": "https://github.com/OpenHands/OpenHands/blob/997618d3f26f7234a67fea2494949903dc87f597/src/services/settings.ts"
98
+ },
99
+ {
100
+ "name": "opencode",
101
+ "pattern": "noreply@opencode\\.ai|opencode-agent\\[bot\\]",
102
+ "example": "Co-authored-by: opencode <noreply@opencode.ai>",
103
+ "evidence": "observed",
104
+ "source": "https://github.com/numan-cli/numan/commit/bfc9f292767d953f551f43e94d579ee1ee0be6a5",
105
+ "note": "Read in public commits and a contributing guide; the CLI's own source showed no default trailer."
106
+ },
107
+ {
108
+ "name": "Crush",
109
+ "pattern": "crush@charm\\.land|\\bCrush:\\S",
110
+ "example": "Co-Authored-By: Crush <crush@charm.land>",
111
+ "evidence": "observed",
112
+ "source": "https://github.com/charmbracelet/crush/blob/main/internal/agent/tools/bash.md.tpl",
113
+ "note": "Crush is an ordinary word, so only its address or the `Crush:<model>` form counts. Its default is `Assisted-by: Crush:<model>` under a `Generated with Crush` line."
114
+ },
115
+ {
116
+ "name": "Qwen Code",
117
+ "pattern": "\\bQwen-Coder\\b|qwen-coder@alibabacloud\\.com",
118
+ "example": "Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>",
119
+ "evidence": "observed",
120
+ "source": "https://github.com/QwenLM/qwen-code/blob/56c15cf50286ff55f886d4375a46a362bef806d3/packages/core/src/tools/shell.test.ts"
121
+ },
122
+ {
123
+ "name": "Mistral Vibe",
124
+ "pattern": "\\bMistral Vibe\\b|vibe@mistral\\.ai",
125
+ "example": "Co-Authored-By: Mistral Vibe <vibe@mistral.ai>",
126
+ "evidence": "observed",
127
+ "source": "https://github.com/mistralai/mistral-vibe/blob/e76235b203b8965af584e88e69284bc704c31a1f/vibe/core/system_prompt.py"
128
+ },
129
+ {
130
+ "name": "Warp",
131
+ "pattern": "agent@warp\\.dev",
132
+ "example": "Co-Authored-By: Warp <agent@warp.dev>",
133
+ "evidence": "observed",
134
+ "source": "https://github.com/warpdotdev/warp/blob/4540015ee515700ddb539d7dc634febaec10b1fc/app/src/ai/agent_sdk/driver/git_credentials.rs",
135
+ "note": "Warp is an ordinary word; only the address counts."
136
+ },
137
+ {
138
+ "name": "Factory Droid",
139
+ "pattern": "factory-droid\\[bot\\]",
140
+ "example": "Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>",
141
+ "evidence": "observed",
142
+ "source": "https://github.com/Factory-AI/factory/blob/ddd7d36e2577929ad1a2c1dc5b9ee04580325c3b/docs/guides/droid-exec/github-actions.mdx"
143
+ },
144
+ {
145
+ "name": "JetBrains Junie",
146
+ "pattern": "junie@jetbrains\\.com",
147
+ "example": "Co-authored-by: Junie <junie@jetbrains.com>",
148
+ "evidence": "observed",
149
+ "source": "https://github.com/JetBrains/MPS/blob/28d48a47f09e1d13265227389862ed541a21ae1d/.agents/git.md",
150
+ "note": "Junie is also a first name; only the address counts."
151
+ },
152
+ {
153
+ "name": "Replit Agent",
154
+ "pattern": "\\bReplit Agent\\b|agent@replit\\.com",
155
+ "example": "Co-authored-by: Replit Agent <agent@replit.com>",
156
+ "evidence": "observed",
157
+ "source": "https://github.com/founder24/-kalukaliya/commit/b030f37a539e8b7a1fef66b0c4e1658bd7a87e61"
158
+ },
159
+ {
160
+ "name": "Lovable",
161
+ "pattern": "lovable-dev\\[bot\\]|gpt-engineer-app\\[bot\\]",
162
+ "example": "Co-authored-by: lovable-dev[bot]",
163
+ "evidence": "assumed",
164
+ "source": "https://docs.lovable.dev",
165
+ "note": "Lovable's documentation (its GitHub page) names these bot logins as the commit AUTHOR; a co-author line carrying one is assumed, not observed."
166
+ },
167
+ {
168
+ "name": "v0",
169
+ "pattern": "it\\+v0agent@vercel\\.com",
170
+ "example": "Co-authored-by: v0 <it+v0agent@vercel.com>",
171
+ "evidence": "observed",
172
+ "source": "https://github.com/vercel-labs/vgpu/commit/c290dd32453642eee629db74665d9705bd9664c2",
173
+ "note": "`v0` reads as a version number; only the address counts."
174
+ },
175
+ {
176
+ "name": "Amazon Q Developer",
177
+ "pattern": "amazon-q-developer\\[bot\\]",
178
+ "example": "Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>",
179
+ "evidence": "observed",
180
+ "source": "https://github.com/CyanAutomation/motioninocean/commit/785ab4d34b62a2c589e1280c4a5f66f4f7457325"
181
+ },
182
+ {
183
+ "name": "Kilo Code",
184
+ "pattern": "\\bKilo Code\\b|kilo-code-bot\\[bot\\]|kilo-code@users\\.noreply\\.github\\.com",
185
+ "example": "Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com>",
186
+ "evidence": "observed",
187
+ "source": "https://github.com/Jonathan-Harris1975/AIMS/commit/bcd15d51308504721777ad5566d0909560ab77b5"
188
+ },
189
+ {
190
+ "name": "Goose",
191
+ "pattern": "\\bGoose\\s*<opensource@block\\.xyz>",
192
+ "example": "Co-authored-by: Goose <opensource@block.xyz>",
193
+ "evidence": "observed",
194
+ "source": "https://github.com/block/ghost/commit/c55888ea181aeef7b4f5bd2af85129239986702f",
195
+ "note": "Goose is an ordinary word and the address is Block's general open-source one, so the two have to appear together."
196
+ },
197
+ {
198
+ "name": "Trae",
199
+ "pattern": "\\bTRAE CLI\\b|traecli@bytedance\\.com",
200
+ "example": "Co-authored-by: TRAE CLI <traecli@bytedance.com>",
201
+ "evidence": "observed",
202
+ "source": "https://github.com/volcengine/OpenViking/commit/55c531e2e84ff681095fb69cdbb76fb6ce613c62"
203
+ },
204
+ {
205
+ "name": "Rovo Dev",
206
+ "pattern": "\\bRovo Dev\\b|rovo-dev@atlassian\\.com",
207
+ "example": "Co-authored-by: Rovo Dev <rovo-dev@atlassian.com>",
208
+ "evidence": "observed",
209
+ "source": "https://github.com/dkds/spring-security-lab/commit/d340fbacffc1351be20f11c80e9de73c0ab018f6"
210
+ },
211
+ {
212
+ "name": "Codegen",
213
+ "pattern": "codegen-sh\\[bot\\]",
214
+ "example": "Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>",
215
+ "evidence": "observed",
216
+ "source": "https://github.com/evgenygurin/codegen-bridge/commit/c94a55a728307c9f29adce84f2159bfdeb9caced"
217
+ },
218
+ {
219
+ "name": "Sweep AI",
220
+ "pattern": "sweep-ai\\[bot\\]",
221
+ "example": "Co-authored-by: sweep-ai[bot] <128439645+sweep-ai[bot]@users.noreply.github.com>",
222
+ "evidence": "observed",
223
+ "source": "https://github.com/Aaqibhafeezkhan/polyglot-utilities-toolkit/commit/ee49f14a70d2cceda4a53bd8b721f277e4dbef62",
224
+ "note": "An unrelated `Sweep Bot` account exists; only the `sweep-ai[bot]` login counts."
225
+ },
226
+ {
227
+ "name": "Tembo",
228
+ "pattern": "tembo(?:-io)?\\[bot\\]",
229
+ "example": "Co-authored-by: tembo[bot] <208362400+tembo[bot]@users.noreply.github.com>",
230
+ "evidence": "observed",
231
+ "source": "https://github.com/solidjs/solid/commit/88581892b67aa2cadd0d116f17677601d4ff5009"
232
+ },
233
+ {
234
+ "name": "Kimi",
235
+ "pattern": "noreply@moonshot\\.cn",
236
+ "example": "Co-Authored-By: Kimi <noreply@moonshot.cn>",
237
+ "evidence": "assumed",
238
+ "source": "https://github.com/ShaulLavo/bun-wasm/commit/3c8080b84a04222c9bec0afcee0ba57ae1a1588f",
239
+ "note": "Seen in commit search results, not confirmed as the tool's default. Kimi is also a first name; only the address counts."
240
+ },
241
+ {
242
+ "name": "Grok",
243
+ "pattern": "noreply@x\\.ai",
244
+ "example": "Co-Authored-By: Grok 4.7 <noreply@x.ai>",
245
+ "evidence": "assumed",
246
+ "source": "https://github.com/OpenSesame-Labs/OpenSesame/commit/133eb7f76e7000eb0d60f3b5afe1d6c9234ea7b7",
247
+ "note": "Seen in commit search results, not confirmed as the tool's default; only the address counts."
248
+ },
249
+ {
250
+ "name": "Antigravity",
251
+ "pattern": "antigravity@google\\.com",
252
+ "example": "Co-authored-by: Antigravity <antigravity@google.com>",
253
+ "evidence": "assumed",
254
+ "source": "https://github.com/vorlie/kioku/commit/ba1b2dfeece54f415fe3e8cdb3407741af688698",
255
+ "note": "Read in one public commit, which may have been written by hand."
91
256
  }
92
257
  ],
93
258
  "patterns": [
@@ -115,6 +280,36 @@
115
280
  "id": "robot-generated",
116
281
  "what": "The robot-emoji form, `🤖 Generated ...`, which some tools write without naming themselves on the same line.",
117
282
  "regex": "🤖\\s*Generated"
283
+ },
284
+ {
285
+ "id": "assisted-by",
286
+ "what": "An `Assisted-by:` trailer naming one of the tools above. The trailer several projects' AI policies ask for (LLVM, OpenStack, OpenInfra, OpenSSL).",
287
+ "regex": "(?:^|\\n)[ \\t]*Assisted-by:[^\\n]*?(?:{{tools}})"
288
+ },
289
+ {
290
+ "id": "assisted-by-agent-model",
291
+ "what": "An `Assisted-by:` trailer in the `AGENT:MODEL` form (`Assisted-by: my-agent:my-model-v1`), whatever the agent is called. That form is what the Linux kernel's 7.0 and 7.1 documentation and OpenSSL's policy specify, and a person's name is not written that way. A link (`https://...`) is not an agent.",
292
+ "regex": "(?:^|\\n)[ \\t]*Assisted-by:[ \\t]*[^\\s:<]+:(?!//)[^\\s<]+"
293
+ },
294
+ {
295
+ "id": "generated-by",
296
+ "what": "A `Generated-by:` trailer naming one of the tools above (the Apache Software Foundation's and OpenStack's form).",
297
+ "regex": "(?:^|\\n)[ \\t]*Generated-by:[^\\n]*?(?:{{tools}})"
298
+ },
299
+ {
300
+ "id": "ai-assisted-true",
301
+ "what": "The line `AI-assisted: true` (or `yes`), which some projects write beside a co-author line. `AI-Assisted: none` is the opposite statement and never matches.",
302
+ "regex": "(?:^|\\n)[ \\t]*AI-assisted:[ \\t]*(?:true|yes)\\b"
303
+ },
304
+ {
305
+ "id": "replit-commit-author",
306
+ "what": "The `Replit-Commit-Author: Agent` trailer Replit writes on commits its agent makes.",
307
+ "regex": "(?:^|\\n)[ \\t]*Replit-Commit-Author:[ \\t]*Agent\\b"
308
+ },
309
+ {
310
+ "id": "crush-generated",
311
+ "what": "The `Generated with Crush` line Crush writes above its `Assisted-by:` trailer.",
312
+ "regex": "💘\\s*Generated\\s+with\\s+Crush\\b"
118
313
  }
119
314
  ]
120
315
  }
package/src/index.js CHANGED
@@ -33,10 +33,8 @@ const readJson = (name) => JSON.parse(fs.readFileSync(path.join(__dirname, name)
33
33
  // this now. package.json sits one level up from src/, inside the tarball.
34
34
  const SERVER_VERSION = readJson('../package.json').version;
35
35
 
36
- // Protocol revisions this server understands. The client's own revision is
37
- // echoed back when it appears here; otherwise the newest is offered and the
38
- // client decides whether it can proceed.
39
- const SUPPORTED_PROTOCOLS = ['2025-06-18', '2025-03-26', '2024-11-05'];
36
+ // Protocol revisions this server understands, newest first, read further
37
+ // down from mcp-spec.json (SUPPORTED_PROTOCOLS and STATELESS_PROTOCOLS).
40
38
  const HTTP_TIMEOUT_MS = 15000;
41
39
 
42
40
  const log = (...a) => process.stderr.write(a.join(' ') + '\n');
@@ -51,6 +49,24 @@ const log = (...a) => process.stderr.write(a.join(' ') + '\n');
51
49
  * ceiling.
52
50
  */
53
51
  const ASSURANCE_SPEC = readJson('assurance.json');
52
+ // The tools and the fixed sentences this server returns (see TOOLS below).
53
+ const SPEC = readJson('mcp-spec.json');
54
+
55
+ // Two eras of the protocol, both spoken here:
56
+ // handshake the client sends `initialize` first; its revision is echoed
57
+ // when it is known, otherwise the newest is offered.
58
+ // stateless (2026-07-28) no handshake. Every request names its revision
59
+ // and the client's capabilities in `params._meta`, every result
60
+ // says `resultType`, and `server/discover` answers what the
61
+ // handshake used to.
62
+ // A request carrying the stateless `_meta` is served that way; anything else
63
+ // is served as before.
64
+ const SUPPORTED_PROTOCOLS = SPEC.protocols.handshake;
65
+ const STATELESS_PROTOCOLS = SPEC.protocols.stateless;
66
+ const META_VERSION = 'io.modelcontextprotocol/protocolVersion';
67
+ const META_CLIENT_CAPABILITIES = 'io.modelcontextprotocol/clientCapabilities';
68
+ const META_SERVER_INFO = 'io.modelcontextprotocol/serverInfo';
69
+ const LIST_TTL_MS = 3600000;
54
70
  const ASSURANCE = ASSURANCE_SPEC.levels;
55
71
 
56
72
  /**
@@ -62,94 +78,27 @@ const ASSURANCE = ASSURANCE_SPEC.levels;
62
78
  */
63
79
  const AI_TRAILERS = readJson('ai-trailers.json');
64
80
  const AI_DECLARATION = {
65
- reads: 'Commit messages only: a Co-authored-by trailer naming one of the tools below, a '
66
- + 'Claude-Session or Amp-Thread-ID trailer, or a "Generated with" line.',
81
+ reads: SPEC.ai_declaration.reads,
67
82
  tools: AI_TRAILERS.tools.map((t) => t.name),
68
- zero_means: 'No commit message declared a tool. It does not mean no tool was used; a '
69
- + 'message with no trailer looks the same either way.',
70
- declared_means: 'The author chose to say so. It is reported as a fact and never lowers a result.',
83
+ zero_means: SPEC.ai_declaration.zero_means,
84
+ declared_means: SPEC.ai_declaration.declared_means,
71
85
  };
72
86
 
73
- const CREDENTIAL_TYPES = {
74
- REWORKWorkflowAttestation: 'A CI run whose repository identity GitHub attested via OIDC.',
75
- REWORKHfJoinedPublication: 'A Hugging Face publication joined to the CI run that preceded it, confirmed by REWORK\'s own read of the Hub.',
76
- REWORKProofOfWorkCredential: 'A submitted piece of work that passed REWORK verification.',
77
- REWORKVideoProvenanceReceipt: 'A reviewed demonstration video, fingerprinted against reuse.',
78
- REWORKReputationPassport: "A holder's full verified history in one signed credential.",
79
- REWORKReputationSummary: 'A summary of already-public verified facts about a holder.',
80
- };
87
+ const CREDENTIAL_TYPES = SPEC.credential_types;
81
88
 
82
89
  // ── tools ──────────────────────────────────────────────────────────────────
83
90
 
84
- const TOOLS = [
85
- {
86
- name: 'verify_rework_credential',
87
- description:
88
- 'Check whether a REWORK Verifiable Credential (a VC-JWT) is authentic, and '
89
- + 'report what it claims. Use this when someone presents a credential as '
90
- + 'evidence that they produced a piece of work. Returns whether the signature '
91
- + 'is valid, who issued it, and the credential subject.',
92
- inputSchema: {
93
- type: 'object',
94
- properties: {
95
- credential: {
96
- type: 'string',
97
- description: 'The compact VC-JWT, three base64url segments separated by dots.',
98
- },
99
- },
100
- required: ['credential'],
101
- additionalProperties: false,
102
- },
103
- },
104
- {
105
- name: 'get_rework_issuer_keys',
106
- description:
107
- "Fetch REWORK's public signing keys (JWKS). Use this to verify a credential "
108
- + 'offline yourself instead of trusting this server, or to confirm the issuer '
109
- + 'key a credential names actually belongs to REWORK.',
110
- inputSchema: { type: 'object', properties: {}, additionalProperties: false },
111
- },
112
- {
113
- name: 'explain_rework_assurance',
114
- description:
115
- 'Explain what a REWORK assurance level or credential type proves, and what it '
116
- + 'explicitly does not prove. Use this before relying on a credential, so a '
117
- + 'weak claim is not read as a strong one.',
118
- inputSchema: {
119
- type: 'object',
120
- properties: {
121
- assurance: {
122
- type: 'string',
123
- description: 'Assurance level, e.g. "workflow-identity". Omit to list all.',
124
- },
125
- },
126
- additionalProperties: false,
127
- },
128
- },
129
- {
130
- name: 'lookup_rework_attestation',
131
- description:
132
- 'Check whether REWORK actually ISSUED a credential - not just whether its '
133
- + 'signature verifies. A forged-but-well-formed token fails this; a real one '
134
- + 'returns its issuance record and the CURRENT OpenTimestamps receipt, which '
135
- + 'may have been upgraded to a Bitcoin confirmation since issue. Pass the '
136
- + 'credential (its sha256 is the lookup key) or the digest directly.',
137
- inputSchema: {
138
- type: 'object',
139
- properties: {
140
- credential: {
141
- type: 'string',
142
- description: 'The VC-JWT. Hashed locally; never sent anywhere.',
143
- },
144
- digest: {
145
- type: 'string',
146
- description: 'sha256 hex of the credential, if you already have it.',
147
- },
148
- },
149
- additionalProperties: false,
150
- },
151
- },
152
- ];
91
+ /**
92
+ * The tools, from `mcp-spec.json`: one definition for this server and for the
93
+ * hosted one REWORK runs (the Claude directory lists a server by URL, and it
94
+ * requires each tool to carry a title and a read-only or destructive hint).
95
+ * Every tool here only reads, so each carries readOnlyHint.
96
+ */
97
+ const TOOLS = SPEC.tools.map((t) => JSON.parse(JSON.stringify(t)));
98
+ // Here the lookup hashes the credential in this process, which is a stronger
99
+ // promise than the shared wording makes, so this server says so.
100
+ TOOLS.find((t) => t.name === 'lookup_rework_attestation').inputSchema.properties.credential.description =
101
+ 'The VC-JWT. Hashed locally; never sent anywhere.';
153
102
 
154
103
  async function http(path, { method = 'GET', body } = {}) {
155
104
  const ctl = new AbortController();
@@ -174,23 +123,31 @@ async function http(path, { method = 'GET', body } = {}) {
174
123
  async function callTool(name, args) {
175
124
  if (name === 'verify_rework_credential') {
176
125
  const credential = (args && args.credential) || '';
177
- if (!credential.trim()) throw new Error('credential is required');
126
+ if (!credential.trim()) throw new Error(SPEC.errors.credential_required);
178
127
  const res = await http('/proofs/credentials/verify', {
179
128
  method: 'POST',
180
129
  body: { credential },
181
130
  });
182
131
  const subject = res.credential_subject || {};
183
132
  const assurance = subject.assurance;
133
+ // The API checks the signature, the expiry, and whether REWORK has since
134
+ // revoked the credential. `revoked` is true, false, or null (nothing to
135
+ // check, or it could not be read); a server that predates the check
136
+ // sends nothing, which is null too.
137
+ const revoked = typeof res.revoked === 'boolean' ? res.revoked : null;
138
+ let note;
139
+ if (revoked === true) note = SPEC.notes.revoked;
140
+ else if (assurance && ASSURANCE[assurance]) note = ASSURANCE[assurance].does_not_mean;
141
+ else note = SPEC.notes.unknown_assurance;
184
142
  return {
185
143
  valid: res.valid === true,
186
144
  reason: res.reason || null,
145
+ revoked,
187
146
  issuer: res.issuer || null,
188
147
  credential_subject: subject,
189
148
  // An agent that only reads `valid` would treat every credential as
190
149
  // equally strong. Ship the ceiling alongside the verdict.
191
- assurance_note: assurance && ASSURANCE[assurance]
192
- ? ASSURANCE[assurance].does_not_mean
193
- : 'Assurance level not recognised — do not assume this proves more than it states.',
150
+ assurance_note: note,
194
151
  };
195
152
  }
196
153
 
@@ -222,28 +179,21 @@ async function callTool(name, args) {
222
179
  digest = crypto.createHash('sha256').update(args.credential, 'utf8').digest('hex');
223
180
  }
224
181
  if (!digest || !/^[0-9a-f]{64}$/.test(String(digest).toLowerCase())) {
225
- throw new Error('pass either `credential` (the VC-JWT) or `digest` (64 hex chars)');
182
+ throw new Error(SPEC.errors.digest_required);
226
183
  }
227
184
  digest = String(digest).toLowerCase();
228
185
  try {
229
186
  const record = await http(`/github-app/attestations/${digest}`);
230
187
  return {
231
188
  ...record,
232
- assurance_note:
233
- 'Issuance confirms REWORK signed a credential with this digest. It is '
234
- + 'still not a review of the code or a claim the work is any good - '
235
- + 'and a "submitted" timestamp is a calendar promise, only "confirmed" '
236
- + 'means anchored in Bitcoin.',
189
+ assurance_note: SPEC.notes.issued,
237
190
  };
238
191
  } catch (err) {
239
192
  if (String(err.message).includes('REWORK API 404')) {
240
193
  return {
241
194
  issued: false,
242
195
  digest_sha256: digest,
243
- assurance_note:
244
- 'REWORK has no record of issuing a credential with this digest. A '
245
- + 'valid signature with no issuance record deserves suspicion: it '
246
- + 'could predate the registry, or it could be a key compromise.',
196
+ assurance_note: SPEC.notes.not_issued,
247
197
  };
248
198
  }
249
199
  throw err;
@@ -260,11 +210,79 @@ function send(msg) {
260
210
  }
261
211
 
262
212
  function result(id, value) { send({ jsonrpc: '2.0', id, result: value }); }
263
- function failure(id, code, message) { send({ jsonrpc: '2.0', id, error: { code, message } }); }
213
+ function failure(id, code, message, data) {
214
+ const error = data === undefined ? { code, message } : { code, message, data };
215
+ send({ jsonrpc: '2.0', id, error });
216
+ }
217
+
218
+ const serverInfo = () => ({
219
+ name: SPEC.server.name, title: SPEC.server.title, version: SERVER_VERSION, description: SPEC.server.description,
220
+ });
221
+
222
+ const TOOL_NAMES = new Set(TOOLS.map((t) => t.name));
223
+
224
+ /** A request of the stateless era: answered whole, with no handshake before it. */
225
+ async function handleStateless(msg, meta) {
226
+ const { id, method, params } = msg;
227
+ if (id === undefined || id === null) return undefined;
228
+ const requested = meta[META_VERSION];
229
+ if (!STATELESS_PROTOCOLS.includes(requested)) {
230
+ return failure(id, -32022, 'Unsupported protocol version',
231
+ { supported: [...STATELESS_PROTOCOLS, ...SUPPORTED_PROTOCOLS], requested });
232
+ }
233
+ const caps = meta[META_CLIENT_CAPABILITIES];
234
+ if (!caps || typeof caps !== 'object' || Array.isArray(caps)) {
235
+ return failure(id, -32602, `Invalid params: params._meta must carry ${META_CLIENT_CAPABILITIES} (an object, which may be empty)`);
236
+ }
237
+ if (method === 'server/discover') {
238
+ return result(id, {
239
+ resultType: 'complete',
240
+ supportedVersions: [...STATELESS_PROTOCOLS, ...SUPPORTED_PROTOCOLS],
241
+ capabilities: { tools: {} },
242
+ instructions: SPEC.server.instructions,
243
+ ttlMs: LIST_TTL_MS,
244
+ cacheScope: 'public',
245
+ _meta: { [META_SERVER_INFO]: serverInfo() },
246
+ });
247
+ }
248
+ if (method === 'tools/list') {
249
+ return result(id, { resultType: 'complete', tools: TOOLS, ttlMs: LIST_TTL_MS, cacheScope: 'public' });
250
+ }
251
+ if (method === 'tools/call') {
252
+ const name = params && params.name;
253
+ const args = params && params.arguments;
254
+ // No such tool, or arguments that are not an object: the request is
255
+ // malformed, a protocol error. What is wrong inside the arguments is the
256
+ // tool's to report, as a result the model can read.
257
+ if (typeof name !== 'string' || !TOOL_NAMES.has(name)) return failure(id, -32602, `Unknown tool: ${name}`);
258
+ if (args !== undefined && args !== null && (typeof args !== 'object' || Array.isArray(args))) {
259
+ return failure(id, -32602, 'Invalid params: arguments must be an object');
260
+ }
261
+ try {
262
+ const out = await callTool(name, args || {});
263
+ return result(id, {
264
+ resultType: 'complete',
265
+ content: [{ type: 'text', text: JSON.stringify(out, null, 2) }],
266
+ structuredContent: out,
267
+ isError: false,
268
+ });
269
+ } catch (err) {
270
+ return result(id, {
271
+ resultType: 'complete',
272
+ content: [{ type: 'text', text: `Tool ${name} failed: ${err.message}` }],
273
+ isError: true,
274
+ });
275
+ }
276
+ }
277
+ return failure(id, -32601, `Method not found: ${method}`);
278
+ }
264
279
 
265
280
  async function handle(msg) {
266
281
  const { id, method, params } = msg;
267
282
 
283
+ const meta = params && params._meta && typeof params._meta === 'object' ? params._meta : null;
284
+ if (meta && META_VERSION in meta) return handleStateless(msg, meta);
285
+
268
286
  // A notification has no id and must never be answered - replying to one is
269
287
  // a protocol violation the client reports as an unsolicited response.
270
288
  const isNotification = id === undefined || id === null;
@@ -274,7 +292,8 @@ async function handle(msg) {
274
292
  return result(id, {
275
293
  protocolVersion: SUPPORTED_PROTOCOLS.includes(asked) ? asked : SUPPORTED_PROTOCOLS[0],
276
294
  capabilities: { tools: { listChanged: false } },
277
- serverInfo: { name: 'rework-proof', version: SERVER_VERSION },
295
+ serverInfo: serverInfo(),
296
+ instructions: SPEC.server.instructions,
278
297
  });
279
298
  }
280
299
 
@@ -289,8 +308,12 @@ async function handle(msg) {
289
308
  const name = params && params.name;
290
309
  try {
291
310
  const out = await callTool(name, (params && params.arguments) || {});
311
+ // The same answer twice: as data a client can read field by field
312
+ // (each tool declares its outputSchema), and as text for a client that
313
+ // only reads text.
292
314
  return result(id, {
293
315
  content: [{ type: 'text', text: JSON.stringify(out, null, 2) }],
316
+ structuredContent: out,
294
317
  isError: false,
295
318
  });
296
319
  } catch (err) {
@@ -308,6 +331,7 @@ async function handle(msg) {
308
331
  }
309
332
 
310
333
  let buffer = '';
334
+ const inFlight = new Set();
311
335
  process.stdin.setEncoding('utf8');
312
336
  process.stdin.on('data', (chunk) => {
313
337
  buffer += chunk;
@@ -323,14 +347,21 @@ process.stdin.on('data', (chunk) => {
323
347
  log(`dropping unparseable frame: ${err.message}`);
324
348
  continue;
325
349
  }
326
- Promise.resolve(handle(msg)).catch((err) => {
350
+ const work = Promise.resolve(handle(msg)).catch((err) => {
327
351
  log(`handler error: ${err.stack || err.message}`);
328
352
  if (msg && msg.id !== undefined && msg.id !== null) {
329
353
  failure(msg.id, -32603, `Internal error: ${err.message}`);
330
354
  }
331
355
  });
356
+ inFlight.add(work);
357
+ work.finally(() => inFlight.delete(work));
332
358
  }
333
359
  });
334
360
 
335
- process.stdin.on('end', () => process.exit(0));
361
+ // When the client closes its end, answer what it already asked before
362
+ // leaving. Exiting at once dropped any tool call still waiting on the
363
+ // network, so a client that sent a call and then closed got no answer.
364
+ process.stdin.on('end', () => {
365
+ Promise.allSettled([...inFlight]).then(() => process.exit(0));
366
+ });
336
367
  log(`rework-proof MCP server ready (api=${API})`);
@@ -0,0 +1,242 @@
1
+ {
2
+ "_comment": "The REWORK Proof MCP server's tools and the fixed sentences it returns, in one file. Two servers read it: this package (stdio, index.js beside this file) and the hosted server REWORK runs at https://api.reworkdigital.io/mcp, so neither can describe a tool, or the ceiling on a claim, differently from the other. Every tool only reads: readOnlyHint is true on all of them.",
3
+ "server": {
4
+ "name": "rework-proof",
5
+ "title": "REWORK Proof",
6
+ "description": "Check whether delivered work is genuinely the author's: verify a REWORK credential, see whether it was revoked or ever issued, and read what it does and does not prove.",
7
+ "instructions": "Read `assurance_note` with every result: it states the ceiling on what the result proves. A valid signature is not a review of the work."
8
+ },
9
+ "protocols": {
10
+ "_comment": "Revisions of the Model Context Protocol this server speaks, newest first. `handshake` revisions begin with `initialize`. `stateless` revisions have no handshake: every request names its revision in `params._meta`.",
11
+ "handshake": [
12
+ "2025-11-25",
13
+ "2025-06-18",
14
+ "2025-03-26",
15
+ "2024-11-05"
16
+ ],
17
+ "stateless": [
18
+ "2026-07-28"
19
+ ]
20
+ },
21
+ "tools": [
22
+ {
23
+ "name": "verify_rework_credential",
24
+ "title": "Verify a REWORK credential",
25
+ "description": "Check whether a REWORK Verifiable Credential (a VC-JWT) is authentic, and report what it claims. Use this when someone presents a credential as evidence that they produced a piece of work. Returns whether the signature is valid, whether REWORK has since revoked it, who issued it, and the credential subject.",
26
+ "inputSchema": {
27
+ "type": "object",
28
+ "properties": {
29
+ "credential": {
30
+ "type": "string",
31
+ "description": "The compact VC-JWT, three base64url segments separated by dots."
32
+ }
33
+ },
34
+ "required": [
35
+ "credential"
36
+ ],
37
+ "additionalProperties": false
38
+ },
39
+ "outputSchema": {
40
+ "type": "object",
41
+ "properties": {
42
+ "valid": {
43
+ "type": "boolean",
44
+ "description": "True only when the signature verifies against REWORK's key, the credential has not expired, and REWORK has not revoked it."
45
+ },
46
+ "reason": {
47
+ "type": [
48
+ "string",
49
+ "null"
50
+ ],
51
+ "description": "Why the credential is not valid; null when it is."
52
+ },
53
+ "revoked": {
54
+ "type": [
55
+ "boolean",
56
+ "null"
57
+ ],
58
+ "description": "True when REWORK revoked the credential after issuing it; false when it was checked and stands; null when there is nothing to check (not a certificate credential, or not valid) or the status could not be read."
59
+ },
60
+ "issuer": {
61
+ "description": "Who issued the credential, as the credential states it; null when it is not valid."
62
+ },
63
+ "credential_subject": {
64
+ "type": "object",
65
+ "description": "What the credential claims. Empty when it is not valid."
66
+ },
67
+ "assurance_note": {
68
+ "type": "string",
69
+ "description": "The ceiling on what this result proves. Read it before relying on the result."
70
+ }
71
+ },
72
+ "required": [
73
+ "valid",
74
+ "reason",
75
+ "revoked",
76
+ "credential_subject",
77
+ "assurance_note"
78
+ ]
79
+ },
80
+ "annotations": {
81
+ "title": "Verify a REWORK credential",
82
+ "readOnlyHint": true,
83
+ "destructiveHint": false,
84
+ "idempotentHint": true,
85
+ "openWorldHint": true
86
+ }
87
+ },
88
+ {
89
+ "name": "get_rework_issuer_keys",
90
+ "title": "Get REWORK's public signing keys",
91
+ "description": "Fetch REWORK's public signing keys (JWKS). Use this to verify a credential offline yourself instead of trusting this server, or to confirm the issuer key a credential names actually belongs to REWORK.",
92
+ "inputSchema": {
93
+ "type": "object",
94
+ "properties": {},
95
+ "additionalProperties": false
96
+ },
97
+ "outputSchema": {
98
+ "type": "object",
99
+ "properties": {
100
+ "keys": {
101
+ "type": "array",
102
+ "items": {
103
+ "type": "object"
104
+ },
105
+ "description": "REWORK's public signing keys, as a JSON Web Key Set."
106
+ }
107
+ },
108
+ "required": [
109
+ "keys"
110
+ ]
111
+ },
112
+ "annotations": {
113
+ "title": "Get REWORK's public signing keys",
114
+ "readOnlyHint": true,
115
+ "destructiveHint": false,
116
+ "idempotentHint": true,
117
+ "openWorldHint": true
118
+ }
119
+ },
120
+ {
121
+ "name": "explain_rework_assurance",
122
+ "title": "Explain a REWORK assurance level",
123
+ "description": "Explain what a REWORK assurance level or credential type proves, and what it explicitly does not prove. Use this before relying on a credential, so a weak claim is not read as a strong one.",
124
+ "inputSchema": {
125
+ "type": "object",
126
+ "properties": {
127
+ "assurance": {
128
+ "type": "string",
129
+ "description": "Assurance level, e.g. \"workflow-identity\". Omit to list all."
130
+ }
131
+ },
132
+ "additionalProperties": false
133
+ },
134
+ "outputSchema": {
135
+ "type": "object",
136
+ "description": "One level when `assurance` was given, every level otherwise, or `error` with the known levels when the level asked for does not exist.",
137
+ "properties": {
138
+ "assurance": {
139
+ "type": "string"
140
+ },
141
+ "assurance_levels": {
142
+ "type": "object"
143
+ },
144
+ "what_the_check_reads": {},
145
+ "ai_declaration": {
146
+ "type": "object"
147
+ },
148
+ "credential_types": {
149
+ "type": "object"
150
+ },
151
+ "error": {
152
+ "type": "string"
153
+ },
154
+ "known": {
155
+ "type": "array",
156
+ "items": {
157
+ "type": "string"
158
+ }
159
+ }
160
+ }
161
+ },
162
+ "annotations": {
163
+ "title": "Explain a REWORK assurance level",
164
+ "readOnlyHint": true,
165
+ "destructiveHint": false,
166
+ "idempotentHint": true,
167
+ "openWorldHint": true
168
+ }
169
+ },
170
+ {
171
+ "name": "lookup_rework_attestation",
172
+ "title": "Look up whether REWORK issued a credential",
173
+ "description": "Check whether REWORK actually ISSUED a credential - not just whether its signature verifies. A forged-but-well-formed token fails this; a real one returns its issuance record and the CURRENT OpenTimestamps receipt, which may have been upgraded to a Bitcoin confirmation since issue. Pass the credential (its sha256 is the lookup key) or the digest directly.",
174
+ "inputSchema": {
175
+ "type": "object",
176
+ "properties": {
177
+ "credential": {
178
+ "type": "string",
179
+ "description": "The VC-JWT. Only its sha256 digest is used as the lookup key; the credential itself is not stored."
180
+ },
181
+ "digest": {
182
+ "type": "string",
183
+ "description": "sha256 hex of the credential, if you already have it."
184
+ }
185
+ },
186
+ "additionalProperties": false
187
+ },
188
+ "outputSchema": {
189
+ "type": "object",
190
+ "properties": {
191
+ "issued": {
192
+ "type": "boolean",
193
+ "description": "Whether REWORK has a record of issuing a credential with this digest."
194
+ },
195
+ "digest_sha256": {
196
+ "type": "string"
197
+ },
198
+ "assurance_note": {
199
+ "type": "string",
200
+ "description": "The ceiling on what this result proves. Read it before relying on the result."
201
+ }
202
+ },
203
+ "required": [
204
+ "issued",
205
+ "digest_sha256",
206
+ "assurance_note"
207
+ ]
208
+ },
209
+ "annotations": {
210
+ "title": "Look up whether REWORK issued a credential",
211
+ "readOnlyHint": true,
212
+ "destructiveHint": false,
213
+ "idempotentHint": true,
214
+ "openWorldHint": true
215
+ }
216
+ }
217
+ ],
218
+ "credential_types": {
219
+ "REWORKWorkflowAttestation": "A CI run whose repository identity GitHub attested via OIDC.",
220
+ "REWORKHfJoinedPublication": "A Hugging Face publication joined to the CI run that preceded it, confirmed by REWORK's own read of the Hub.",
221
+ "REWORKProofOfWorkCredential": "A submitted piece of work that passed REWORK verification.",
222
+ "REWORKVideoProvenanceReceipt": "A reviewed demonstration video, fingerprinted against reuse.",
223
+ "REWORKReputationPassport": "A holder's full verified history in one signed credential.",
224
+ "REWORKReputationSummary": "A summary of already-public verified facts about a holder."
225
+ },
226
+ "ai_declaration": {
227
+ "reads": "Commit messages only: a Co-authored-by, Assisted-by or Generated-by trailer naming one of the tools below; an Assisted-by trailer in the AGENT:MODEL form; a Claude-Session, Amp-Thread-ID or Replit-Commit-Author trailer; an `AI-assisted: true` line; or a \"Generated with\" line.",
228
+ "zero_means": "No commit message declared a tool. It does not mean no tool was used; a message with no trailer looks the same either way.",
229
+ "declared_means": "The author chose to say so. It is reported as a fact and never lowers a result."
230
+ },
231
+ "notes": {
232
+ "unknown_assurance": "Assurance level not recognised - do not assume this proves more than it states.",
233
+ "issued": "Issuance confirms REWORK signed a credential with this digest. It is still not a review of the code or a claim the work is any good - and a \"submitted\" timestamp is a calendar promise, only \"confirmed\" means anchored in Bitcoin.",
234
+ "not_issued": "REWORK has no record of issuing a credential with this digest. A valid signature with no issuance record deserves suspicion: it could predate the registry, or it could be a key compromise.",
235
+ "revoked": "REWORK revoked this credential after issuing it. Its signature still verifies, which is exactly why revocation has to be checked: do not rely on it.",
236
+ "revocation_unchecked": "Whether this credential has since been revoked could not be checked just now. The signature is valid; treat the result as incomplete."
237
+ },
238
+ "errors": {
239
+ "credential_required": "credential is required: pass the compact VC-JWT (three base64url segments separated by dots)",
240
+ "digest_required": "pass either `credential` (the VC-JWT) or `digest` (64 hex chars)"
241
+ }
242
+ }