@under18dev/veritas-mcp 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,13 @@
1
- # Temporary Holding Version
1
+ # @under18dev/veritas-mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ MCP server exposing Veritas to agents
4
+
5
+ Part of [Veritas](https://github.com/under18dev/veritas), specification-aware test verification for TypeScript/JavaScript projects. Most users install the main package, which provides the `veritas` and `veritas-mcp` commands and the Node API:
6
+
7
+ ```bash
8
+ npm install -D @under18dev/veritas
9
+ ```
10
+
11
+ This package is an internal building block of that package; its API may change between minor versions. Source: [`packages/mcp`](https://github.com/under18dev/veritas/tree/main/packages/mcp).
12
+
13
+ Licensed under Apache-2.0.
package/dist/bin.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
package/dist/bin.js ADDED
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ import { realpathSync, statSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { parseArgs } from 'node:util';
5
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
6
+ import { TOOL_VERSION } from '@under18dev/veritas-core';
7
+ import { createServer } from './server.js';
8
+ const USAGE = `Usage: veritas-mcp [--root <dir>] [--max-concurrent <n>] [--allow-write]
9
+
10
+ Serves Veritas over MCP (stdio).
11
+ --root <dir> project root (default: current directory)
12
+ --max-concurrent <n> analysis jobs allowed at once (default: 1)
13
+ --allow-write register the tool that applies approved improvement plans
14
+ `;
15
+ let values;
16
+ try {
17
+ ({ values } = parseArgs({
18
+ options: {
19
+ root: { type: 'string', default: process.cwd() },
20
+ 'max-concurrent': { type: 'string', default: '1' },
21
+ 'allow-write': { type: 'boolean', default: false },
22
+ help: { type: 'boolean', short: 'h', default: false },
23
+ },
24
+ }));
25
+ }
26
+ catch (error) {
27
+ process.stderr.write(`${error.message}\n\n${USAGE}`);
28
+ process.exit(2);
29
+ }
30
+ if (values.help) {
31
+ process.stdout.write(USAGE);
32
+ process.exit(0);
33
+ }
34
+ const fail = (message) => {
35
+ process.stderr.write(`${message}\n\n${USAGE}`);
36
+ process.exit(2);
37
+ };
38
+ const maxConcurrent = Number(values['max-concurrent']);
39
+ if (!/^\d+$/.test(values['max-concurrent'] ?? '') || maxConcurrent < 1 || maxConcurrent > 16)
40
+ fail('--max-concurrent must be an integer from 1 to 16');
41
+ let root = '';
42
+ try {
43
+ root = realpathSync(path.resolve(values.root));
44
+ }
45
+ catch {
46
+ fail(`--root is not an existing directory: ${values.root}`);
47
+ }
48
+ if (!statSync(root).isDirectory())
49
+ fail(`--root is not a directory: ${values.root}`);
50
+ const server = createServer({
51
+ root,
52
+ maxConcurrent,
53
+ allowWrite: Boolean(values['allow-write']),
54
+ version: TOOL_VERSION,
55
+ });
56
+ await server.connect(new StdioServerTransport());
57
+ process.stderr.write(`veritas-mcp serving ${root}\n`);
58
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OA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M,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,IAAI,aAAa,GAAG,CAAC,IAAI,aAAa,GAAG,EAAE;IAC1F,IAAI,CAAC,kDAAkD,CAAC,CAAC;AAC3D,IAAI,IAAI,GAAG,EAAE,CAAC;AAEd,IAAI,CAAC;IACH,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAc,CAAC,CAAC,CAAC;AAC3D,CAAC;AAAC,MAAM,CAAC;IACP,IAAI,CAAC,wCAAwC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;IAAE,IAAI,CAAC,8BAA8B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AACrF,MAAM,MAAM,GAAG,YAAY,CAAC;IAC1B,IAAI;IACJ,aAAa;IACb,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC1C,OAAO,EAAE,YAAY;CACtB,CAAC,CAAC;AACH,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACjD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,IAAI,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { createServer, type ServerOptions } from './server.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { createServer } from './server.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAsB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export interface ServerOptions {
3
+ /** Project root. Every tool operates inside it; no tool accepts a path outside it. */
4
+ root: string;
5
+ /** Maximum number of long-running operations at the same time. */
6
+ maxConcurrent?: number;
7
+ version?: string;
8
+ /**
9
+ * Register `apply_approved_improvement`. Off by default: without it the server can never change project files.
10
+ * Even when on, every apply needs the plan id and the approval token that the plan's owner reviewed.
11
+ */
12
+ allowWrite?: boolean;
13
+ }
14
+ /**
15
+ * Build the Veritas MCP server. Read tools run analysis stages that only write under `.veritas/`; they never
16
+ * modify project sources. Tools that would change project files are not part of this server unless an approved
17
+ * improvement API is registered separately with an approval token.
18
+ */
19
+ export declare function createServer(options: ServerOptions): McpServer;
20
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAepE,MAAM,WAAW,aAAa;IAC5B,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AA+FD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,CAqT9D"}
package/dist/server.js ADDED
@@ -0,0 +1,320 @@
1
+ import { realpathSync, statSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
+ import { redact, TOOL_VERSION, VeritasError } from '@under18dev/veritas-core';
5
+ import { COMMAND_STAGES, explainFinding, listProperties, readArtifact, readLatest, runVeritas, } from '@under18dev/veritas-engine';
6
+ import { applyImprovement, planImprovement } from '@under18dev/veritas-improvement';
7
+ import { z } from 'zod';
8
+ const Id = (prefix) => z.string().regex(new RegExp(`^${prefix}-[0-9a-f]{6,64}$`), `expected a ${prefix}-<hex> id`);
9
+ const RunId = z.string().regex(/^run-[A-Za-z0-9-]{1,80}$/);
10
+ const GitRef = z
11
+ .string()
12
+ .max(200)
13
+ .regex(/^[A-Za-z0-9._/@~^-]+$/, 'not a plain git ref')
14
+ .refine((s) => !s.startsWith('-'), 'refs may not start with -');
15
+ /** A path or glob relative to the project root; anything resolving outside it is refused again by the engine. */
16
+ const ProjectPath = z
17
+ .string()
18
+ .min(1)
19
+ .max(500)
20
+ .refine((s) => !s.startsWith('-') && !s.includes('\0'), 'not a plain project path')
21
+ .refine((s) => !/^([A-Za-z]:|[\\/])/.test(s) && !s.split(/[\\/]/).includes('..'), 'must stay inside the project');
22
+ /** Limits concurrent long operations; extra calls wait their turn (or are cancelled while waiting). */
23
+ class Semaphore {
24
+ max;
25
+ active = 0;
26
+ waiting = [];
27
+ constructor(max) {
28
+ this.max = max;
29
+ }
30
+ async run(signal, task) {
31
+ while (this.active >= this.max) {
32
+ await new Promise((resolve, reject) => {
33
+ const onAbort = () => reject(new VeritasError('tool', 'CANCELLED', 'cancelled while waiting for another operation'));
34
+ signal.addEventListener('abort', onAbort, { once: true });
35
+ this.waiting.push(() => {
36
+ signal.removeEventListener('abort', onAbort);
37
+ resolve();
38
+ });
39
+ });
40
+ }
41
+ this.active++;
42
+ try {
43
+ return await task();
44
+ }
45
+ finally {
46
+ this.active--;
47
+ this.waiting.shift()?.();
48
+ }
49
+ }
50
+ }
51
+ function ok(data) {
52
+ const text = redact(JSON.stringify(data, null, 2));
53
+ return {
54
+ content: [{ type: 'text', text }],
55
+ structuredContent: JSON.parse(text),
56
+ };
57
+ }
58
+ function fail(error) {
59
+ const body = error instanceof VeritasError
60
+ ? { code: error.code, category: error.category, message: error.message, hint: error.hint ?? null }
61
+ : {
62
+ code: 'UNEXPECTED',
63
+ category: 'tool',
64
+ message: error?.message ?? String(error),
65
+ hint: null,
66
+ };
67
+ return { isError: true, content: [{ type: 'text', text: redact(JSON.stringify(body)) }] };
68
+ }
69
+ function summarize(summary) {
70
+ return {
71
+ runId: summary.runId,
72
+ verdict: summary.decision.verdict,
73
+ exitCode: summary.decision.exitCode,
74
+ reasons: summary.decision.reasons,
75
+ stages: summary.run.stages.map((s) => ({ stage: s.stage, status: s.status, messages: s.messages })),
76
+ findings: summary.findings.map((f) => ({
77
+ id: f.id,
78
+ kind: f.kind,
79
+ certainty: f.certainty,
80
+ severity: f.severity,
81
+ title: f.title,
82
+ })),
83
+ };
84
+ }
85
+ /**
86
+ * Build the Veritas MCP server. Read tools run analysis stages that only write under `.veritas/`; they never
87
+ * modify project sources. Tools that would change project files are not part of this server unless an approved
88
+ * improvement API is registered separately with an approval token.
89
+ */
90
+ export function createServer(options) {
91
+ // Programmatic callers get the same checks as the command: an existing directory and a sane concurrency limit.
92
+ const maxConcurrent = options.maxConcurrent ?? 1;
93
+ if (!Number.isInteger(maxConcurrent) || maxConcurrent < 1 || maxConcurrent > 16)
94
+ throw new VeritasError('user', 'OPTION_INVALID', 'maxConcurrent must be an integer from 1 to 16');
95
+ let root;
96
+ try {
97
+ root = realpathSync(path.resolve(options.root));
98
+ }
99
+ catch {
100
+ throw new VeritasError('user', 'ROOT_NOT_FOUND', `project root does not exist: ${options.root}`);
101
+ }
102
+ if (!statSync(root).isDirectory())
103
+ throw new VeritasError('user', 'ROOT_NOT_FOUND', `project root is not a directory: ${options.root}`);
104
+ const server = new McpServer({ name: 'veritas', version: options.version ?? TOOL_VERSION });
105
+ const gate = new Semaphore(maxConcurrent);
106
+ const runStages = (extra, command, stages, extraOptions = {}) => gate.run(extra.signal, async () => {
107
+ let step = 0;
108
+ const progressToken = extra._meta?.progressToken;
109
+ return runVeritas({
110
+ root,
111
+ command: `mcp:${command}`,
112
+ stages,
113
+ offline: true,
114
+ signal: extra.signal,
115
+ log: (message) => {
116
+ step++;
117
+ if (progressToken !== undefined) {
118
+ void extra
119
+ .sendNotification({
120
+ method: 'notifications/progress',
121
+ params: { progressToken, progress: step, total: stages.length + 1, message: redact(message) },
122
+ })
123
+ .catch(() => { });
124
+ }
125
+ },
126
+ ...extraOptions,
127
+ });
128
+ });
129
+ server.registerTool('discover_specs', {
130
+ description: 'Collect specification evidence (README, docs, JSDoc, schemas, git history, exported issues). Offline; network sources stay disabled.',
131
+ inputSchema: {},
132
+ annotations: { readOnlyHint: true, openWorldHint: false },
133
+ }, async (_args, extra) => {
134
+ try {
135
+ const summary = await runStages(extra, 'discover_specs', [
136
+ ...COMMAND_STAGES.discover,
137
+ ]);
138
+ const evidence = readArtifact(root, summary.runId, 'evidence').data;
139
+ return ok({
140
+ ...summarize(summary),
141
+ sources: evidence.sources.map((s) => ({
142
+ id: s.id,
143
+ kind: s.kind,
144
+ locator: s.locator,
145
+ range: s.range ?? null,
146
+ summary: s.summary,
147
+ trust: s.trust,
148
+ })),
149
+ statements: evidence.statements,
150
+ skipped: evidence.skipped,
151
+ });
152
+ }
153
+ catch (error) {
154
+ return fail(error);
155
+ }
156
+ });
157
+ server.registerTool('list_properties', {
158
+ description: 'List properties of the latest run with their review status, origin and sources. Approvals cannot be changed through MCP.',
159
+ inputSchema: {
160
+ status: z
161
+ .enum(['proposed', 'reviewed', 'accepted', 'rejected', 'conflicted', 'superseded'])
162
+ .optional(),
163
+ },
164
+ annotations: { readOnlyHint: true },
165
+ }, async ({ status }) => {
166
+ try {
167
+ const { runId, properties } = listProperties(root);
168
+ return ok({ runId, properties: properties.filter((p) => !status || p.status === status) });
169
+ }
170
+ catch (error) {
171
+ return fail(error);
172
+ }
173
+ });
174
+ server.registerTool('analyze_tests', {
175
+ description: 'Index code and tests, map tests to properties and assess each test with an evidence vector (no mutation run).',
176
+ inputSchema: {},
177
+ annotations: { readOnlyHint: true, openWorldHint: false },
178
+ }, async (_args, extra) => {
179
+ try {
180
+ const summary = await runStages(extra, 'analyze_tests', [
181
+ ...COMMAND_STAGES.analyze,
182
+ ]);
183
+ return ok({
184
+ ...summarize(summary),
185
+ assessments: readArtifact(root, summary.runId, 'assessments').data,
186
+ });
187
+ }
188
+ catch (error) {
189
+ return fail(error);
190
+ }
191
+ });
192
+ server.registerTool('run_mutation', {
193
+ description: 'Run mutation testing (real mutator) and relate mutants to properties and tests.',
194
+ inputSchema: {
195
+ since: GitRef.optional(),
196
+ scope: ProjectPath.optional().describe('source glob to mutate, relative to the project'),
197
+ killMatrix: z.boolean().default(false).describe('run every covering test for every mutant (slower)'),
198
+ reportFile: ProjectPath.optional().describe('import this mutation-testing-elements report instead of running mutator'),
199
+ },
200
+ annotations: { readOnlyHint: true, openWorldHint: false },
201
+ }, async ({ since, scope, killMatrix, reportFile }, extra) => {
202
+ try {
203
+ if (reportFile && killMatrix)
204
+ throw new VeritasError('user', 'OPTION_CONFLICT', 'reportFile is read as is; killMatrix needs a run');
205
+ const summary = await runStages(extra, 'run_mutation', [...COMMAND_STAGES.mutate], {
206
+ ...(since ? { since } : {}),
207
+ ...(scope ? { scope: [scope] } : {}),
208
+ ...(killMatrix ? { killMatrix: true } : {}),
209
+ ...(reportFile ? { mutationReport: reportFile } : {}),
210
+ });
211
+ const mutation = readArtifact(root, summary.runId, 'mutation').data;
212
+ return ok({ ...summarize(summary), counts: mutation.counts, mutants: mutation.mutants });
213
+ }
214
+ catch (error) {
215
+ return fail(error);
216
+ }
217
+ });
218
+ server.registerTool('verify_property', {
219
+ description: 'Check formalized properties with Z3 within a bounded integer model and replay counterexamples in JavaScript. Results are "proven within the model" at best, never a general proof.',
220
+ inputSchema: { propertyId: Id('P').optional(), includeProposed: z.boolean().default(false) },
221
+ annotations: { readOnlyHint: true, openWorldHint: false },
222
+ }, async ({ propertyId, includeProposed }, extra) => {
223
+ try {
224
+ const summary = await runStages(extra, 'verify_property', [...COMMAND_STAGES.prove], {
225
+ includeProposed,
226
+ ...(propertyId ? { propertyIds: [propertyId] } : {}),
227
+ });
228
+ const claims = (() => {
229
+ try {
230
+ return readArtifact(root, summary.runId, 'claims').data;
231
+ }
232
+ catch {
233
+ return [];
234
+ }
235
+ })();
236
+ return ok({ ...summarize(summary), claims });
237
+ }
238
+ catch (error) {
239
+ return fail(error);
240
+ }
241
+ });
242
+ server.registerTool('get_evidence', {
243
+ description: 'Return the evidence chain of a finding: sources and quotes, properties, tests, assessments, mutants and solver claims.',
244
+ inputSchema: { findingId: Id('F') },
245
+ annotations: { readOnlyHint: true },
246
+ }, async ({ findingId }) => {
247
+ try {
248
+ return ok(explainFinding(root, findingId));
249
+ }
250
+ catch (error) {
251
+ return fail(error);
252
+ }
253
+ });
254
+ server.registerTool('get_run_status', {
255
+ description: 'Return the status, stages, verdict and usage of a run (default: the latest).',
256
+ inputSchema: { runId: RunId.optional() },
257
+ annotations: { readOnlyHint: true },
258
+ }, async ({ runId }) => {
259
+ try {
260
+ const run = runId ? readArtifact(root, runId, 'run').data : readLatest(root, 'run').data;
261
+ return ok({ run });
262
+ }
263
+ catch (error) {
264
+ return fail(error);
265
+ }
266
+ });
267
+ server.registerTool('plan_improvement', {
268
+ description: 'Plan test-only improvements from the latest run (no project files are changed). Returns the plan, spec violation candidates and the approval token a person must review before anything is applied.',
269
+ inputSchema: {},
270
+ annotations: { readOnlyHint: true, openWorldHint: false },
271
+ }, async (_args, extra) => {
272
+ try {
273
+ const { signal } = extra;
274
+ const result = await gate.run(signal, () => planImprovement({ root, signal }));
275
+ return ok(result);
276
+ }
277
+ catch (error) {
278
+ return fail(error);
279
+ }
280
+ });
281
+ if (options.allowWrite) {
282
+ server.registerTool('apply_approved_improvement', {
283
+ description: 'Apply a reviewed improvement plan. Requires the exact plan id and approval token; adds new test files only, after measuring the improvement in an isolated copy, and rolls back otherwise. Refused in CI.',
284
+ inputSchema: {
285
+ planId: z.string().regex(/^IP-[0-9a-f]{6,64}$/, 'expected an IP-<hex> plan id'),
286
+ approvalToken: z.string().regex(/^[0-9a-f]{64}$/, 'expected the 64-character approval token'),
287
+ actor: z
288
+ .string()
289
+ .min(1)
290
+ .max(200)
291
+ .optional()
292
+ .describe('the person who approved the plan (recorded)'),
293
+ },
294
+ annotations: {
295
+ readOnlyHint: false,
296
+ destructiveHint: false,
297
+ idempotentHint: false,
298
+ openWorldHint: false,
299
+ },
300
+ }, async ({ planId, approvalToken, actor }, extra) => {
301
+ try {
302
+ const { signal } = extra;
303
+ const attempt = await gate.run(signal, () => applyImprovement({
304
+ root,
305
+ planId,
306
+ approvalToken,
307
+ signal,
308
+ via: 'mcp',
309
+ ...(actor ? { actor } : {}),
310
+ }));
311
+ return ok({ attempt });
312
+ }
313
+ catch (error) {
314
+ return fail(error);
315
+ }
316
+ });
317
+ }
318
+ return server;
319
+ }
320
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,MAAM,EAAkB,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EAEd,YAAY,EACZ,UAAU,EACV,UAAU,GACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,MAAM,EAAE,GAAG,CAAC,MAAc,EAAE,EAAE,CAC5B,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,MAAM,kBAAkB,CAAC,EAAE,cAAc,MAAM,WAAW,CAAC,CAAC;AAC9F,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,0B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AAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,EAAE,0CAA0C,CAAC;gBAC7F,KAAK,EAAE,CAAC;qBACL,MAAM,EAAE;qBACR,GAAG,CAAC,CAAC,CAAC;qBACN,GAAG,CAAC,GAAG,CAAC;qBACR,QAAQ,EAAE;qBACV,QAAQ,CAAC,6CAA6C,CAAC;aAC3D;YACD,WAAW,EAAE;gBACX,YAAY,EAAE,KAAK;gBACnB,eAAe,EAAE,KAAK;gBACtB,cAAc,EAAE,KAAK;gBACrB,aAAa,EAAE,KAAK;aACrB;SACF,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE;YAChD,IAAI,CAAC;gBACH,MAAM,EAAE,MAAM,EAAE,GAAG,KAAyB,CAAC;gBAC7C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,CAC1C,gBAAgB,CAAC;oBACf,IAAI;oBACJ,MAAM;oBACN,aAAa;oBACb,MAAM;oBACN,GAAG,EAAE,KAAK;oBACV,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBAC5B,CAAC,CACH,CAAC;gBAEF,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YACzB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@under18dev/veritas-mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "MCP server exposing Veritas to agents",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/under18dev/veritas.git",
9
+ "directory": "packages/mcp"
10
+ },
11
+ "type": "module",
12
+ "bin": {
13
+ "veritas-mcp": "./dist/bin.js"
14
+ },
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ },
20
+ "./bin": {
21
+ "import": "./dist/bin.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "engines": {
28
+ "node": ">=24"
29
+ },
30
+ "dependencies": {
31
+ "@modelcontextprotocol/sdk": "1.32.2",
32
+ "@under18dev/veritas-core": "0.1.0",
33
+ "@under18dev/veritas-engine": "0.1.0",
34
+ "zod": "4.6.7",
35
+ "@under18dev/veritas-improvement": "0.1.0"
36
+ }
6
37
  }