@reworkdigital.io/rework-proof-mcp 1.0.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -0
  3. package/package.json +32 -0
  4. package/src/index.js +260 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 REWORK Digital
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # REWORK Proof — MCP server
2
+
3
+ Lets an AI agent answer *"is this delivered work genuinely theirs?"* without
4
+ taking anyone's word for it.
5
+
6
+ Point it at a REWORK Verifiable Credential and it reports whether the
7
+ signature holds, who issued it, what it claims — and, deliberately, what it
8
+ does **not** claim.
9
+
10
+ ## Install
11
+
12
+ ```json
13
+ {
14
+ "mcpServers": {
15
+ "rework-proof": {
16
+ "command": "npx",
17
+ "args": ["-y", "@reworkdigital.io/rework-proof-mcp"]
18
+ }
19
+ }
20
+ }
21
+ ```
22
+
23
+ No API key. No account. Every tool here reads public endpoints.
24
+
25
+ ## Tools
26
+
27
+ | Tool | What it does |
28
+ |---|---|
29
+ | `verify_rework_credential` | Checks a VC-JWT's signature and returns the issuer, the subject, and the ceiling on what the credential proves. |
30
+ | `get_rework_issuer_keys` | Fetches REWORK's public JWKS so you can verify offline yourself instead of trusting this server. |
31
+ | `explain_rework_assurance` | Explains what an assurance level proves and what it explicitly does not. |
32
+
33
+ ### Why the verdict ships with a caveat
34
+
35
+ `verify_rework_credential` returns an `assurance_note` alongside `valid`.
36
+
37
+ An agent that reads only `valid: true` will treat every credential as equally
38
+ strong, and they are not. A `workflow-identity` attestation says GitHub
39
+ vouched for who wrote the commits — it says nothing about whether the code
40
+ works or is any good. Returning the verdict without its ceiling would invite
41
+ exactly that misreading, so the ceiling travels with it.
42
+
43
+ ## Zero dependencies, on purpose
44
+
45
+ The whole server is one file: [`src/index.js`](src/index.js). MCP's stdio
46
+ transport is newline-delimited JSON-RPC 2.0, which is small enough to
47
+ implement outright.
48
+
49
+ A tool whose entire job is verifying authenticity has no business asking you
50
+ to trust ninety transitive packages first. The supply chain is part of the
51
+ claim. Node 20's built-in `fetch` covers the rest.
52
+
53
+ ## Configuration
54
+
55
+ | Variable | Default | Purpose |
56
+ |---|---|---|
57
+ | `REWORK_API_URL` | `https://api.reworkdigital.io/api/v1` | Override for self-hosted REWORK. |
58
+
59
+ ## Verifying without this server
60
+
61
+ Credentials are signed with Ed25519 and REWORK's public key is published at
62
+ `https://api.reworkdigital.io/api/v1/proofs/credentials/jwks.json`. Any JOSE
63
+ library verifies one offline, with no call to REWORK and no dependency on us
64
+ continuing to exist. That is the point of issuing them this way — this server
65
+ is a convenience, not an authority.
66
+
67
+ ## Related
68
+
69
+ - [REWORK Proof Check](https://github.com/Reworkdigital-io/REWORK-Proof) — the
70
+ GitHub Action that produces these attestations from a CI run.
71
+ - [REWORK Proof App](https://github.com/apps/rework-proof) — the same
72
+ verification posted automatically as a check run on every pull request.
73
+
74
+ ## Licence
75
+
76
+ MIT — see [LICENSE](LICENSE).
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@reworkdigital.io/rework-proof-mcp",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for verifying REWORK credentials — check whether delivered work is genuinely the author's.",
5
+ "license": "MIT",
6
+ "type": "commonjs",
7
+ "bin": {
8
+ "rework-proof-mcp": "src/index.js"
9
+ },
10
+ "main": "src/index.js",
11
+ "files": [
12
+ "src",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "engines": {
17
+ "node": ">=20"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/Reworkdigital-io/REWORK-Proof.git",
22
+ "directory": "mcp"
23
+ },
24
+ "homepage": "https://reworkdigital.io/proofs",
25
+ "keywords": [
26
+ "mcp",
27
+ "modelcontextprotocol",
28
+ "verifiable-credentials",
29
+ "provenance",
30
+ "code-authorship"
31
+ ]
32
+ }
package/src/index.js ADDED
@@ -0,0 +1,260 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * REWORK Proof — an MCP server for checking whether delivered work is genuine.
4
+ *
5
+ * The audience is an AI agent that has been handed a pull request, a
6
+ * contractor's portfolio, or a credential, and needs to answer "is this
7
+ * actually theirs?" without taking anyone's word for it.
8
+ *
9
+ * ZERO DEPENDENCIES, DELIBERATELY. MCP's stdio transport is newline-delimited
10
+ * JSON-RPC 2.0, which is small enough to implement outright. A tool whose
11
+ * entire purpose is verifying authenticity has no business asking you to
12
+ * trust ninety transitive packages first - the supply chain is part of the
13
+ * claim. Node 20's global fetch covers the rest.
14
+ *
15
+ * THE ONE RULE OF STDIO TRANSPORT: stdout carries protocol frames and nothing
16
+ * else. A stray console.log corrupts the stream and the client disconnects
17
+ * with an unhelpful parse error, so every diagnostic here goes to stderr.
18
+ */
19
+
20
+ 'use strict';
21
+
22
+ const API = (process.env.REWORK_API_URL || 'https://api.reworkdigital.io/api/v1').replace(/\/$/, '');
23
+ const SERVER_VERSION = '1.0.0';
24
+
25
+ // Protocol revisions this server understands. We echo the client's if we know
26
+ // it, otherwise answer with our newest and let the client decide.
27
+ const SUPPORTED_PROTOCOLS = ['2025-06-18', '2025-03-26', '2024-11-05'];
28
+ const HTTP_TIMEOUT_MS = 15000;
29
+
30
+ const log = (...a) => process.stderr.write(a.join(' ') + '\n');
31
+
32
+ /**
33
+ * What REWORK's assurance levels mean, and — more importantly — what they do
34
+ * not. Held locally rather than fetched: an agent asking "how much does this
35
+ * prove?" should get the same answer when the API is unreachable, and the
36
+ * honest ceiling on a claim is not something to look up over the network.
37
+ */
38
+ const ASSURANCE = {
39
+ 'workflow-identity': {
40
+ means:
41
+ 'GitHub cryptographically vouched that a specific workflow run belongs to a '
42
+ + 'specific repository and commit, and REWORK recorded the authorship signals '
43
+ + 'that run observed (commit signature state, whether commits resolve to the '
44
+ + 'PR author, disclosed AI assistance).',
45
+ does_not_mean:
46
+ 'Nobody reviewed the code, ran it, or judged its quality. It does not say the '
47
+ + 'work is good, only who the git history says wrote it.',
48
+ strength: 'moderate — strong on identity, silent on quality',
49
+ },
50
+ 'reviewed-reference': {
51
+ means:
52
+ 'A REWORK reviewer watched a demonstration video and confirmed it corresponds '
53
+ + 'to the claimed work, and the video is fingerprinted so reuse is detectable.',
54
+ does_not_mean:
55
+ 'The reviewer did not audit the source, reproduce the result, or verify claims '
56
+ + 'made verbally in the video.',
57
+ strength: 'moderate — human-checked, but of a demonstration rather than the artefact',
58
+ },
59
+ };
60
+
61
+ const CREDENTIAL_TYPES = {
62
+ REWORKWorkflowAttestation: 'A CI run whose repository identity GitHub attested via OIDC.',
63
+ REWORKProofOfWorkCredential: 'A submitted piece of work that passed REWORK verification.',
64
+ REWORKVideoProvenanceReceipt: 'A reviewed demonstration video, fingerprinted against reuse.',
65
+ REWORKReputationPassport: "A holder's full verified history in one signed credential.",
66
+ REWORKReputationSummary: 'A summary of already-public verified facts about a holder.',
67
+ };
68
+
69
+ // ── tools ──────────────────────────────────────────────────────────────────
70
+
71
+ const TOOLS = [
72
+ {
73
+ name: 'verify_rework_credential',
74
+ description:
75
+ 'Check whether a REWORK Verifiable Credential (a VC-JWT) is authentic, and '
76
+ + 'report what it claims. Use this when someone presents a credential as '
77
+ + 'evidence that they produced a piece of work. Returns whether the signature '
78
+ + 'is valid, who issued it, and the credential subject.',
79
+ inputSchema: {
80
+ type: 'object',
81
+ properties: {
82
+ credential: {
83
+ type: 'string',
84
+ description: 'The compact VC-JWT, three base64url segments separated by dots.',
85
+ },
86
+ },
87
+ required: ['credential'],
88
+ additionalProperties: false,
89
+ },
90
+ },
91
+ {
92
+ name: 'get_rework_issuer_keys',
93
+ description:
94
+ "Fetch REWORK's public signing keys (JWKS). Use this to verify a credential "
95
+ + 'offline yourself instead of trusting this server, or to confirm the issuer '
96
+ + 'key a credential names actually belongs to REWORK.',
97
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
98
+ },
99
+ {
100
+ name: 'explain_rework_assurance',
101
+ description:
102
+ 'Explain what a REWORK assurance level or credential type proves, and what it '
103
+ + 'explicitly does not prove. Use this before relying on a credential, so a '
104
+ + 'weak claim is not read as a strong one.',
105
+ inputSchema: {
106
+ type: 'object',
107
+ properties: {
108
+ assurance: {
109
+ type: 'string',
110
+ description: 'Assurance level, e.g. "workflow-identity". Omit to list all.',
111
+ },
112
+ },
113
+ additionalProperties: false,
114
+ },
115
+ },
116
+ ];
117
+
118
+ async function http(path, { method = 'GET', body } = {}) {
119
+ const ctl = new AbortController();
120
+ const timer = setTimeout(() => ctl.abort(), HTTP_TIMEOUT_MS);
121
+ try {
122
+ const res = await fetch(`${API}${path}`, {
123
+ method,
124
+ headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
125
+ body: body ? JSON.stringify(body) : undefined,
126
+ signal: ctl.signal,
127
+ });
128
+ const text = await res.text();
129
+ let parsed;
130
+ try { parsed = JSON.parse(text); } catch { parsed = { raw: text.slice(0, 500) }; }
131
+ if (!res.ok) throw new Error(`REWORK API ${res.status}: ${JSON.stringify(parsed).slice(0, 300)}`);
132
+ return parsed;
133
+ } finally {
134
+ clearTimeout(timer);
135
+ }
136
+ }
137
+
138
+ async function callTool(name, args) {
139
+ if (name === 'verify_rework_credential') {
140
+ const credential = (args && args.credential) || '';
141
+ if (!credential.trim()) throw new Error('credential is required');
142
+ const res = await http('/proofs/credentials/verify', {
143
+ method: 'POST',
144
+ body: { credential },
145
+ });
146
+ const subject = res.credential_subject || {};
147
+ const assurance = subject.assurance;
148
+ return {
149
+ valid: res.valid === true,
150
+ reason: res.reason || null,
151
+ issuer: res.issuer || null,
152
+ credential_subject: subject,
153
+ // An agent that only reads `valid` would treat every credential as
154
+ // equally strong. Ship the ceiling alongside the verdict.
155
+ assurance_note: assurance && ASSURANCE[assurance]
156
+ ? ASSURANCE[assurance].does_not_mean
157
+ : 'Assurance level not recognised — do not assume this proves more than it states.',
158
+ };
159
+ }
160
+
161
+ if (name === 'get_rework_issuer_keys') {
162
+ return await http('/proofs/credentials/jwks.json');
163
+ }
164
+
165
+ if (name === 'explain_rework_assurance') {
166
+ const level = args && args.assurance;
167
+ if (level) {
168
+ const entry = ASSURANCE[level];
169
+ if (!entry) {
170
+ return { error: `unknown assurance level: ${level}`, known: Object.keys(ASSURANCE) };
171
+ }
172
+ return { assurance: level, ...entry };
173
+ }
174
+ return { assurance_levels: ASSURANCE, credential_types: CREDENTIAL_TYPES };
175
+ }
176
+
177
+ throw new Error(`unknown tool: ${name}`);
178
+ }
179
+
180
+ // ── JSON-RPC plumbing ──────────────────────────────────────────────────────
181
+
182
+ function send(msg) {
183
+ process.stdout.write(JSON.stringify(msg) + '\n');
184
+ }
185
+
186
+ function result(id, value) { send({ jsonrpc: '2.0', id, result: value }); }
187
+ function failure(id, code, message) { send({ jsonrpc: '2.0', id, error: { code, message } }); }
188
+
189
+ async function handle(msg) {
190
+ const { id, method, params } = msg;
191
+
192
+ // A notification has no id and must never be answered - replying to one is
193
+ // a protocol violation the client reports as an unsolicited response.
194
+ const isNotification = id === undefined || id === null;
195
+
196
+ if (method === 'initialize') {
197
+ const asked = params && params.protocolVersion;
198
+ return result(id, {
199
+ protocolVersion: SUPPORTED_PROTOCOLS.includes(asked) ? asked : SUPPORTED_PROTOCOLS[0],
200
+ capabilities: { tools: { listChanged: false } },
201
+ serverInfo: { name: 'rework-proof', version: SERVER_VERSION },
202
+ });
203
+ }
204
+
205
+ if (method === 'notifications/initialized' || method === 'initialized') return;
206
+ if (method === 'ping') return isNotification ? undefined : result(id, {});
207
+
208
+ if (method === 'tools/list') {
209
+ return result(id, { tools: TOOLS });
210
+ }
211
+
212
+ if (method === 'tools/call') {
213
+ const name = params && params.name;
214
+ try {
215
+ const out = await callTool(name, (params && params.arguments) || {});
216
+ return result(id, {
217
+ content: [{ type: 'text', text: JSON.stringify(out, null, 2) }],
218
+ isError: false,
219
+ });
220
+ } catch (err) {
221
+ // A tool that fails is a result, not a transport error: the model needs
222
+ // to see why so it can adapt, and a JSON-RPC error would hide it.
223
+ return result(id, {
224
+ content: [{ type: 'text', text: `Tool ${name} failed: ${err.message}` }],
225
+ isError: true,
226
+ });
227
+ }
228
+ }
229
+
230
+ if (isNotification) return;
231
+ return failure(id, -32601, `Method not found: ${method}`);
232
+ }
233
+
234
+ let buffer = '';
235
+ process.stdin.setEncoding('utf8');
236
+ process.stdin.on('data', (chunk) => {
237
+ buffer += chunk;
238
+ let nl;
239
+ while ((nl = buffer.indexOf('\n')) !== -1) {
240
+ const line = buffer.slice(0, nl).trim();
241
+ buffer = buffer.slice(nl + 1);
242
+ if (!line) continue;
243
+ let msg;
244
+ try {
245
+ msg = JSON.parse(line);
246
+ } catch (err) {
247
+ log(`dropping unparseable frame: ${err.message}`);
248
+ continue;
249
+ }
250
+ Promise.resolve(handle(msg)).catch((err) => {
251
+ log(`handler error: ${err.stack || err.message}`);
252
+ if (msg && msg.id !== undefined && msg.id !== null) {
253
+ failure(msg.id, -32603, `Internal error: ${err.message}`);
254
+ }
255
+ });
256
+ }
257
+ });
258
+
259
+ process.stdin.on('end', () => process.exit(0));
260
+ log(`rework-proof MCP server ready (api=${API})`);