@kya-os/mcp-i 0.1.0-alpha.2.1 → 0.1.0-alpha.2.3

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 (44) hide show
  1. package/README.md +271 -47
  2. package/dist/index.d.ts +63 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +298 -55
  5. package/dist/index.js.map +1 -1
  6. package/dist/registry/cursor.d.ts +25 -0
  7. package/dist/registry/cursor.d.ts.map +1 -0
  8. package/dist/registry/cursor.js +108 -0
  9. package/dist/registry/cursor.js.map +1 -0
  10. package/dist/registry/glama.d.ts +25 -0
  11. package/dist/registry/glama.d.ts.map +1 -0
  12. package/dist/registry/glama.js +111 -0
  13. package/dist/registry/glama.js.map +1 -0
  14. package/dist/registry/index.d.ts +43 -0
  15. package/dist/registry/index.d.ts.map +1 -0
  16. package/dist/registry/index.js +96 -0
  17. package/dist/registry/index.js.map +1 -0
  18. package/dist/registry/knowthat.d.ts +28 -0
  19. package/dist/registry/knowthat.d.ts.map +1 -0
  20. package/dist/registry/knowthat.js +113 -0
  21. package/dist/registry/knowthat.js.map +1 -0
  22. package/dist/registry/smithery.d.ts +29 -0
  23. package/dist/registry/smithery.d.ts.map +1 -0
  24. package/dist/registry/smithery.js +119 -0
  25. package/dist/registry/smithery.js.map +1 -0
  26. package/dist/types.d.ts +91 -1
  27. package/dist/types.d.ts.map +1 -1
  28. package/package.json +22 -4
  29. package/dist/auto-enhance.d.ts +0 -41
  30. package/dist/auto-enhance.d.ts.map +0 -1
  31. package/dist/auto-enhance.js +0 -193
  32. package/dist/auto-enhance.js.map +0 -1
  33. package/dist/auto-init.d.ts +0 -12
  34. package/dist/auto-init.d.ts.map +0 -1
  35. package/dist/auto-init.js +0 -166
  36. package/dist/auto-init.js.map +0 -1
  37. package/dist/patch.d.ts +0 -22
  38. package/dist/patch.d.ts.map +0 -1
  39. package/dist/patch.js +0 -164
  40. package/dist/patch.js.map +0 -1
  41. package/dist/transparent.d.ts +0 -40
  42. package/dist/transparent.d.ts.map +0 -1
  43. package/dist/transparent.js +0 -167
  44. package/dist/transparent.js.map +0 -1
package/dist/types.d.ts CHANGED
@@ -1,6 +1,21 @@
1
1
  /**
2
2
  * Type definitions for MCP-I challenge-response authentication
3
3
  */
4
+ /**
5
+ * Registry configuration and tier definitions
6
+ */
7
+ export type RegistryTier = 'verified' | 'experimental' | 'enterprise' | 'all';
8
+ /**
9
+ * Registry names - currently only 'knowthat' is supported.
10
+ * Additional registries will be added as directories adopt MCP-I.
11
+ */
12
+ export type RegistryName = 'knowthat' | string;
13
+ export interface RegistryConfig {
14
+ /** Include specific registries or a tier */
15
+ include?: RegistryName[] | RegistryTier;
16
+ /** Exclude specific registries */
17
+ exclude?: RegistryName[];
18
+ }
4
19
  export interface MCPIdentityOptions {
5
20
  name?: string;
6
21
  description?: string;
@@ -9,7 +24,16 @@ export interface MCPIdentityOptions {
9
24
  persistencePath?: string;
10
25
  timestampTolerance?: number;
11
26
  enableNonceTracking?: boolean;
12
- forceNew?: boolean;
27
+ registries?: RegistryName[] | RegistryTier | RegistryConfig;
28
+ /** Primary DID host (default: 'knowthat') */
29
+ didHost?: string;
30
+ /**
31
+ * Development vs Production mode
32
+ * - 'development': Creates draft DID that expires after 30 days
33
+ * - 'production': Creates permanent DID (requires proof of usage)
34
+ * @default 'production'
35
+ */
36
+ mode?: 'development' | 'production';
13
37
  }
14
38
  export interface AutoRegisterResponse {
15
39
  success: boolean;
@@ -32,6 +56,68 @@ export interface PersistedIdentity {
32
56
  agentId: string;
33
57
  agentSlug: string;
34
58
  registeredAt: string;
59
+ /** Primary DID host registry */
60
+ didHost?: string;
61
+ /** List of registries where this agent is published */
62
+ registries?: RegistryStatus[];
63
+ }
64
+ /**
65
+ * Registry-specific status information
66
+ */
67
+ export interface RegistryStatus {
68
+ /** Registry name */
69
+ name: string;
70
+ /** Registration status */
71
+ status: 'active' | 'pending' | 'failed' | 'revoked';
72
+ /** When registered with this registry */
73
+ registeredAt?: string;
74
+ /** Last sync attempt */
75
+ lastSyncAt?: string;
76
+ /** Registry type */
77
+ type: 'primary' | 'secondary';
78
+ /** Error message if failed */
79
+ error?: string;
80
+ /** Registry-specific agent ID */
81
+ registryAgentId?: string;
82
+ }
83
+ /**
84
+ * Registry adapter interface
85
+ */
86
+ export interface RegistryAdapter {
87
+ /** Registry name */
88
+ name: string;
89
+ /** Registry type - primary can host DIDs, secondary only references */
90
+ type: 'primary' | 'secondary';
91
+ /** Publish agent to this registry */
92
+ publish(data: RegistryPublishData): Promise<RegistryPublishResult>;
93
+ /** Verify agent exists in registry */
94
+ verify?(did: string): Promise<boolean>;
95
+ /** Remove agent from registry */
96
+ unpublish?(did: string): Promise<void>;
97
+ /** Get registry-specific status */
98
+ getStatus?(did: string): Promise<RegistryStatus>;
99
+ }
100
+ /**
101
+ * Data needed to publish to a registry
102
+ */
103
+ export interface RegistryPublishData {
104
+ did: string;
105
+ name: string;
106
+ description?: string;
107
+ repository?: string;
108
+ publicKey: string;
109
+ agentId?: string;
110
+ agentSlug?: string;
111
+ metadata?: Record<string, any>;
112
+ }
113
+ /**
114
+ * Result from registry publication
115
+ */
116
+ export interface RegistryPublishResult {
117
+ success: boolean;
118
+ registryAgentId?: string;
119
+ profileUrl?: string;
120
+ error?: string;
35
121
  }
36
122
  /**
37
123
  * MCP-I Challenge structure
@@ -63,6 +149,10 @@ export interface MCPICapabilities {
63
149
  handshakeSupported: boolean;
64
150
  handshakeEndpoint?: string;
65
151
  verificationEndpoint?: string;
152
+ registries?: {
153
+ primary: string;
154
+ secondary: string[];
155
+ };
66
156
  }
67
157
  /**
68
158
  * Response with MCP-I identity attached
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACr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AM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAG9B,UAAU,CAAC,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,GAAG;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,aAAa,EAAE;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kya-os/mcp-i",
3
- "version": "0.1.0-alpha.2.1",
4
- "description": "Ultra-light MCP Identity auto-registration - 2 lines to agent identity",
3
+ "version": "0.1.0-alpha.2.3",
4
+ "description": "Give your MCP server cryptographic identity in 2 lines of code",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -14,6 +14,11 @@
14
14
  "types": "./dist/auto.d.ts",
15
15
  "import": "./dist/auto.js",
16
16
  "require": "./dist/auto.js"
17
+ },
18
+ "./registry": {
19
+ "types": "./dist/registry/index.d.ts",
20
+ "import": "./dist/registry/index.js",
21
+ "require": "./dist/registry/index.js"
17
22
  }
18
23
  },
19
24
  "files": [
@@ -31,11 +36,24 @@
31
36
  "keywords": [
32
37
  "mcp",
33
38
  "mcp-i",
39
+ "model-context-protocol",
34
40
  "identity",
35
41
  "agent",
36
- "auto-registration",
37
- "did"
42
+ "ai-agent",
43
+ "cryptographic-identity",
44
+ "did",
45
+ "decentralized-identity",
46
+ "authentication",
47
+ "ed25519"
38
48
  ],
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "https://github.com/kya-os/mcp-i.git"
52
+ },
53
+ "bugs": {
54
+ "url": "https://github.com/kya-os/mcp-i/issues"
55
+ },
56
+ "homepage": "https://github.com/kya-os/mcp-i#readme",
39
57
  "author": "Dylan Hobbs <dylan@vouched.id>",
40
58
  "license": "MIT",
41
59
  "dependencies": {
@@ -1,41 +0,0 @@
1
- /**
2
- * Auto-enhancement module for transparent MCP-I integration
3
- *
4
- * This module automatically wraps MCP server instances to add identity
5
- * without requiring any code changes or type modifications.
6
- */
7
- import { MCPIdentity } from './index';
8
- /**
9
- * Internal type for MCP server instance
10
- */
11
- interface MCPServerLike {
12
- setRequestHandler?: (schema: any, handler: Function) => void;
13
- tool?: (name: string, schema: any, handler: Function) => void;
14
- resource?: (name: string, template: any, handler: Function) => void;
15
- prompt?: (name: string, schema: any, handler: Function) => void;
16
- _mcpIdentityEnhanced?: boolean;
17
- }
18
- /**
19
- * Enhance an MCP server instance with automatic identity
20
- */
21
- export declare function enhanceMCPServer(server: MCPServerLike): Promise<MCPServerLike>;
22
- /**
23
- * Proxy constructor for automatic enhancement
24
- */
25
- export declare function createMCPServerProxy(ServerClass: any): any;
26
- /**
27
- * Module loader hook for automatic enhancement
28
- * This can be used with Node.js --loader flag
29
- */
30
- export declare function resolve(specifier: string, context: any, defaultResolve: Function): Promise<any>;
31
- export declare function load(url: string, context: any, defaultLoad: Function): Promise<any>;
32
- /**
33
- * Get the current identity instance
34
- */
35
- export declare function getCurrentIdentity(): MCPIdentity | null;
36
- /**
37
- * Initialize identity explicitly (optional)
38
- */
39
- export declare function initializeIdentity(options?: any): Promise<MCPIdentity>;
40
- export {};
41
- //# sourceMappingURL=auto-enhance.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-enhance.d.ts","sourceRoot":"","sources":["../src/auto-enhance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAMtC;;GAEG;AACH,UAAU,aAAa;IACrB,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC7D,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC9D,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;IACpE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;IAChE,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAmDD;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAmDpF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,GAAG,GAAG,GAAG,CAW1D;AAED;;;GAGG;AACH,wBAAsB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,QAAQ,gBAEtF;AAED,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,gBAmD1E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,GAAG,IAAI,CAEvD;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAK5E"}
@@ -1,193 +0,0 @@
1
- "use strict";
2
- /**
3
- * Auto-enhancement module for transparent MCP-I integration
4
- *
5
- * This module automatically wraps MCP server instances to add identity
6
- * without requiring any code changes or type modifications.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.enhanceMCPServer = enhanceMCPServer;
10
- exports.createMCPServerProxy = createMCPServerProxy;
11
- exports.resolve = resolve;
12
- exports.load = load;
13
- exports.getCurrentIdentity = getCurrentIdentity;
14
- exports.initializeIdentity = initializeIdentity;
15
- const index_1 = require("./index");
16
- // Store the singleton identity instance
17
- let globalIdentity = null;
18
- /**
19
- * Wrap a response handler to automatically add MCP-I identity
20
- */
21
- function wrapHandler(originalHandler, identity) {
22
- return async function (...args) {
23
- // Call the original handler
24
- const response = await originalHandler.apply(this, args);
25
- // If response is null/undefined, return as-is
26
- if (!response)
27
- return response;
28
- // Add identity metadata without changing the response structure
29
- // We use Object.defineProperty to make it non-enumerable
30
- Object.defineProperty(response, '_mcp_identity', {
31
- value: {
32
- did: identity.did,
33
- signature: '', // Will be filled below
34
- timestamp: new Date().toISOString(),
35
- conformanceLevel: 2
36
- },
37
- writable: true,
38
- enumerable: false, // Hidden from JSON.stringify by default
39
- configurable: true
40
- });
41
- // Sign the response content
42
- const contentToSign = JSON.stringify({
43
- ...response,
44
- _mcp_identity: {
45
- did: identity.did,
46
- timestamp: response._mcp_identity.timestamp,
47
- conformanceLevel: 2
48
- }
49
- });
50
- response._mcp_identity.signature = await identity.sign(contentToSign);
51
- // Override toJSON to include _mcp_identity when serializing
52
- const originalToJSON = response.toJSON;
53
- response.toJSON = function () {
54
- const result = originalToJSON ? originalToJSON.call(this) : { ...this };
55
- result._mcp_identity = response._mcp_identity;
56
- return result;
57
- };
58
- return response;
59
- };
60
- }
61
- /**
62
- * Enhance an MCP server instance with automatic identity
63
- */
64
- async function enhanceMCPServer(server) {
65
- // Skip if already enhanced
66
- if (server._mcpIdentityEnhanced) {
67
- return server;
68
- }
69
- // Initialize identity if not already done
70
- if (!globalIdentity) {
71
- globalIdentity = await index_1.MCPIdentity.init();
72
- }
73
- // Wrap setRequestHandler if it exists
74
- if (server.setRequestHandler) {
75
- const originalSetRequestHandler = server.setRequestHandler.bind(server);
76
- server.setRequestHandler = function (schema, handler) {
77
- const wrappedHandler = wrapHandler(handler, globalIdentity);
78
- return originalSetRequestHandler(schema, wrappedHandler);
79
- };
80
- }
81
- // Wrap tool method if it exists
82
- if (server.tool) {
83
- const originalTool = server.tool.bind(server);
84
- server.tool = function (name, schema, handler) {
85
- const wrappedHandler = wrapHandler(handler, globalIdentity);
86
- return originalTool(name, schema, wrappedHandler);
87
- };
88
- }
89
- // Wrap resource method if it exists
90
- if (server.resource) {
91
- const originalResource = server.resource.bind(server);
92
- server.resource = function (name, template, handler) {
93
- const wrappedHandler = wrapHandler(handler, globalIdentity);
94
- return originalResource(name, template, wrappedHandler);
95
- };
96
- }
97
- // Wrap prompt method if it exists
98
- if (server.prompt) {
99
- const originalPrompt = server.prompt.bind(server);
100
- server.prompt = function (name, schema, handler) {
101
- const wrappedHandler = wrapHandler(handler, globalIdentity);
102
- return originalPrompt(name, schema, wrappedHandler);
103
- };
104
- }
105
- // Mark as enhanced
106
- server._mcpIdentityEnhanced = true;
107
- return server;
108
- }
109
- /**
110
- * Proxy constructor for automatic enhancement
111
- */
112
- function createMCPServerProxy(ServerClass) {
113
- return new Proxy(ServerClass, {
114
- construct(target, args) {
115
- const instance = new target(...args);
116
- // Enhance asynchronously after construction
117
- setImmediate(async () => {
118
- await enhanceMCPServer(instance);
119
- });
120
- return instance;
121
- }
122
- });
123
- }
124
- /**
125
- * Module loader hook for automatic enhancement
126
- * This can be used with Node.js --loader flag
127
- */
128
- async function resolve(specifier, context, defaultResolve) {
129
- return defaultResolve(specifier, context);
130
- }
131
- async function load(url, context, defaultLoad) {
132
- const result = await defaultLoad(url, context);
133
- // Only process TypeScript/JavaScript files
134
- if (!result.source || (!url.endsWith('.js') && !url.endsWith('.ts') && !url.endsWith('.mjs'))) {
135
- return result;
136
- }
137
- const source = result.source.toString();
138
- // Check if this imports MCP SDK
139
- if (source.includes('@modelcontextprotocol/sdk')) {
140
- // Inject our enhancement code
141
- const enhancedSource = `
142
- import { enhanceMCPServer } from '@kya-os/mcp-i/auto-enhance';
143
-
144
- // Auto-enhance any Server or McpServer instances
145
- const originalCode = ${JSON.stringify(source)};
146
- const moduleExports = await import('data:text/javascript;base64,' + btoa(originalCode));
147
-
148
- // Wrap server constructors
149
- if (moduleExports.Server) {
150
- const OriginalServer = moduleExports.Server;
151
- moduleExports.Server = class extends OriginalServer {
152
- constructor(...args) {
153
- super(...args);
154
- setImmediate(() => enhanceMCPServer(this));
155
- }
156
- };
157
- }
158
-
159
- if (moduleExports.McpServer) {
160
- const OriginalMcpServer = moduleExports.McpServer;
161
- moduleExports.McpServer = class extends OriginalMcpServer {
162
- constructor(...args) {
163
- super(...args);
164
- setImmediate(() => enhanceMCPServer(this));
165
- }
166
- };
167
- }
168
-
169
- export * from moduleExports;
170
- `;
171
- return {
172
- ...result,
173
- source: enhancedSource
174
- };
175
- }
176
- return result;
177
- }
178
- /**
179
- * Get the current identity instance
180
- */
181
- function getCurrentIdentity() {
182
- return globalIdentity;
183
- }
184
- /**
185
- * Initialize identity explicitly (optional)
186
- */
187
- async function initializeIdentity(options) {
188
- if (!globalIdentity) {
189
- globalIdentity = await index_1.MCPIdentity.init(options);
190
- }
191
- return globalIdentity;
192
- }
193
- //# sourceMappingURL=auto-enhance.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-enhance.js","sourceRoot":"","sources":["../src/auto-enhance.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAuEH,4CAmDC;AAKD,oDAWC;AAMD,0BAEC;AAED,oBAmDC;AAKD,gDAEC;AAKD,gDAKC;AAtND,mCA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OAAO,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAEM,KAAK,UAAU,IAAI,CAAC,GAAW,EAAE,OAAY,EAAE,WAAqB;IACzE,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAE/C,2CAA2C;IAC3C,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QAC9F,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IAExC,gCAAgC;IAChC,IAAI,MAAM,CAAC,QAAQ,CAAC,2BAA2B,CAAC,EAAE,CAAC;QACjD,8BAA8B;QAC9B,MAAM,cAAc,GAAG;;;;uBAIJ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CAyB5C,CAAC;QAEE,OAAO;YACL,GAAG,MAAM;YACT,MAAM,EAAE,cAAc;SACvB,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB;IAChC,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,kBAAkB,CAAC,OAAa;IACpD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,cAAc,GAAG,MAAM,mBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Auto-initialization module for @kya-os/mcp-i
3
- *
4
- * This file provides automatic enhancement of MCP servers when imported.
5
- * Just add: import '@kya-os/mcp-i/auto-init'
6
- */
7
- /**
8
- * Initialize auto-enhancement
9
- */
10
- declare function initialize(): Promise<void>;
11
- export { initialize as initializeMCPIdentity };
12
- //# sourceMappingURL=auto-init.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-init.d.ts","sourceRoot":"","sources":["../src/auto-init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiHH;;GAEG;AACH,iBAAe,UAAU,kBAqBxB;AAMD,OAAO,EAAE,UAAU,IAAI,qBAAqB,EAAE,CAAC"}
package/dist/auto-init.js DELETED
@@ -1,166 +0,0 @@
1
- "use strict";
2
- /**
3
- * Auto-initialization module for @kya-os/mcp-i
4
- *
5
- * This file provides automatic enhancement of MCP servers when imported.
6
- * Just add: import '@kya-os/mcp-i/auto-init'
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.initializeMCPIdentity = initialize;
43
- const auto_enhance_1 = require("./auto-enhance");
44
- // Track if we've already hooked into the module system
45
- let isInitialized = false;
46
- /**
47
- * Hook into CommonJS require to automatically enhance MCP servers
48
- */
49
- function hookRequire() {
50
- const Module = require('module');
51
- const originalRequire = Module.prototype.require;
52
- Module.prototype.require = function (id) {
53
- const exports = originalRequire.apply(this, arguments);
54
- // Check if this is an MCP SDK module
55
- if (id === '@modelcontextprotocol/sdk' ||
56
- id === '@modelcontextprotocol/sdk/server' ||
57
- id === '@modelcontextprotocol/sdk/server/index.js' ||
58
- id === '@modelcontextprotocol/sdk/server/mcp.js') {
59
- // Wrap Server constructor if it exists
60
- if (exports.Server && !exports.Server._mcpIdentityWrapped) {
61
- const OriginalServer = exports.Server;
62
- exports.Server = class extends OriginalServer {
63
- constructor(...args) {
64
- super(...args);
65
- // Enhance after construction
66
- setImmediate(async () => {
67
- await (0, auto_enhance_1.enhanceMCPServer)(this);
68
- });
69
- }
70
- };
71
- exports.Server._mcpIdentityWrapped = true;
72
- }
73
- // Wrap McpServer constructor if it exists
74
- if (exports.McpServer && !exports.McpServer._mcpIdentityWrapped) {
75
- const OriginalMcpServer = exports.McpServer;
76
- exports.McpServer = class extends OriginalMcpServer {
77
- constructor(...args) {
78
- super(...args);
79
- // Enhance after construction
80
- setImmediate(async () => {
81
- await (0, auto_enhance_1.enhanceMCPServer)(this);
82
- });
83
- }
84
- };
85
- exports.McpServer._mcpIdentityWrapped = true;
86
- }
87
- }
88
- return exports;
89
- };
90
- }
91
- /**
92
- * Hook into ES module imports
93
- */
94
- async function hookESModules() {
95
- // This requires Node.js experimental loader API
96
- // Users would need to run with: node --loader @kya-os/mcp-i/loader
97
- // For now, we'll use a different approach - monkey-patching the global
98
- if (typeof globalThis !== 'undefined') {
99
- // Store original import
100
- const globalAny = globalThis;
101
- const originalImport = globalAny.import || (async (id) => Promise.resolve(`${id}`).then(s => __importStar(require(s))));
102
- // Override dynamic import
103
- globalAny.import = async function (id) {
104
- const module = await originalImport(id);
105
- // Check if this is an MCP SDK module
106
- if (id === '@modelcontextprotocol/sdk' ||
107
- id === '@modelcontextprotocol/sdk/server' ||
108
- id.includes('@modelcontextprotocol/sdk')) {
109
- // Wrap constructors
110
- if (module.Server && !module.Server._mcpIdentityWrapped) {
111
- const OriginalServer = module.Server;
112
- module.Server = class extends OriginalServer {
113
- constructor(...args) {
114
- super(...args);
115
- setImmediate(async () => {
116
- await (0, auto_enhance_1.enhanceMCPServer)(this);
117
- });
118
- }
119
- };
120
- module.Server._mcpIdentityWrapped = true;
121
- }
122
- if (module.McpServer && !module.McpServer._mcpIdentityWrapped) {
123
- const OriginalMcpServer = module.McpServer;
124
- module.McpServer = class extends OriginalMcpServer {
125
- constructor(...args) {
126
- super(...args);
127
- setImmediate(async () => {
128
- await (0, auto_enhance_1.enhanceMCPServer)(this);
129
- });
130
- }
131
- };
132
- module.McpServer._mcpIdentityWrapped = true;
133
- }
134
- }
135
- return module;
136
- };
137
- }
138
- }
139
- /**
140
- * Initialize auto-enhancement
141
- */
142
- async function initialize() {
143
- if (isInitialized)
144
- return;
145
- isInitialized = true;
146
- // Initialize identity immediately
147
- (0, auto_enhance_1.initializeIdentity)().catch(err => {
148
- console.error('[MCP-I] Failed to initialize identity:', err.message);
149
- });
150
- // Hook into module loading systems
151
- try {
152
- hookRequire();
153
- }
154
- catch (err) {
155
- // CommonJS might not be available
156
- }
157
- try {
158
- await hookESModules();
159
- }
160
- catch (err) {
161
- // ES modules hooks might fail
162
- }
163
- }
164
- // Auto-initialize when this module is imported
165
- initialize();
166
- //# sourceMappingURL=auto-init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-init.js","sourceRoot":"","sources":["../src/auto-init.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+I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,EAAE,CAAC"}
package/dist/patch.d.ts DELETED
@@ -1,22 +0,0 @@
1
- /**
2
- * Monkey-patch approach for zero-code integration
3
- *
4
- * This can be loaded before any MCP server code to automatically
5
- * add identity to all servers without any code changes.
6
- *
7
- * Usage: node -r @kya-os/mcp-i/patch your-server.js
8
- */
9
- /**
10
- * Wrap a response to add identity without changing its type
11
- */
12
- declare function addIdentityToResponse(response: any): Promise<any>;
13
- /**
14
- * Wrap a handler function to add identity to its responses
15
- */
16
- declare function wrapHandler(handler: Function): Function;
17
- /**
18
- * Patch a server instance to wrap all its handler methods
19
- */
20
- declare function patchServerInstance(instance: any): any;
21
- export { addIdentityToResponse, wrapHandler, patchServerInstance };
22
- //# sourceMappingURL=patch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../src/patch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH;;GAEG;AACH,iBAAe,qBAAqB,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CA8DhE;AAED;;GAEG;AACH,iBAAS,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAKhD;AAED;;GAEG;AACH,iBAAS,mBAAmB,CAAC,QAAQ,EAAE,GAAG,OAmBzC;AAgED,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC"}