@nexart/mcp-server 0.1.0 → 0.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +114 -8
  2. package/CONTRIBUTING.md +7 -5
  3. package/README.md +69 -36
  4. package/SECURITY.md +11 -9
  5. package/THIRD_PARTY_NOTICES.md +4 -4
  6. package/dist/contracts.js +3 -2
  7. package/dist/json-schema.d.ts +9 -0
  8. package/dist/json-schema.js +20 -0
  9. package/dist/lookup/contracts.js +2 -1
  10. package/dist/network/contracts.d.ts +2 -2
  11. package/dist/owner/create.d.ts +2 -2
  12. package/dist/owner/custody.d.ts +7 -0
  13. package/dist/owner/custody.js +35 -16
  14. package/dist/protocol-safety.d.ts +3 -0
  15. package/dist/protocol-safety.js +16 -0
  16. package/dist/receipts/contracts.d.ts +2 -2
  17. package/dist/receipts/contracts.js +2 -1
  18. package/dist/receipts/verify.js +1 -1
  19. package/dist/record/contracts.d.ts +46 -4
  20. package/dist/record/contracts.js +5 -0
  21. package/dist/record/record.d.ts +3 -0
  22. package/dist/record/record.js +6 -2
  23. package/dist/record-tools.d.ts +4 -0
  24. package/dist/record-tools.js +21 -6
  25. package/dist/server.d.ts +11 -1
  26. package/dist/server.js +5 -5
  27. package/dist/stdio.js +3 -19
  28. package/dist/trust/policy.js +8 -2
  29. package/dist/write/attest.d.ts +3 -0
  30. package/dist/write/attest.js +2 -1
  31. package/dist/write/contracts.d.ts +6 -6
  32. package/dist/write/contracts.js +2 -1
  33. package/docs/consumer-guide.md +214 -0
  34. package/package.json +20 -6
  35. package/server.json +9 -3
  36. package/docs/age-version-compatibility.md +0 -46
  37. package/docs/architecture.md +0 -72
  38. package/docs/compatibility.md +0 -163
  39. package/docs/contracts.md +0 -127
  40. package/docs/licensing-review.md +0 -109
  41. package/docs/milestone-1-validation.md +0 -110
  42. package/docs/milestone-2.md +0 -291
  43. package/docs/milestone-3.2.md +0 -291
  44. package/docs/milestone-3.md +0 -274
  45. package/docs/milestone-4a.md +0 -221
  46. package/docs/milestone-4b1.md +0 -220
  47. package/docs/milestone-4b2.md +0 -260
  48. package/docs/public-default.md +0 -263
  49. package/docs/recording-schema-compatibility.md +0 -46
  50. package/docs/release.md +0 -311
  51. package/docs/security-fixes.md +0 -47
  52. package/docs/security.md +0 -195
  53. package/docs/standalone-acceptance.md +0 -81
  54. package/docs/validation.md +0 -85
@@ -35,8 +35,12 @@ function supportedAgeVersion(output) {
35
35
  }
36
36
  function checkConfiguration(config) {
37
37
  ownerDirectory(config.directory);
38
- if (config.ownerApproved !== true || config.decryptionIdentityExcluded !== true ||
39
- !/^age1[023456789acdefghjklmnpqrstuvwxyz]{58}$/.test(config.recipient) ||
38
+ if (config.ownerApproved !== true || config.decryptionIdentityExcluded !== true)
39
+ throw Error('ENCRYPTED_CUSTODY_CONFIGURATION_REQUIRED');
40
+ checkAgeRecipient(config);
41
+ }
42
+ function checkAgeRecipient(config) {
43
+ if (!/^age1[023456789acdefghjklmnpqrstuvwxyz]{58}$/.test(config.recipient) ||
40
44
  !isAbsolute(config.ageExecutable) || realpathSync(config.ageExecutable) !== config.ageExecutable ||
41
45
  !statSync(config.ageExecutable).isFile())
42
46
  throw Error('ENCRYPTED_CUSTODY_CONFIGURATION_REQUIRED');
@@ -62,6 +66,33 @@ function encrypt(config, bytes) {
62
66
  throw new EncryptedCustodyError('RECOVERY_ENCRYPTION_FAILED');
63
67
  }
64
68
  }
69
+ /** Checked raw-payload port for private storage-only acceptance. Shares the
70
+ * exact native-age primitive with CER recovery; grants no recording authority.
71
+ * The CER-bound wrapper below deliberately retains all its existing checks. */
72
+ export function encryptCustodyPayload(bytes, config) {
73
+ checkAgeRecipient(config);
74
+ if (typeof bytes !== 'string' || Buffer.byteLength(bytes) > LIMIT / 2)
75
+ throw Error('RECOVERY_LIMIT');
76
+ return encrypt(config, bytes);
77
+ }
78
+ /** Shared in-memory encryption for a durable hosted storage port. No files or
79
+ * private identity, and no new commitment/encryption implementation. */
80
+ export function encryptRecoveryForRecipient(bundle, snapshot, openings, config) {
81
+ checkAgeRecipient(config);
82
+ if (!validV2(bundle) || boundedInput(bundle))
83
+ throw Error('INVALID_CUSTODY_CER');
84
+ const recovery = { format: 'nexart-encrypted-recovery-v1', certificateHash: bundle.certificateHash, snapshot, openings };
85
+ try {
86
+ verifyRecovery(bundle, recovery);
87
+ }
88
+ catch {
89
+ throw new EncryptedCustodyError('RECOVERY_BINDING_FAILED');
90
+ }
91
+ const bytes = JSON.stringify(recovery);
92
+ if (Buffer.byteLength(bytes) > LIMIT / 2)
93
+ throw Error('RECOVERY_LIMIT');
94
+ return encrypt(config, bytes);
95
+ }
65
96
  /** Check actual recipient parsing/executable before a paid provider call. */
66
97
  export function preflightEncryptedCustody(config) {
67
98
  checkEncryptedCustody(config);
@@ -131,19 +162,7 @@ export function verifyRecovery(bundle, recovery) {
131
162
  /** No plaintext files. Partial ciphertext is preserved, never overwritten/retried. */
132
163
  export function retainEncrypted(bundle, snapshot, openings, config) {
133
164
  checkEncryptedCustody(config);
134
- if (!validV2(bundle) || boundedInput(bundle))
135
- throw Error('INVALID_CUSTODY_CER');
136
- const recovery = { format: 'nexart-encrypted-recovery-v1', certificateHash: bundle.certificateHash, snapshot, openings };
137
- try {
138
- verifyRecovery(bundle, recovery);
139
- }
140
- catch {
141
- throw new EncryptedCustodyError('RECOVERY_BINDING_FAILED');
142
- }
143
- const plaintext = JSON.stringify(recovery);
144
- if (Buffer.byteLength(plaintext) > LIMIT / 2)
145
- throw Error('RECOVERY_LIMIT');
146
- const ciphertext = encrypt(config, plaintext);
165
+ const ciphertext = encryptRecoveryForRecipient(bundle, snapshot, openings, config);
147
166
  const dir = join(config.directory, bundle.certificateHash.replace(':', '-'));
148
167
  try {
149
168
  mkdirSync(dir, { mode: 0o700 });
@@ -152,7 +171,7 @@ export function retainEncrypted(bundle, snapshot, openings, config) {
152
171
  exclusive(join(dir, 'cer.json'), JSON.stringify(bundle));
153
172
  exclusive(join(dir, 'committed.json'), JSON.stringify({
154
173
  format: 'nexart-custody-commit-v1', certificateHash: bundle.certificateHash,
155
- recoveryFormat: recovery.format, ciphertextSha256: digest(ciphertext),
174
+ recoveryFormat: 'nexart-encrypted-recovery-v1', ciphertextSha256: digest(ciphertext),
156
175
  recipientSha256: digest(config.recipient),
157
176
  }));
158
177
  syncDirectory(dir);
@@ -0,0 +1,3 @@
1
+ import type { JSONRPCMessage } from '@modelcontextprotocol/server';
2
+ /** Redact diagnostics without replacing the SDK's protocol-era wire envelope. */
3
+ export declare function redactProtocolMessage(message: JSONRPCMessage): JSONRPCMessage;
@@ -0,0 +1,16 @@
1
+ /** Redact diagnostics without replacing the SDK's protocol-era wire envelope. */
2
+ export function redactProtocolMessage(message) {
3
+ if ('error' in message)
4
+ return {
5
+ ...message, error: { code: message.error.code, message: 'MCP request rejected' },
6
+ };
7
+ if ('result' in message && typeof message.result === 'object' &&
8
+ message.result !== null && 'isError' in message.result && message.result.isError === true) {
9
+ return { ...message, result: {
10
+ ...message.result, isError: true,
11
+ content: [{ type: 'text', text: 'Invalid MCP tool request' }],
12
+ } };
13
+ }
14
+ return message;
15
+ }
16
+ //# sourceMappingURL=protocol-safety.js.map
@@ -45,16 +45,16 @@ export declare const receiptOutput: z.ZodObject<{
45
45
  mismatch: "mismatch";
46
46
  }>;
47
47
  keyStatus: z.ZodEnum<{
48
+ deprecated: "deprecated";
48
49
  unknown: "unknown";
49
50
  active: "active";
50
- deprecated: "deprecated";
51
51
  revoked: "revoked";
52
52
  unavailable: "unavailable";
53
53
  }>;
54
54
  keyLifecycle: z.ZodEnum<{
55
+ unknown: "unknown";
55
56
  valid: "valid";
56
57
  invalid: "invalid";
57
- unknown: "unknown";
58
58
  }>;
59
59
  lifecycleCode: z.ZodString;
60
60
  signerTrust: z.ZodEnum<{
@@ -1,4 +1,5 @@
1
1
  import * as z from 'zod/v4';
2
+ import { anyJsonValue } from '../json-schema.js';
2
3
  import { boundedString, hashSchema } from '../network/contracts.js';
3
4
  export const RECEIPT_TOOL = 'nexart_verify_node_receipt';
4
5
  export const receiptSchema = z.strictObject({
@@ -14,7 +15,7 @@ export const receiptSchema = z.strictObject({
14
15
  export const receiptInput = z.strictObject({
15
16
  source: z.enum(['inline', 'public_lookup']),
16
17
  certificateHash: hashSchema,
17
- receipt: z.unknown().optional(),
18
+ receipt: anyJsonValue.optional(),
18
19
  signatureB64Url: z.string().min(1).max(128).optional(),
19
20
  });
20
21
  export const receiptOutput = z.strictObject({
@@ -14,7 +14,7 @@ export async function verifyReceipt(args, network, policy = TRUST_POLICY, signal
14
14
  artifactIntegrity: 'not_performed', sdk: null,
15
15
  limitations: [
16
16
  'Signature validity does not establish signer trust, artifact integrity or execution truth.',
17
- 'No approved production key pins or historical exceptions are supplied by default.',
17
+ 'Signer trust requires an independently approved matching key pin and valid key lifecycle; discovery alone is not approval.',
18
18
  'Node-issued receipt time is not independently trusted time or RFC 3161 verification.',
19
19
  'A current key manifest is not an authenticated historical key archive.',
20
20
  ],
@@ -1,4 +1,24 @@
1
1
  import * as z from 'zod/v4';
2
+ export declare const receiptProofSchema: z.ZodObject<{
3
+ receipt: z.ZodObject<{
4
+ receiptVersion: z.ZodLiteral<"attestation.receipt.v1">;
5
+ attestationId: z.ZodString;
6
+ certificateHash: z.ZodString;
7
+ nodeRuntimeHash: z.ZodString;
8
+ protocolVersion: z.ZodEnum<{
9
+ "1.2.0": "1.2.0";
10
+ "1.3.0": "1.3.0";
11
+ "1.3.1": "1.3.1";
12
+ }>;
13
+ nodeId: z.ZodString;
14
+ attestorKeyId: z.ZodString;
15
+ attestedAt: z.ZodOptional<z.ZodString>;
16
+ timestampType: z.ZodOptional<z.ZodString>;
17
+ timestampStatus: z.ZodOptional<z.ZodString>;
18
+ timestampProvider: z.ZodOptional<z.ZodString>;
19
+ }, z.core.$strict>;
20
+ signatureB64Url: z.ZodString;
21
+ }, z.core.$strict>;
2
22
  export declare const recordInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
23
  kind: z.ZodLiteral<"execution">;
4
24
  execution: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -38,8 +58,8 @@ export declare const mcpRecordInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
38
58
  input: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
39
59
  output: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
40
60
  parameters: z.ZodObject<{
41
- temperature: z.ZodNumber;
42
- maxTokens: z.ZodNumber;
61
+ temperature: z.ZodNullable<z.ZodNumber>;
62
+ maxTokens: z.ZodNullable<z.ZodNumber>;
43
63
  topP: z.ZodNullable<z.ZodNumber>;
44
64
  seed: z.ZodNullable<z.ZodNumber>;
45
65
  }, z.core.$strict>;
@@ -123,8 +143,8 @@ export declare const recordDiscoveryInput: z.ZodObject<{
123
143
  input: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
124
144
  output: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
125
145
  parameters: z.ZodObject<{
126
- temperature: z.ZodNumber;
127
- maxTokens: z.ZodNumber;
146
+ temperature: z.ZodNullable<z.ZodNumber>;
147
+ maxTokens: z.ZodNullable<z.ZodNumber>;
128
148
  topP: z.ZodNullable<z.ZodNumber>;
129
149
  seed: z.ZodNullable<z.ZodNumber>;
130
150
  }, z.core.$strict>;
@@ -181,6 +201,8 @@ export declare const recordDiscoveryInput: z.ZodObject<{
181
201
  }, z.core.$strict>;
182
202
  export type CaptureSource = 'producer_supplied' | 'instrumented_provider_call';
183
203
  export interface RecordResult {
204
+ /** Hosted-only additive proof; never contains recovery openings. */
205
+ receiptProof?: z.infer<typeof receiptProofSchema>;
184
206
  contractVersion: '1';
185
207
  captureProvenance: CaptureSource;
186
208
  evidence: 'not_created' | 'created_confidential' | 'existing_unchanged' | 'custody_failed' | 'invalid';
@@ -204,6 +226,26 @@ export interface RecordResult {
204
226
  };
205
227
  }
206
228
  export declare const recordOutput: z.ZodObject<{
229
+ receiptProof: z.ZodOptional<z.ZodObject<{
230
+ receipt: z.ZodObject<{
231
+ receiptVersion: z.ZodLiteral<"attestation.receipt.v1">;
232
+ attestationId: z.ZodString;
233
+ certificateHash: z.ZodString;
234
+ nodeRuntimeHash: z.ZodString;
235
+ protocolVersion: z.ZodEnum<{
236
+ "1.2.0": "1.2.0";
237
+ "1.3.0": "1.3.0";
238
+ "1.3.1": "1.3.1";
239
+ }>;
240
+ nodeId: z.ZodString;
241
+ attestorKeyId: z.ZodString;
242
+ attestedAt: z.ZodOptional<z.ZodString>;
243
+ timestampType: z.ZodOptional<z.ZodString>;
244
+ timestampStatus: z.ZodOptional<z.ZodString>;
245
+ timestampProvider: z.ZodOptional<z.ZodString>;
246
+ }, z.core.$strict>;
247
+ signatureB64Url: z.ZodString;
248
+ }, z.core.$strict>>;
207
249
  contractVersion: z.ZodLiteral<"1">;
208
250
  captureProvenance: z.ZodEnum<{
209
251
  producer_supplied: "producer_supplied";
@@ -1,6 +1,10 @@
1
1
  import * as z from 'zod/v4';
2
2
  import { executionSchema, identitySchema } from '../write/contracts.js';
3
3
  import { hashSchema } from '../network/contracts.js';
4
+ import { receiptSchema } from '../receipts/contracts.js';
5
+ export const receiptProofSchema = z.strictObject({
6
+ receipt: receiptSchema, signatureB64Url: z.string().regex(/^[A-Za-z0-9_-]{86}$/),
7
+ });
4
8
  const certification = z.strictObject({
5
9
  mode: z.enum(['node', 'local']).default('node'),
6
10
  visibility: z.enum(['public', 'private']).optional(),
@@ -50,6 +54,7 @@ export const recordDiscoveryInput = z.strictObject({
50
54
  certification: certification.optional(),
51
55
  });
52
56
  export const recordOutput = z.strictObject({
57
+ receiptProof: receiptProofSchema.optional(),
53
58
  contractVersion: z.literal('1'),
54
59
  captureProvenance: z.enum(['producer_supplied', 'instrumented_provider_call']),
55
60
  evidence: z.enum(['not_created', 'created_confidential', 'existing_unchanged', 'custody_failed', 'invalid']),
@@ -3,6 +3,9 @@ import { type CaptureSource, type RecordResult, type PreparedRecord, type Public
3
3
  /** Trusted application configuration, never MCP arguments. Credential discovery
4
4
  * belongs to the explicitly configured publisher, not this recording library. */
5
5
  export interface RecordRuntime {
6
+ /** Trusted embedding port: must verify and durably retain encrypted recovery
7
+ * before returning the SDK CER. Never populated from environment/tool input. */
8
+ createConfidential?: (creation: unknown) => Promise<unknown>;
6
9
  custodyDirectory?: string;
7
10
  recoveryStorage?: 'unencrypted_owner_approved';
8
11
  encryptedCustody?: EncryptedCustody;
@@ -27,7 +27,7 @@ export async function recordExecution(raw, runtime = {}) {
27
27
  result.policyAuthorization = mode === 'local' ? 'not_required' : 'setup_required';
28
28
  let bundle;
29
29
  if (input.kind === 'execution') {
30
- if (!runtime.encryptedCustody && (!runtime.custodyDirectory || runtime.recoveryStorage !== 'unencrypted_owner_approved')) {
30
+ if (!runtime.createConfidential && !runtime.encryptedCustody && (!runtime.custodyDirectory || runtime.recoveryStorage !== 'unencrypted_owner_approved')) {
31
31
  return { ...result, evidence: 'custody_failed', reasonCode: 'APPROVED_CUSTODY_REQUIRED' };
32
32
  }
33
33
  try {
@@ -39,7 +39,11 @@ export async function recordExecution(raw, runtime = {}) {
39
39
  decisionRefIndexes: Array.isArray(input.execution.decisionRefs)
40
40
  ? input.execution.decisionRefs.map((_, i) => i) : [],
41
41
  };
42
- if (runtime.encryptedCustody) {
42
+ if (runtime.createConfidential) {
43
+ bundle = await runtime.createConfidential(creation);
44
+ result.custody = 'encrypted_owner_recipient';
45
+ }
46
+ else if (runtime.encryptedCustody) {
43
47
  bundle = createEncryptedConfidential(creation, runtime.encryptedCustody);
44
48
  result.custody = 'encrypted_owner_recipient';
45
49
  }
@@ -1,10 +1,14 @@
1
1
  import type { McpServer } from '@modelcontextprotocol/server';
2
2
  import { type EncryptedCustody } from './owner/custody.js';
3
+ import { type RecordResult } from './record/contracts.js';
3
4
  import type { RecordRuntime } from './record/record.js';
4
5
  export interface RecordingConfig {
5
6
  enabled: boolean;
6
7
  custody?: EncryptedCustody;
7
8
  publish?: RecordRuntime['publish'];
9
+ /** Trusted hosted embedding only; no environment/stdio selector. */
10
+ execute?: (args: unknown) => Promise<RecordResult>;
11
+ requirePolicyRevision?: boolean;
8
12
  }
9
13
  export declare function recordingConfig(env?: NodeJS.ProcessEnv): RecordingConfig;
10
14
  export declare function registerRecordingTool(server: McpServer, config?: RecordingConfig): void;
@@ -10,6 +10,15 @@ const custodyConfig = z.strictObject({
10
10
  version: z.literal(1), directory: z.string().min(1), ageExecutable: z.string().min(1),
11
11
  recipient: z.string().min(1), ownerApproved: z.literal(true), decryptionIdentityExcluded: z.literal(true),
12
12
  });
13
+ const hostedDiscovery = recordDiscoveryInput.omit({ bundle: true }).extend({
14
+ kind: z.literal('execution'),
15
+ execution: recordDiscoveryInput.shape.execution.unwrap(),
16
+ createdAt: recordDiscoveryInput.shape.createdAt.unwrap(),
17
+ certification: z.strictObject({
18
+ mode: z.literal('node').default('node'), visibility: z.enum(['public', 'private']),
19
+ policy_revision: z.number().int().positive().optional(),
20
+ }),
21
+ });
13
22
  // Constant guidance only: never interpolate credentials, arguments or paths.
14
23
  const SETUP_MESSAGES = Object.freeze({
15
24
  CUSTODY_CONFIG_MISSING: 'Configure the owner-only NEXART_RECORD_CUSTODY_CONFIG JSON before execution recording.',
@@ -57,26 +66,32 @@ export function registerRecordingTool(server, config = recordingConfig()) {
57
66
  if (!config.enabled)
58
67
  return;
59
68
  server.registerTool('nexart_record_execution', {
60
- description: 'Record producer-supplied execution data as confidential AI V2 with encrypted recovery custody, or verify an unchanged existing confidential AI V2 CER. Node/public is the default intent. Automatic submission requires customer-configured API key, explicit delegation consent and disclosure policy; may consume quota. Missing setup is reported, never silently falls back. Explicit private and local-only supported. Does not observe all host interactions or authenticate a provider call. No openings or plaintext returned. No automatic POST retries.',
61
- inputSchema: recordDiscoveryInput, outputSchema: recordOutput,
62
- annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: Boolean(config.publish) },
69
+ description: config.execute
70
+ ? 'Create and certify a new confidential AI V2 execution using the customer API key in the HTTP Authorization header and the approved NexArt dashboard policy. Explicitly select public or private visibility; there is no hosted default. May consume the customer account allowance. Existing CERs and local-only mode are unsupported on hosted HTTP. Model/provider require policy approval; other optional readable metadata is rejected. Structural IDs, timestamps, parameters, roles, SDK version, hashes and commitment descriptors remain readable. Input/output, instructions and decision references receive confidential commitments and durable age-encrypted recovery custody before submission. Producer-supplied data is not an authenticated provider observation. No plaintext/openings returned. Keep a stable executionId on retries; uncertain submissions are never automatically repeated.'
71
+ : 'Record producer-supplied execution data as confidential AI V2 with encrypted recovery custody, or verify an unchanged existing confidential AI V2 CER. Node/public is the default intent. Automatic submission requires customer-configured API key, explicit delegation consent and disclosure policy; may consume quota. Missing setup is reported, never silently falls back. Explicit private and local-only supported. Does not observe all host interactions or authenticate a provider call. No openings or plaintext returned. No automatic POST retries.',
72
+ inputSchema: config.execute
73
+ ? (config.requirePolicyRevision ? hostedDiscovery.extend({
74
+ certification: hostedDiscovery.shape.certification.required({ policy_revision: true }),
75
+ }) : hostedDiscovery)
76
+ : recordDiscoveryInput, outputSchema: recordOutput,
77
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: Boolean(config.execute || config.publish) },
63
78
  }, async (args) => {
64
79
  // Discovery optionality never authorizes a partial or mixed branch.
65
80
  // Validate before reading runtime custody or calling any recording path.
66
- const parsed = mcpRecordInput.safeParse(args);
81
+ const parsed = (config.execute ? hostedDiscovery : mcpRecordInput).safeParse(args);
67
82
  if (!parsed.success)
68
83
  return {
69
84
  isError: true, content: [{ type: 'text', text: 'INVALID_RECORDING_ARGUMENTS' }],
70
85
  };
71
86
  // Only explicitly configured customer delegation; never tool-controlled policy.
72
- const result = await recordExecution(parsed.data, {
87
+ const result = config.execute ? await config.execute(parsed.data) : await recordExecution(parsed.data, {
73
88
  captureSource: 'producer_supplied', ...(config.custody ? { encryptedCustody: config.custody } : {}),
74
89
  ...(config.publish ? { publish: config.publish } : {}),
75
90
  });
76
91
  const diagnostic = result.reasonCode === 'APPROVED_CUSTODY_REQUIRED'
77
92
  ? custodySetupDiagnostics.get(config) ?? 'CUSTODY_CONFIG_MISSING' : result.reasonCode;
78
93
  const guidance = SETUP_MESSAGES[diagnostic];
79
- return { content: [
94
+ return { ...(config.execute && result.submission !== 'node_reported_accepted' ? { isError: true } : {}), content: [
80
95
  { type: 'text', text: JSON.stringify(result) },
81
96
  ...(guidance ? [{ type: 'text', text: `${diagnostic}: ${guidance}` }] : []),
82
97
  ], structuredContent: result };
package/dist/server.d.ts CHANGED
@@ -1,2 +1,12 @@
1
1
  import { McpServer } from '@modelcontextprotocol/server';
2
- export declare function createServer(): McpServer;
2
+ import type { RecordingConfig } from './record-tools.js';
3
+ import type { WriteConfig } from './write/config.js';
4
+ import type { NodeNetwork } from './network/client.js';
5
+ /** Trusted host inputs, never MCP arguments. HTTP callers must supply explicit
6
+ * request-scoped configuration rather than inheriting a stdio owner's environment. */
7
+ export interface ServerRuntime {
8
+ network?: NodeNetwork;
9
+ write?: WriteConfig;
10
+ recording?: RecordingConfig;
11
+ }
12
+ export declare function createServer(runtime?: ServerRuntime): McpServer;
package/dist/server.js CHANGED
@@ -10,8 +10,8 @@ const DESCRIPTIONS = [
10
10
  'Verify inline governed execution 0.1/0.2 with explicit version dispatch. No state-hash or producer authentication.',
11
11
  'Verify an inline Project Bundle and embedded AI CERs using the SDK; require project hash integrity.',
12
12
  ];
13
- export function createServer() {
14
- const server = new McpServer({ name: 'nexart-mcp-server', version: '0.1.0' });
13
+ export function createServer(runtime = {}) {
14
+ const server = new McpServer({ name: 'nexart-mcp-server', version: '0.3.0' });
15
15
  TOOL_NAMES.forEach((name, index) => {
16
16
  server.registerTool(name, {
17
17
  description: DESCRIPTIONS[index],
@@ -29,9 +29,9 @@ export function createServer() {
29
29
  };
30
30
  });
31
31
  });
32
- registerNetworkTools(server);
33
- registerWriteTools(server);
34
- registerRecordingTool(server);
32
+ registerNetworkTools(server, runtime.network);
33
+ registerWriteTools(server, runtime.write);
34
+ registerRecordingTool(server, runtime.recording);
35
35
  // The SDK may report parsing/validation exceptions containing input fragments.
36
36
  server.server.onerror = () => { process.stderr.write('NEXART_MCP_PROTOCOL_ERROR\n'); };
37
37
  return server;
package/dist/stdio.js CHANGED
@@ -3,6 +3,7 @@ import { Transform } from 'node:stream';
3
3
  import { serveStdio, StdioServerTransport } from '@modelcontextprotocol/server/stdio';
4
4
  import { createServer } from './server.js';
5
5
  import { LIMITS } from './limits.js';
6
+ import { redactProtocolMessage } from './protocol-safety.js';
6
7
  /**
7
8
  * Pre-parse byte/depth guard. MCP framing/parsing stays in the official SDK.
8
9
  * No evidence is stored or logged. A hard framing limit closes the connection.
@@ -57,29 +58,12 @@ class SafeStdioTransport extends StdioServerTransport {
57
58
  guard.destroy();
58
59
  }
59
60
  send(message) {
60
- if ('error' in message) {
61
- return super.send({
62
- ...message, error: { code: message.error.code, message: 'MCP request rejected' },
63
- });
64
- }
65
- if ('result' in message && typeof message.result === 'object' &&
66
- message.result !== null && 'isError' in message.result &&
67
- message.result.isError === true) {
68
- return super.send({
69
- ...message,
70
- result: {
71
- ...message.result,
72
- isError: true,
73
- content: [{ type: 'text', text: 'Invalid MCP tool request' }],
74
- },
75
- });
76
- }
77
- return super.send(message);
61
+ return super.send(redactProtocolMessage(message));
78
62
  }
79
63
  }
80
64
  const guard = new InputGuard();
81
65
  const transport = new SafeStdioTransport(guard, process.stdout, { maxBufferSize: LIMITS.frameBytes });
82
- const handle = serveStdio(createServer, {
66
+ const handle = serveStdio(() => createServer(), {
83
67
  transport,
84
68
  onerror: () => {
85
69
  process.stderr.write('NEXART_MCP_PROTOCOL_ERROR\n');
@@ -1,6 +1,12 @@
1
1
  export const TRUST_POLICY = Object.freeze({
2
2
  expectedNodeId: 'nexart-node-prod-1',
3
- // Intentionally empty. Adding a pin or historical exception requires separate approval.
4
- pins: Object.freeze([]),
3
+ // Independently approved by the owner against the active Railway production
4
+ // signer. Rotation and historical exceptions require separate approval.
5
+ pins: Object.freeze([
6
+ Object.freeze({
7
+ kid: 'k1',
8
+ publicKeyB64Url: '30ROjmcwj5oowj_fflAqdyacB0ik7eEnndzNKJmy9uU',
9
+ }),
10
+ ]),
5
11
  });
6
12
  //# sourceMappingURL=policy.js.map
@@ -10,5 +10,8 @@ export interface AttestDependencies {
10
10
  policy?: TrustPolicy;
11
11
  /** Trusted embedding only; never a tool argument or environment selector. */
12
12
  disclosureProfile?: DisclosureProfile;
13
+ /** Trusted application exact-body single-use grant, NOT a boolean bypass.
14
+ * Omitted by stdio: its existing owner-file approval remains unchanged. */
15
+ consumePublicApproval?: (body: string, key: string) => boolean;
13
16
  }
14
17
  export declare function attest(args: unknown, config: WriteConfig, dependencies?: AttestDependencies, signal?: AbortSignal): Promise<AttestOutput>;
@@ -89,7 +89,8 @@ export async function attest(args, config, dependencies = {}, signal) {
89
89
  output = await network.run(signal, async (active) => {
90
90
  active.throwIfAborted();
91
91
  if (input.visibility === 'public') {
92
- if (!consumeApproval(config, body, key))
92
+ if (!(dependencies.consumePublicApproval
93
+ ? dependencies.consumePublicApproval(body, key) : consumeApproval(config, body, key)))
93
94
  return { ...output, reasonCode: 'PUBLIC_OWNER_APPROVAL_REQUIRED' };
94
95
  output.publicationAuthorization = 'approved';
95
96
  }
@@ -15,8 +15,8 @@ export declare const executionSchema: z.ZodObject<{
15
15
  input: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
16
16
  output: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
17
17
  parameters: z.ZodObject<{
18
- temperature: z.ZodNumber;
19
- maxTokens: z.ZodNumber;
18
+ temperature: z.ZodNullable<z.ZodNumber>;
19
+ maxTokens: z.ZodNullable<z.ZodNumber>;
20
20
  topP: z.ZodNullable<z.ZodNumber>;
21
21
  seed: z.ZodNullable<z.ZodNumber>;
22
22
  }, z.core.$strict>;
@@ -61,8 +61,8 @@ export declare const sealInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
61
61
  input: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
62
62
  output: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
63
63
  parameters: z.ZodObject<{
64
- temperature: z.ZodNumber;
65
- maxTokens: z.ZodNumber;
64
+ temperature: z.ZodNullable<z.ZodNumber>;
65
+ maxTokens: z.ZodNullable<z.ZodNumber>;
66
66
  topP: z.ZodNullable<z.ZodNumber>;
67
67
  seed: z.ZodNullable<z.ZodNumber>;
68
68
  }, z.core.$strict>;
@@ -198,16 +198,16 @@ export declare const attestOutput: z.ZodObject<{
198
198
  mismatch: "mismatch";
199
199
  }>;
200
200
  keyStatus: z.ZodEnum<{
201
+ deprecated: "deprecated";
201
202
  unknown: "unknown";
202
203
  active: "active";
203
- deprecated: "deprecated";
204
204
  revoked: "revoked";
205
205
  unavailable: "unavailable";
206
206
  }>;
207
207
  keyLifecycle: z.ZodEnum<{
208
+ unknown: "unknown";
208
209
  valid: "valid";
209
210
  invalid: "invalid";
210
- unknown: "unknown";
211
211
  }>;
212
212
  lifecycleCode: z.ZodString;
213
213
  signerTrust: z.ZodEnum<{
@@ -14,7 +14,8 @@ export const executionSchema = z.strictObject({
14
14
  executionId: text, timestamp: text, provider: text, model: text,
15
15
  input: z.union([z.string(), jsonObject]), output: z.union([z.string(), jsonObject]),
16
16
  parameters: z.strictObject({
17
- temperature: z.number(), maxTokens: z.number(),
17
+ // Required evidence: explicit null means unavailable, never an inferred default.
18
+ temperature: z.number().nullable(), maxTokens: z.number().nullable(),
18
19
  topP: z.number().nullable(), seed: z.number().nullable(),
19
20
  }),
20
21
  executionRole: z.enum(['advisory', 'operative', 'unspecified']),