@kya-os/mcp-i 1.5.5 → 1.5.6-canary.1
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/dist/compiler/config/schemas/identity.d.ts +29 -2
- package/dist/compiler/config/schemas/identity.js +11 -3
- package/dist/compiler/get-webpack-config/get-externals.js +3 -0
- package/dist/config.d.ts +174 -0
- package/dist/config.js +89 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/runtime/adapter-express.js +1 -1
- package/dist/runtime/adapter-nextjs.js +1 -1
- package/dist/runtime/delegation-verifier-agentshield.d.ts +2 -2
- package/dist/runtime/delegation-verifier-agentshield.js +96 -64
- package/dist/runtime/delegation-verifier-kv.js +17 -16
- package/dist/runtime/delegation-verifier-memory.js +8 -0
- package/dist/runtime/delegation-verifier.d.ts +49 -1
- package/dist/runtime/delegation-verifier.js +38 -12
- package/dist/runtime/http.js +1 -1
- package/dist/runtime/identity.d.ts +8 -5
- package/dist/runtime/index.d.ts +3 -2
- package/dist/runtime/index.js +5 -4
- package/dist/runtime/mcpi-runtime-wrapper.d.ts +12 -7
- package/dist/runtime/mcpi-runtime-wrapper.js +22 -17
- package/dist/runtime/mcpi-runtime.d.ts +7 -0
- package/dist/runtime/mcpi-runtime.js +6 -0
- package/dist/runtime/proof.d.ts +1 -0
- package/dist/runtime/proof.js +2 -1
- package/dist/runtime/session.d.ts +6 -0
- package/dist/runtime/session.js +8 -0
- package/dist/runtime/stdio.js +1 -1
- package/dist/runtime/utils/tools.js +4 -2
- package/dist/runtime/verifier-middleware.js +50 -32
- package/package.json +10 -5
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
/**
|
|
3
|
-
* Identity
|
|
3
|
+
* Compiler Identity Configuration Schema
|
|
4
|
+
*
|
|
5
|
+
* Schema for identity configuration in xmcp.config.ts files.
|
|
6
|
+
* Used by the compiler to generate runtime config.
|
|
7
|
+
*/
|
|
8
|
+
export declare const compilerIdentityConfigSchema: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
enabled: z.ZodBoolean;
|
|
10
|
+
environment: z.ZodOptional<z.ZodEnum<["development", "production"]>>;
|
|
11
|
+
devIdentityPath: z.ZodOptional<z.ZodString>;
|
|
12
|
+
privacyMode: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
debug: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
debug?: boolean | undefined;
|
|
17
|
+
environment?: "development" | "production" | undefined;
|
|
18
|
+
devIdentityPath?: string | undefined;
|
|
19
|
+
privacyMode?: boolean | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
debug?: boolean | undefined;
|
|
23
|
+
environment?: "development" | "production" | undefined;
|
|
24
|
+
devIdentityPath?: string | undefined;
|
|
25
|
+
privacyMode?: boolean | undefined;
|
|
26
|
+
}>>;
|
|
27
|
+
export type CompilerIdentityConfig = z.infer<typeof compilerIdentityConfigSchema>;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use CompilerIdentityConfig instead
|
|
30
|
+
* This export is maintained for backward compatibility
|
|
4
31
|
*/
|
|
5
32
|
export declare const identityConfigSchema: z.ZodOptional<z.ZodObject<{
|
|
6
33
|
enabled: z.ZodBoolean;
|
|
@@ -21,4 +48,4 @@ export declare const identityConfigSchema: z.ZodOptional<z.ZodObject<{
|
|
|
21
48
|
devIdentityPath?: string | undefined;
|
|
22
49
|
privacyMode?: boolean | undefined;
|
|
23
50
|
}>>;
|
|
24
|
-
export type IdentityConfig =
|
|
51
|
+
export type IdentityConfig = CompilerIdentityConfig;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.identityConfigSchema = void 0;
|
|
3
|
+
exports.identityConfigSchema = exports.compilerIdentityConfigSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
/**
|
|
6
|
-
* Identity
|
|
6
|
+
* Compiler Identity Configuration Schema
|
|
7
|
+
*
|
|
8
|
+
* Schema for identity configuration in xmcp.config.ts files.
|
|
9
|
+
* Used by the compiler to generate runtime config.
|
|
7
10
|
*/
|
|
8
|
-
exports.
|
|
11
|
+
exports.compilerIdentityConfigSchema = zod_1.z
|
|
9
12
|
.object({
|
|
10
13
|
enabled: zod_1.z.boolean().describe("Enable MCP-I identity layer"),
|
|
11
14
|
environment: zod_1.z
|
|
@@ -20,3 +23,8 @@ exports.identityConfigSchema = zod_1.z
|
|
|
20
23
|
debug: zod_1.z.boolean().optional().describe("Enable debug logging for identity"),
|
|
21
24
|
})
|
|
22
25
|
.optional();
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use CompilerIdentityConfig instead
|
|
28
|
+
* This export is maintained for backward compatibility
|
|
29
|
+
*/
|
|
30
|
+
exports.identityConfigSchema = exports.compilerIdentityConfigSchema;
|
|
@@ -39,11 +39,14 @@ function getExternals() {
|
|
|
39
39
|
'@swc/core-darwin-x64',
|
|
40
40
|
'@swc/core-linux-arm64-gnu',
|
|
41
41
|
'@swc/core-linux-arm64-musl',
|
|
42
|
+
'@swc/core-linux-arm-gnueabihf',
|
|
42
43
|
'@swc/core-linux-x64-gnu',
|
|
43
44
|
'@swc/core-linux-x64-musl',
|
|
44
45
|
'@swc/core-win32-arm64-msvc',
|
|
45
46
|
'@swc/core-win32-ia32-msvc',
|
|
46
47
|
'@swc/core-win32-x64-msvc',
|
|
48
|
+
'@swc/core-android-arm64',
|
|
49
|
+
'@swc/core-android-arm-eabi',
|
|
47
50
|
];
|
|
48
51
|
if (nativeBinaryPackages.some(pkg => request === pkg || request.startsWith(`${pkg}/`))) {
|
|
49
52
|
return callback(null, `commonjs ${request}`);
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js Runtime Configuration
|
|
3
|
+
*
|
|
4
|
+
* Platform-specific configuration for MCP-I running on Node.js.
|
|
5
|
+
* Extends the base MCP-I configuration with Node-specific runtime concerns.
|
|
6
|
+
*
|
|
7
|
+
* @module @kya-os/mcp-i/config
|
|
8
|
+
*/
|
|
9
|
+
import type { MCPIConfig, ToolProtectionSourceConfig } from '@kya-os/contracts/config';
|
|
10
|
+
/**
|
|
11
|
+
* Node.js-specific runtime configuration
|
|
12
|
+
* Extends MCPIConfig with Node.js platform concerns
|
|
13
|
+
*/
|
|
14
|
+
export interface NodeRuntimeConfig extends MCPIConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Node.js-specific server configuration
|
|
17
|
+
*/
|
|
18
|
+
server?: {
|
|
19
|
+
/**
|
|
20
|
+
* Port to listen on
|
|
21
|
+
* @default 3000
|
|
22
|
+
*/
|
|
23
|
+
port?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Host to bind to
|
|
26
|
+
* @default '0.0.0.0'
|
|
27
|
+
*/
|
|
28
|
+
host?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Enable CORS
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
cors?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Request timeout in milliseconds
|
|
36
|
+
* @default 30000
|
|
37
|
+
*/
|
|
38
|
+
timeout?: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Storage configuration for Node.js
|
|
42
|
+
*/
|
|
43
|
+
storage?: {
|
|
44
|
+
/**
|
|
45
|
+
* Storage type
|
|
46
|
+
*/
|
|
47
|
+
type: 'memory' | 'redis' | 'postgres' | 'mongodb';
|
|
48
|
+
/**
|
|
49
|
+
* Connection options
|
|
50
|
+
*/
|
|
51
|
+
connection?: {
|
|
52
|
+
url?: string;
|
|
53
|
+
host?: string;
|
|
54
|
+
port?: number;
|
|
55
|
+
database?: string;
|
|
56
|
+
username?: string;
|
|
57
|
+
password?: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Tool protection configuration
|
|
62
|
+
* Node.js can use all source types including file-based
|
|
63
|
+
*/
|
|
64
|
+
toolProtection?: ToolProtectionSourceConfig;
|
|
65
|
+
/**
|
|
66
|
+
* Node.js-specific environment configuration
|
|
67
|
+
*/
|
|
68
|
+
nodeEnv?: {
|
|
69
|
+
/**
|
|
70
|
+
* Node environment (development, production, test)
|
|
71
|
+
* @default process.env.NODE_ENV || 'development'
|
|
72
|
+
*/
|
|
73
|
+
environment?: 'development' | 'production' | 'test';
|
|
74
|
+
/**
|
|
75
|
+
* Enable Node.js-specific debug logging
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
debug?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Custom environment variables prefix
|
|
81
|
+
* @default 'MCPI_'
|
|
82
|
+
*/
|
|
83
|
+
envPrefix?: string;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Node.js build-time configuration
|
|
88
|
+
* Used by the builder to configure compiled MCP-I servers
|
|
89
|
+
*/
|
|
90
|
+
export interface NodeBuildConfig {
|
|
91
|
+
/**
|
|
92
|
+
* Output directory for build artifacts
|
|
93
|
+
* @default 'dist'
|
|
94
|
+
*/
|
|
95
|
+
outputDir?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Enable source maps
|
|
98
|
+
* @default true in development, false in production
|
|
99
|
+
*/
|
|
100
|
+
sourceMaps?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Bundle external dependencies
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
bundleDependencies?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Tool registry configuration (for compiled bundles)
|
|
108
|
+
*/
|
|
109
|
+
toolRegistry?: {
|
|
110
|
+
/**
|
|
111
|
+
* Include tool registry in bundle
|
|
112
|
+
* @default true
|
|
113
|
+
*/
|
|
114
|
+
include?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Path to tool registry file
|
|
117
|
+
* @default './tool-registry.json'
|
|
118
|
+
*/
|
|
119
|
+
path?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Generate types for tool registry
|
|
122
|
+
* @default true
|
|
123
|
+
*/
|
|
124
|
+
generateTypes?: boolean;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Optimization settings
|
|
128
|
+
*/
|
|
129
|
+
optimization?: {
|
|
130
|
+
/**
|
|
131
|
+
* Minify code
|
|
132
|
+
* @default true in production
|
|
133
|
+
*/
|
|
134
|
+
minify?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Tree-shake unused code
|
|
137
|
+
* @default true
|
|
138
|
+
*/
|
|
139
|
+
treeShaking?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Target Node.js version
|
|
142
|
+
* @default 'node18'
|
|
143
|
+
*/
|
|
144
|
+
target?: string;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Complete Node.js configuration
|
|
149
|
+
* Combines runtime and build configurations
|
|
150
|
+
*/
|
|
151
|
+
export interface NodeConfig {
|
|
152
|
+
runtime?: NodeRuntimeConfig;
|
|
153
|
+
build?: NodeBuildConfig;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Re-export base types for convenience with aliases to avoid conflicts
|
|
157
|
+
*/
|
|
158
|
+
export type { MCPIConfig, MCPIBaseConfig, RuntimeIdentityConfig as BaseIdentityConfig, ProofingConfig, DelegationConfig, ToolProtectionSourceConfig } from '@kya-os/contracts/config';
|
|
159
|
+
/**
|
|
160
|
+
* Default Node.js runtime configuration
|
|
161
|
+
*/
|
|
162
|
+
export declare const defaultNodeRuntimeConfig: NodeRuntimeConfig;
|
|
163
|
+
/**
|
|
164
|
+
* Default Node.js build configuration
|
|
165
|
+
*/
|
|
166
|
+
export declare const defaultNodeBuildConfig: NodeBuildConfig;
|
|
167
|
+
/**
|
|
168
|
+
* Create a Node.js runtime configuration with defaults
|
|
169
|
+
*/
|
|
170
|
+
export declare function createNodeRuntimeConfig(config?: Partial<NodeRuntimeConfig>): NodeRuntimeConfig;
|
|
171
|
+
/**
|
|
172
|
+
* Create a Node.js build configuration with defaults
|
|
173
|
+
*/
|
|
174
|
+
export declare function createNodeBuildConfig(config?: Partial<NodeBuildConfig>): NodeBuildConfig;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Node.js Runtime Configuration
|
|
4
|
+
*
|
|
5
|
+
* Platform-specific configuration for MCP-I running on Node.js.
|
|
6
|
+
* Extends the base MCP-I configuration with Node-specific runtime concerns.
|
|
7
|
+
*
|
|
8
|
+
* @module @kya-os/mcp-i/config
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.defaultNodeBuildConfig = exports.defaultNodeRuntimeConfig = void 0;
|
|
12
|
+
exports.createNodeRuntimeConfig = createNodeRuntimeConfig;
|
|
13
|
+
exports.createNodeBuildConfig = createNodeBuildConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Default Node.js runtime configuration
|
|
16
|
+
*/
|
|
17
|
+
exports.defaultNodeRuntimeConfig = {
|
|
18
|
+
environment: 'development',
|
|
19
|
+
server: {
|
|
20
|
+
port: 3000,
|
|
21
|
+
host: '0.0.0.0',
|
|
22
|
+
cors: true,
|
|
23
|
+
timeout: 30000
|
|
24
|
+
},
|
|
25
|
+
storage: {
|
|
26
|
+
type: 'memory'
|
|
27
|
+
},
|
|
28
|
+
nodeEnv: {
|
|
29
|
+
environment: 'development',
|
|
30
|
+
debug: false,
|
|
31
|
+
envPrefix: 'MCPI_'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Default Node.js build configuration
|
|
36
|
+
*/
|
|
37
|
+
exports.defaultNodeBuildConfig = {
|
|
38
|
+
outputDir: 'dist',
|
|
39
|
+
sourceMaps: true,
|
|
40
|
+
bundleDependencies: false,
|
|
41
|
+
toolRegistry: {
|
|
42
|
+
include: true,
|
|
43
|
+
path: './tool-registry.json',
|
|
44
|
+
generateTypes: true
|
|
45
|
+
},
|
|
46
|
+
optimization: {
|
|
47
|
+
minify: false,
|
|
48
|
+
treeShaking: true,
|
|
49
|
+
target: 'node18'
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Create a Node.js runtime configuration with defaults
|
|
54
|
+
*/
|
|
55
|
+
function createNodeRuntimeConfig(config) {
|
|
56
|
+
return {
|
|
57
|
+
...exports.defaultNodeRuntimeConfig,
|
|
58
|
+
...config,
|
|
59
|
+
server: {
|
|
60
|
+
...exports.defaultNodeRuntimeConfig.server,
|
|
61
|
+
...config?.server
|
|
62
|
+
},
|
|
63
|
+
storage: config?.storage ? {
|
|
64
|
+
...exports.defaultNodeRuntimeConfig.storage,
|
|
65
|
+
...config.storage
|
|
66
|
+
} : exports.defaultNodeRuntimeConfig.storage,
|
|
67
|
+
nodeEnv: {
|
|
68
|
+
...exports.defaultNodeRuntimeConfig.nodeEnv,
|
|
69
|
+
...config?.nodeEnv
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create a Node.js build configuration with defaults
|
|
75
|
+
*/
|
|
76
|
+
function createNodeBuildConfig(config) {
|
|
77
|
+
return {
|
|
78
|
+
...exports.defaultNodeBuildConfig,
|
|
79
|
+
...config,
|
|
80
|
+
toolRegistry: {
|
|
81
|
+
...exports.defaultNodeBuildConfig.toolRegistry,
|
|
82
|
+
...config?.toolRegistry
|
|
83
|
+
},
|
|
84
|
+
optimization: {
|
|
85
|
+
...exports.defaultNodeBuildConfig.optimization,
|
|
86
|
+
...config?.optimization
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -38,3 +38,5 @@ var index_1 = require("./compiler/index");
|
|
|
38
38
|
Object.defineProperty(exports, "compile", { enumerable: true, get: function () { return index_1.compile; } });
|
|
39
39
|
// CLI adapter for identity setup (matches alpha behavior)
|
|
40
40
|
__exportStar(require("./cli-adapter"), exports);
|
|
41
|
+
// Configuration types and utilities
|
|
42
|
+
__exportStar(require("./config"), exports);
|