@kya-os/mcp-i 0.1.0-alpha.2.9 → 0.1.0-alpha.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.
- package/dist/{crypto.js → cjs/crypto.js} +17 -2
- package/dist/esm/auto.d.ts +13 -0
- package/dist/esm/auto.d.ts.map +1 -0
- package/dist/esm/auto.js +30 -0
- package/dist/esm/auto.js.map +1 -0
- package/dist/esm/crypto.d.ts +51 -0
- package/dist/esm/crypto.d.ts.map +1 -0
- package/dist/esm/crypto.js +230 -0
- package/dist/esm/crypto.js.map +1 -0
- package/dist/esm/dev-helper.d.ts +15 -0
- package/dist/esm/dev-helper.d.ts.map +1 -0
- package/dist/esm/dev-helper.js +63 -0
- package/dist/esm/dev-helper.js.map +1 -0
- package/dist/esm/encrypted-storage.d.ts +19 -0
- package/dist/esm/encrypted-storage.d.ts.map +1 -0
- package/dist/esm/encrypted-storage.js +48 -0
- package/dist/esm/encrypted-storage.js.map +1 -0
- package/dist/esm/index.d.ts +128 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +671 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger.d.ts +46 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/logger.js +76 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/nextjs.d.ts +22 -0
- package/dist/esm/nextjs.d.ts.map +1 -0
- package/dist/esm/nextjs.js +82 -0
- package/dist/esm/nextjs.js.map +1 -0
- package/dist/esm/registry/index.d.ts +43 -0
- package/dist/esm/registry/index.d.ts.map +1 -0
- package/dist/esm/registry/index.js +89 -0
- package/dist/esm/registry/index.js.map +1 -0
- package/dist/esm/registry/knowthat.d.ts +30 -0
- package/dist/esm/registry/knowthat.d.ts.map +1 -0
- package/dist/esm/registry/knowthat.js +106 -0
- package/dist/esm/registry/knowthat.js.map +1 -0
- package/dist/esm/rotation.d.ts +57 -0
- package/dist/esm/rotation.d.ts.map +1 -0
- package/dist/esm/rotation.js +133 -0
- package/dist/esm/rotation.js.map +1 -0
- package/dist/esm/storage.d.ts +65 -0
- package/dist/esm/storage.d.ts.map +1 -0
- package/dist/esm/storage.js +160 -0
- package/dist/esm/storage.js.map +1 -0
- package/dist/esm/transport.d.ts +52 -0
- package/dist/esm/transport.d.ts.map +1 -0
- package/dist/esm/transport.js +209 -0
- package/dist/esm/transport.js.map +1 -0
- package/dist/esm/types.d.ts +188 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +5 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/vercel-adapter.d.ts +26 -0
- package/dist/esm/vercel-adapter.d.ts.map +1 -0
- package/dist/esm/vercel-adapter.js +80 -0
- package/dist/esm/vercel-adapter.js.map +1 -0
- package/package.json +23 -19
- /package/dist/{auto.d.ts → cjs/auto.d.ts} +0 -0
- /package/dist/{auto.js → cjs/auto.js} +0 -0
- /package/dist/{crypto.d.ts → cjs/crypto.d.ts} +0 -0
- /package/dist/{dev-helper.d.ts → cjs/dev-helper.d.ts} +0 -0
- /package/dist/{dev-helper.js → cjs/dev-helper.js} +0 -0
- /package/dist/{encrypted-storage.d.ts → cjs/encrypted-storage.d.ts} +0 -0
- /package/dist/{encrypted-storage.js → cjs/encrypted-storage.js} +0 -0
- /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/dist/{index.js → cjs/index.js} +0 -0
- /package/dist/{logger.d.ts → cjs/logger.d.ts} +0 -0
- /package/dist/{logger.js → cjs/logger.js} +0 -0
- /package/dist/{nextjs.d.ts → cjs/nextjs.d.ts} +0 -0
- /package/dist/{nextjs.js → cjs/nextjs.js} +0 -0
- /package/dist/{registry → cjs/registry}/index.d.ts +0 -0
- /package/dist/{registry → cjs/registry}/index.js +0 -0
- /package/dist/{registry → cjs/registry}/knowthat.d.ts +0 -0
- /package/dist/{registry → cjs/registry}/knowthat.js +0 -0
- /package/dist/{rotation.d.ts → cjs/rotation.d.ts} +0 -0
- /package/dist/{rotation.js → cjs/rotation.js} +0 -0
- /package/dist/{storage.d.ts → cjs/storage.d.ts} +0 -0
- /package/dist/{storage.js → cjs/storage.js} +0 -0
- /package/dist/{transport.d.ts → cjs/transport.d.ts} +0 -0
- /package/dist/{transport.js → cjs/transport.js} +0 -0
- /package/dist/{types.d.ts → cjs/types.d.ts} +0 -0
- /package/dist/{types.js → cjs/types.js} +0 -0
- /package/dist/{vercel-adapter.d.ts → cjs/vercel-adapter.d.ts} +0 -0
- /package/dist/{vercel-adapter.js → cjs/vercel-adapter.js} +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for MCP-I challenge-response authentication
|
|
3
|
+
*/
|
|
4
|
+
export type RegistryName = string;
|
|
5
|
+
export type RegistryTier = 'verified';
|
|
6
|
+
export interface RegistryConfig {
|
|
7
|
+
include?: string[] | 'verified';
|
|
8
|
+
exclude?: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface RegistryStatus {
|
|
11
|
+
name: string;
|
|
12
|
+
status: 'active' | 'pending' | 'failed';
|
|
13
|
+
registeredAt?: string;
|
|
14
|
+
type?: 'primary' | 'secondary';
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface RegistryAdapter {
|
|
18
|
+
name: string;
|
|
19
|
+
type: 'primary' | 'secondary';
|
|
20
|
+
publish(data: any): Promise<any>;
|
|
21
|
+
verify?(did: string): Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
export interface RegistryPublishData {
|
|
24
|
+
did: string;
|
|
25
|
+
name: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
repository?: string;
|
|
28
|
+
publicKey: string;
|
|
29
|
+
metadata?: Record<string, any>;
|
|
30
|
+
}
|
|
31
|
+
export interface RegistryPublishResult {
|
|
32
|
+
success: boolean;
|
|
33
|
+
registryAgentId?: string;
|
|
34
|
+
profileUrl?: string;
|
|
35
|
+
error?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Directory configuration for agent listings
|
|
39
|
+
*/
|
|
40
|
+
export type DirectoryPreference = string[] | 'verified' | 'none';
|
|
41
|
+
/**
|
|
42
|
+
* Known directory names
|
|
43
|
+
*/
|
|
44
|
+
export type DirectoryName = 'smithery' | 'glama' | string;
|
|
45
|
+
export interface MCPIdentityOptions {
|
|
46
|
+
name?: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
repository?: string;
|
|
49
|
+
apiEndpoint?: string;
|
|
50
|
+
persistencePath?: string;
|
|
51
|
+
storage?: 'file' | 'memory' | 'auto';
|
|
52
|
+
memoryKey?: string;
|
|
53
|
+
transport?: 'axios' | 'fetch' | 'auto';
|
|
54
|
+
timestampTolerance?: number;
|
|
55
|
+
enableNonceTracking?: boolean;
|
|
56
|
+
encryptionPassword?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Directory preferences for agent listings
|
|
59
|
+
* - string[]: List specific directories like ["smithery", "glama"]
|
|
60
|
+
* - 'verified': List on all verified directories (default)
|
|
61
|
+
* - 'none': Don't list on any directories (registry only)
|
|
62
|
+
*
|
|
63
|
+
* The actual directory submission is handled by knowthat.ai
|
|
64
|
+
*/
|
|
65
|
+
directories?: DirectoryPreference;
|
|
66
|
+
/**
|
|
67
|
+
* Development vs Production mode
|
|
68
|
+
* - 'development': Creates draft DID that expires after 30 days
|
|
69
|
+
* - 'production': Creates permanent DID (requires proof of usage)
|
|
70
|
+
* @default 'production'
|
|
71
|
+
*/
|
|
72
|
+
mode?: 'development' | 'production';
|
|
73
|
+
logger?: Logger;
|
|
74
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* MCP Server middleware types
|
|
78
|
+
*/
|
|
79
|
+
export interface MCPServer {
|
|
80
|
+
setRequestHandler(method: string, handler: Function): void;
|
|
81
|
+
connect(transport: any): Promise<void>;
|
|
82
|
+
serverInfo?: {
|
|
83
|
+
capabilities?: Record<string, any>;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface MCPMiddleware {
|
|
87
|
+
(server: MCPServer, identity: any): void;
|
|
88
|
+
}
|
|
89
|
+
export interface MCPRequest<T = any> {
|
|
90
|
+
method: string;
|
|
91
|
+
params?: T;
|
|
92
|
+
}
|
|
93
|
+
export interface MCPResponse<T = any> {
|
|
94
|
+
content?: T;
|
|
95
|
+
error?: {
|
|
96
|
+
code: number;
|
|
97
|
+
message: string;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Logger interface
|
|
102
|
+
*/
|
|
103
|
+
export interface Logger {
|
|
104
|
+
debug(message: string, ...args: any[]): void;
|
|
105
|
+
info(message: string, ...args: any[]): void;
|
|
106
|
+
warn(message: string, ...args: any[]): void;
|
|
107
|
+
error(message: string, ...args: any[]): void;
|
|
108
|
+
}
|
|
109
|
+
export interface AutoRegisterResponse {
|
|
110
|
+
success: boolean;
|
|
111
|
+
did: string;
|
|
112
|
+
agent: {
|
|
113
|
+
id: string;
|
|
114
|
+
slug: string;
|
|
115
|
+
name: string;
|
|
116
|
+
url: string;
|
|
117
|
+
};
|
|
118
|
+
keys: {
|
|
119
|
+
publicKey: string;
|
|
120
|
+
privateKey?: string;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export interface PersistedIdentity {
|
|
124
|
+
did: string;
|
|
125
|
+
publicKey: string;
|
|
126
|
+
privateKey: string;
|
|
127
|
+
agentId: string;
|
|
128
|
+
agentSlug: string;
|
|
129
|
+
registeredAt: string;
|
|
130
|
+
/** Directory preferences submitted to knowthat.ai */
|
|
131
|
+
directories?: DirectoryPreference;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Registration data sent to knowthat.ai
|
|
135
|
+
*/
|
|
136
|
+
export interface RegistrationData {
|
|
137
|
+
name: string;
|
|
138
|
+
description?: string;
|
|
139
|
+
repository?: string;
|
|
140
|
+
publicKey?: string;
|
|
141
|
+
directories?: DirectoryPreference;
|
|
142
|
+
metadata?: Record<string, any>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* MCP-I Challenge structure
|
|
146
|
+
*/
|
|
147
|
+
export interface Challenge {
|
|
148
|
+
nonce: string;
|
|
149
|
+
timestamp: number;
|
|
150
|
+
verifier_did?: string;
|
|
151
|
+
scope?: string[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* MCP-I Challenge Response structure
|
|
155
|
+
*/
|
|
156
|
+
export interface ChallengeResponse {
|
|
157
|
+
did: string;
|
|
158
|
+
signature: string;
|
|
159
|
+
timestamp: number;
|
|
160
|
+
nonce: string;
|
|
161
|
+
publicKey?: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* MCP-I Capabilities advertisement
|
|
165
|
+
*/
|
|
166
|
+
export interface MCPICapabilities {
|
|
167
|
+
version: string;
|
|
168
|
+
did: string;
|
|
169
|
+
publicKey: string;
|
|
170
|
+
conformanceLevel: number;
|
|
171
|
+
handshakeSupported: boolean;
|
|
172
|
+
handshakeEndpoint?: string;
|
|
173
|
+
verificationEndpoint?: string;
|
|
174
|
+
registry?: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Response with MCP-I identity attached
|
|
178
|
+
*/
|
|
179
|
+
export interface SignedResponse<T = any> {
|
|
180
|
+
[key: string]: any;
|
|
181
|
+
_mcp_identity: {
|
|
182
|
+
did: string;
|
|
183
|
+
signature: string;
|
|
184
|
+
timestamp: string;
|
|
185
|
+
conformanceLevel?: number;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;AACtC,MAAM,WAAW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version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel/Edge Runtime Adapter for MCP-I
|
|
3
|
+
*
|
|
4
|
+
* Provides special handling for serverless environments where:
|
|
5
|
+
* - No file system access
|
|
6
|
+
* - Environment variables for persistence
|
|
7
|
+
* - Better developer console output
|
|
8
|
+
*/
|
|
9
|
+
import { MCPIdentityOptions, PersistedIdentity } from './types';
|
|
10
|
+
export interface VercelMCPIdentityOptions extends MCPIdentityOptions {
|
|
11
|
+
envPrefix?: string;
|
|
12
|
+
showClaimInstructions?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Check for identity in environment variables
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadIdentityFromEnv(prefix?: string): PersistedIdentity | null;
|
|
18
|
+
/**
|
|
19
|
+
* Generate environment variable instructions
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateEnvInstructions(identity: PersistedIdentity, prefix?: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Show developer-friendly console output
|
|
24
|
+
*/
|
|
25
|
+
export declare function showVercelDeveloperInstructions(identity: PersistedIdentity, claimUrl?: string): void;
|
|
26
|
+
//# sourceMappingURL=vercel-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-adapter.d.ts","sourceRoot":"","sources":["../../src/vercel-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGhE,MAAM,WAAW,wBAAyB,SAAQ,kBAAkB;IAElE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,SAAkB,GAAG,iBAAiB,GAAG,IAAI,CA2BtF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,MAAM,SAAkB,GAAG,MAAM,CASrG;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CA4BpG"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel/Edge Runtime Adapter for MCP-I
|
|
3
|
+
*
|
|
4
|
+
* Provides special handling for serverless environments where:
|
|
5
|
+
* - No file system access
|
|
6
|
+
* - Environment variables for persistence
|
|
7
|
+
* - Better developer console output
|
|
8
|
+
*/
|
|
9
|
+
import { getLogger } from './logger.js';
|
|
10
|
+
/**
|
|
11
|
+
* Check for identity in environment variables
|
|
12
|
+
*/
|
|
13
|
+
export function loadIdentityFromEnv(prefix = 'MCP_IDENTITY_') {
|
|
14
|
+
const logger = getLogger();
|
|
15
|
+
try {
|
|
16
|
+
const did = process.env[`${prefix}DID`];
|
|
17
|
+
const publicKey = process.env[`${prefix}PUBLIC_KEY`];
|
|
18
|
+
const privateKey = process.env[`${prefix}PRIVATE_KEY`];
|
|
19
|
+
const agentId = process.env[`${prefix}AGENT_ID`];
|
|
20
|
+
const agentSlug = process.env[`${prefix}AGENT_SLUG`];
|
|
21
|
+
if (did && publicKey && privateKey) {
|
|
22
|
+
logger.info('📦 Loaded identity from environment variables');
|
|
23
|
+
return {
|
|
24
|
+
did,
|
|
25
|
+
publicKey,
|
|
26
|
+
privateKey,
|
|
27
|
+
agentId: agentId || 'unknown',
|
|
28
|
+
agentSlug: agentSlug || 'unknown',
|
|
29
|
+
registeredAt: new Date().toISOString(),
|
|
30
|
+
directories: 'verified'
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
logger.debug('No identity found in environment variables');
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Generate environment variable instructions
|
|
41
|
+
*/
|
|
42
|
+
export function generateEnvInstructions(identity, prefix = 'MCP_IDENTITY_') {
|
|
43
|
+
return `
|
|
44
|
+
# Add these to your Vercel environment variables:
|
|
45
|
+
${prefix}DID="${identity.did}"
|
|
46
|
+
${prefix}PUBLIC_KEY="${identity.publicKey}"
|
|
47
|
+
${prefix}PRIVATE_KEY="${identity.privateKey}"
|
|
48
|
+
${prefix}AGENT_ID="${identity.agentId}"
|
|
49
|
+
${prefix}AGENT_SLUG="${identity.agentSlug}"
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Show developer-friendly console output
|
|
54
|
+
*/
|
|
55
|
+
export function showVercelDeveloperInstructions(identity, claimUrl) {
|
|
56
|
+
const logger = getLogger();
|
|
57
|
+
console.log('\n');
|
|
58
|
+
console.log('='.repeat(60));
|
|
59
|
+
console.log('🎉 MCP-I IDENTITY CREATED SUCCESSFULLY! 🎉');
|
|
60
|
+
console.log('='.repeat(60));
|
|
61
|
+
console.log('\n📋 Your Agent Details:\n');
|
|
62
|
+
console.log(` DID: ${identity.did}`);
|
|
63
|
+
console.log(` Agent ID: ${identity.agentId}`);
|
|
64
|
+
console.log(` Profile: https://knowthat.ai/agents/${identity.agentSlug}`);
|
|
65
|
+
if (claimUrl) {
|
|
66
|
+
console.log('\n🎯 IMPORTANT: Claim your agent to manage it:');
|
|
67
|
+
console.log(` ${claimUrl}`);
|
|
68
|
+
console.log('\n This link lets you:');
|
|
69
|
+
console.log(' - Edit your agent details');
|
|
70
|
+
console.log(' - Add logos and descriptions');
|
|
71
|
+
console.log(' - Manage directory listings');
|
|
72
|
+
console.log(' - View analytics');
|
|
73
|
+
}
|
|
74
|
+
console.log('\n⚡ For Vercel Deployment:');
|
|
75
|
+
console.log('\n1. Add these environment variables in Vercel Dashboard:');
|
|
76
|
+
console.log(generateEnvInstructions(identity));
|
|
77
|
+
console.log('2. Your identity will persist across deployments!');
|
|
78
|
+
console.log('\n' + '='.repeat(60) + '\n');
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=vercel-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-adapter.js","sourceRoot":"","sources":["../../src/vercel-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAQrC;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAM,GAAG,eAAe;IAC1D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,KAAK,CAAC,CAAC;QACxC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,YAAY,CAAC,CAAC;QACrD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,aAAa,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,UAAU,CAAC,CAAC;QACjD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,YAAY,CAAC,CAAC;QAErD,IAAI,GAAG,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;YAC7D,OAAO;gBACL,GAAG;gBACH,SAAS;gBACT,UAAU;gBACV,OAAO,EAAE,OAAO,IAAI,SAAS;gBAC7B,SAAS,EAAE,SAAS,IAAI,SAAS;gBACjC,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACtC,WAAW,EAAE,UAAU;aACxB,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC7D,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;QAC5C,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE/C,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AAC5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kya-os/mcp-i",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.3.0",
|
|
4
4
|
"description": "COMING SOON:Production-ready MCP Identity with automatic registration, key rotation, and optimized performance",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/cjs/index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": {
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"require": "./dist/index.js"
|
|
10
|
+
"types": "./dist/cjs/index.d.ts",
|
|
11
|
+
"import": "./dist/esm/index.js",
|
|
12
|
+
"require": "./dist/cjs/index.js"
|
|
12
13
|
},
|
|
13
14
|
"./auto": {
|
|
14
|
-
"types": "./dist/auto.d.ts",
|
|
15
|
-
"import": "./dist/auto.js",
|
|
16
|
-
"require": "./dist/auto.js"
|
|
15
|
+
"types": "./dist/cjs/auto.d.ts",
|
|
16
|
+
"import": "./dist/esm/auto.js",
|
|
17
|
+
"require": "./dist/cjs/auto.js"
|
|
17
18
|
},
|
|
18
19
|
"./registry": {
|
|
19
|
-
"types": "./dist/registry/index.d.ts",
|
|
20
|
-
"import": "./dist/registry/index.js",
|
|
21
|
-
"require": "./dist/registry/index.js"
|
|
20
|
+
"types": "./dist/cjs/registry/index.d.ts",
|
|
21
|
+
"import": "./dist/esm/registry/index.js",
|
|
22
|
+
"require": "./dist/cjs/registry/index.js"
|
|
22
23
|
},
|
|
23
24
|
"./nextjs": {
|
|
24
|
-
"types": "./dist/nextjs.d.ts",
|
|
25
|
-
"import": "./dist/nextjs.js",
|
|
26
|
-
"require": "./dist/nextjs.js"
|
|
25
|
+
"types": "./dist/cjs/nextjs.d.ts",
|
|
26
|
+
"import": "./dist/esm/nextjs.js",
|
|
27
|
+
"require": "./dist/cjs/nextjs.js"
|
|
27
28
|
},
|
|
28
29
|
"./vercel": {
|
|
29
|
-
"types": "./dist/vercel-adapter.d.ts",
|
|
30
|
-
"import": "./dist/vercel-adapter.js",
|
|
31
|
-
"require": "./dist/vercel-adapter.js"
|
|
30
|
+
"types": "./dist/cjs/vercel-adapter.d.ts",
|
|
31
|
+
"import": "./dist/esm/vercel-adapter.js",
|
|
32
|
+
"require": "./dist/cjs/vercel-adapter.js"
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
35
|
"files": [
|
|
@@ -37,7 +38,10 @@
|
|
|
37
38
|
"LICENSE"
|
|
38
39
|
],
|
|
39
40
|
"scripts": {
|
|
40
|
-
"build": "
|
|
41
|
+
"build": "npm run build:cjs && npm run build:esm && npm run fix:esm",
|
|
42
|
+
"build:cjs": "tsc -p tsconfig.prod.json",
|
|
43
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
44
|
+
"fix:esm": "node scripts/fix-esm-imports.js",
|
|
41
45
|
"build:dev": "tsc",
|
|
42
46
|
"clean": "rm -rf dist",
|
|
43
47
|
"test": "vitest",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|