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

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 (58) hide show
  1. package/README.md +192 -216
  2. package/dist/auto.d.ts +0 -12
  3. package/dist/auto.js +3 -14
  4. package/dist/crypto.d.ts +10 -26
  5. package/dist/crypto.js +117 -37
  6. package/dist/dev-helper.d.ts +3 -0
  7. package/dist/dev-helper.js +54 -0
  8. package/dist/encrypted-storage.d.ts +11 -0
  9. package/dist/encrypted-storage.js +73 -0
  10. package/dist/index.d.ts +29 -106
  11. package/dist/index.js +225 -392
  12. package/dist/logger.d.ts +32 -0
  13. package/dist/logger.js +66 -0
  14. package/dist/registry/index.d.ts +0 -31
  15. package/dist/registry/index.js +2 -42
  16. package/dist/registry/knowthat.d.ts +3 -18
  17. package/dist/registry/knowthat.js +10 -35
  18. package/dist/rotation.d.ts +35 -0
  19. package/dist/rotation.js +102 -0
  20. package/dist/storage.d.ts +41 -0
  21. package/dist/storage.js +163 -0
  22. package/dist/transport.d.ts +34 -0
  23. package/dist/transport.js +207 -0
  24. package/dist/types.d.ts +72 -99
  25. package/dist/types.js +0 -4
  26. package/package.json +16 -6
  27. package/dist/__tests__/challenge-response.test.d.ts +0 -5
  28. package/dist/__tests__/challenge-response.test.d.ts.map +0 -1
  29. package/dist/__tests__/challenge-response.test.js +0 -218
  30. package/dist/__tests__/challenge-response.test.js.map +0 -1
  31. package/dist/__tests__/crypto.test.d.ts +0 -5
  32. package/dist/__tests__/crypto.test.d.ts.map +0 -1
  33. package/dist/__tests__/crypto.test.js +0 -153
  34. package/dist/__tests__/crypto.test.js.map +0 -1
  35. package/dist/auto.d.ts.map +0 -1
  36. package/dist/auto.js.map +0 -1
  37. package/dist/crypto.d.ts.map +0 -1
  38. package/dist/crypto.js.map +0 -1
  39. package/dist/index.d.ts.map +0 -1
  40. package/dist/index.js.map +0 -1
  41. package/dist/registry/cursor.d.ts +0 -25
  42. package/dist/registry/cursor.d.ts.map +0 -1
  43. package/dist/registry/cursor.js +0 -108
  44. package/dist/registry/cursor.js.map +0 -1
  45. package/dist/registry/glama.d.ts +0 -25
  46. package/dist/registry/glama.d.ts.map +0 -1
  47. package/dist/registry/glama.js +0 -111
  48. package/dist/registry/glama.js.map +0 -1
  49. package/dist/registry/index.d.ts.map +0 -1
  50. package/dist/registry/index.js.map +0 -1
  51. package/dist/registry/knowthat.d.ts.map +0 -1
  52. package/dist/registry/knowthat.js.map +0 -1
  53. package/dist/registry/smithery.d.ts +0 -29
  54. package/dist/registry/smithery.d.ts.map +0 -1
  55. package/dist/registry/smithery.js +0 -119
  56. package/dist/registry/smithery.js.map +0 -1
  57. package/dist/types.d.ts.map +0 -1
  58. package/dist/types.js.map +0 -1
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.StorageFactory = exports.CombinedStorage = exports.EnvironmentStorage = exports.MemoryStorage = exports.FileStorage = void 0;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ class FileStorage {
40
+ constructor(customPath) {
41
+ this.filePath = customPath || path.join(process.cwd(), '.mcp-identity.json');
42
+ }
43
+ async load() {
44
+ try {
45
+ if (fs.existsSync(this.filePath)) {
46
+ const content = fs.readFileSync(this.filePath, 'utf-8');
47
+ return JSON.parse(content);
48
+ }
49
+ }
50
+ catch {
51
+ }
52
+ return null;
53
+ }
54
+ async save(identity) {
55
+ fs.writeFileSync(this.filePath, JSON.stringify(identity, null, 2));
56
+ }
57
+ async exists() {
58
+ return fs.existsSync(this.filePath);
59
+ }
60
+ }
61
+ exports.FileStorage = FileStorage;
62
+ class MemoryStorage {
63
+ constructor(key) {
64
+ this.key = key || 'default';
65
+ }
66
+ async load() {
67
+ return MemoryStorage.instances.get(this.key) || null;
68
+ }
69
+ async save(identity) {
70
+ MemoryStorage.instances.set(this.key, identity);
71
+ }
72
+ async exists() {
73
+ return MemoryStorage.instances.has(this.key);
74
+ }
75
+ static clear() {
76
+ MemoryStorage.instances.clear();
77
+ }
78
+ }
79
+ exports.MemoryStorage = MemoryStorage;
80
+ MemoryStorage.instances = new Map();
81
+ class EnvironmentStorage {
82
+ static load() {
83
+ if (process.env.AGENT_DID && process.env.AGENT_PUBLIC_KEY && process.env.AGENT_PRIVATE_KEY) {
84
+ return {
85
+ did: process.env.AGENT_DID,
86
+ publicKey: process.env.AGENT_PUBLIC_KEY,
87
+ privateKey: process.env.AGENT_PRIVATE_KEY,
88
+ agentId: process.env.AGENT_ID || '',
89
+ agentSlug: process.env.AGENT_SLUG || '',
90
+ registeredAt: process.env.AGENT_REGISTERED_AT || new Date().toISOString()
91
+ };
92
+ }
93
+ return null;
94
+ }
95
+ }
96
+ exports.EnvironmentStorage = EnvironmentStorage;
97
+ class CombinedStorage {
98
+ constructor(providers) {
99
+ if (providers.length === 0) {
100
+ throw new Error('At least one storage provider is required');
101
+ }
102
+ this.providers = providers;
103
+ this.primaryProvider = providers[0];
104
+ }
105
+ async load() {
106
+ const envIdentity = EnvironmentStorage.load();
107
+ if (envIdentity) {
108
+ return envIdentity;
109
+ }
110
+ for (const provider of this.providers) {
111
+ const identity = await provider.load();
112
+ if (identity) {
113
+ return identity;
114
+ }
115
+ }
116
+ return null;
117
+ }
118
+ async save(identity) {
119
+ await this.primaryProvider.save(identity);
120
+ }
121
+ async exists() {
122
+ for (const provider of this.providers) {
123
+ if (await provider.exists()) {
124
+ return true;
125
+ }
126
+ }
127
+ return false;
128
+ }
129
+ }
130
+ exports.CombinedStorage = CombinedStorage;
131
+ class StorageFactory {
132
+ static create(options) {
133
+ const storageType = options?.storage || 'auto';
134
+ let baseStorage;
135
+ if (storageType === 'memory') {
136
+ baseStorage = new MemoryStorage(options?.memoryKey);
137
+ }
138
+ else if (storageType === 'file') {
139
+ baseStorage = new FileStorage(options?.customPath);
140
+ }
141
+ else if (storageType === 'auto') {
142
+ if (process.env.AWS_LAMBDA_FUNCTION_NAME ||
143
+ process.env.VERCEL ||
144
+ process.env.NETLIFY ||
145
+ !fs.existsSync ||
146
+ typeof fs.writeFileSync !== 'function') {
147
+ baseStorage = new MemoryStorage(options?.memoryKey);
148
+ }
149
+ else {
150
+ baseStorage = new FileStorage(options?.customPath);
151
+ }
152
+ }
153
+ else {
154
+ throw new Error(`Unknown storage type: ${storageType}`);
155
+ }
156
+ if (options?.encryptionPassword) {
157
+ const { createEncryptedStorage } = require('./encrypted-storage');
158
+ return createEncryptedStorage(baseStorage, options.encryptionPassword);
159
+ }
160
+ return baseStorage;
161
+ }
162
+ }
163
+ exports.StorageFactory = StorageFactory;
@@ -0,0 +1,34 @@
1
+ export interface TransportOptions {
2
+ timeout?: number;
3
+ headers?: Record<string, string>;
4
+ }
5
+ export interface TransportResponse<T = any> {
6
+ data: T;
7
+ status: number;
8
+ headers: Record<string, string>;
9
+ }
10
+ export interface Transport {
11
+ post<T = any>(url: string, data: any, options?: TransportOptions): Promise<TransportResponse<T>>;
12
+ get<T = any>(url: string, options?: TransportOptions): Promise<TransportResponse<T>>;
13
+ }
14
+ export declare class FetchTransport implements Transport {
15
+ post<T = any>(url: string, data: any, options?: TransportOptions): Promise<TransportResponse<T>>;
16
+ get<T = any>(url: string, options?: TransportOptions): Promise<TransportResponse<T>>;
17
+ }
18
+ export declare class AxiosTransport implements Transport {
19
+ private axiosInstance;
20
+ post<T = any>(url: string, data: any, options?: TransportOptions): Promise<TransportResponse<T>>;
21
+ get<T = any>(url: string, options?: TransportOptions): Promise<TransportResponse<T>>;
22
+ private getAxios;
23
+ }
24
+ export declare class RuntimeDetector {
25
+ static isEdgeRuntime(): boolean;
26
+ static isNodeRuntime(): boolean;
27
+ static hasFetch(): boolean;
28
+ static isLambda(): boolean;
29
+ }
30
+ export declare class TransportFactory {
31
+ static create(options?: {
32
+ transport?: 'axios' | 'fetch' | 'auto';
33
+ }): Transport;
34
+ }
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.TransportFactory = exports.RuntimeDetector = exports.AxiosTransport = exports.FetchTransport = void 0;
37
+ class FetchTransport {
38
+ async post(url, data, options) {
39
+ const controller = new AbortController();
40
+ const timeout = options?.timeout || 30000;
41
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
42
+ try {
43
+ const response = await fetch(url, {
44
+ method: 'POST',
45
+ headers: {
46
+ 'Content-Type': 'application/json',
47
+ ...options?.headers
48
+ },
49
+ body: JSON.stringify(data),
50
+ signal: controller.signal
51
+ });
52
+ clearTimeout(timeoutId);
53
+ if (!response.ok) {
54
+ const error = await response.text();
55
+ throw new Error(`HTTP ${response.status}: ${error}`);
56
+ }
57
+ const responseData = await response.json();
58
+ return {
59
+ data: responseData,
60
+ status: response.status,
61
+ headers: Object.fromEntries(response.headers.entries())
62
+ };
63
+ }
64
+ catch (error) {
65
+ clearTimeout(timeoutId);
66
+ if (error.name === 'AbortError') {
67
+ throw new Error('Request timeout');
68
+ }
69
+ throw error;
70
+ }
71
+ }
72
+ async get(url, options) {
73
+ const controller = new AbortController();
74
+ const timeout = options?.timeout || 30000;
75
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
76
+ try {
77
+ const response = await fetch(url, {
78
+ method: 'GET',
79
+ headers: options?.headers,
80
+ signal: controller.signal
81
+ });
82
+ clearTimeout(timeoutId);
83
+ if (!response.ok) {
84
+ const error = await response.text();
85
+ throw new Error(`HTTP ${response.status}: ${error}`);
86
+ }
87
+ const responseData = await response.json();
88
+ return {
89
+ data: responseData,
90
+ status: response.status,
91
+ headers: Object.fromEntries(response.headers.entries())
92
+ };
93
+ }
94
+ catch (error) {
95
+ clearTimeout(timeoutId);
96
+ if (error.name === 'AbortError') {
97
+ throw new Error('Request timeout');
98
+ }
99
+ throw error;
100
+ }
101
+ }
102
+ }
103
+ exports.FetchTransport = FetchTransport;
104
+ class AxiosTransport {
105
+ async post(url, data, options) {
106
+ const axios = await this.getAxios();
107
+ try {
108
+ const response = await axios.post(url, data, {
109
+ timeout: options?.timeout || 30000,
110
+ headers: options?.headers
111
+ });
112
+ return {
113
+ data: response.data,
114
+ status: response.status,
115
+ headers: response.headers
116
+ };
117
+ }
118
+ catch (error) {
119
+ if (error.response?.status === 429) {
120
+ throw new Error('Rate limit exceeded. Please try again later.');
121
+ }
122
+ throw new Error(error.response?.data?.message ||
123
+ error.message ||
124
+ 'Request failed');
125
+ }
126
+ }
127
+ async get(url, options) {
128
+ const axios = await this.getAxios();
129
+ try {
130
+ const response = await axios.get(url, {
131
+ timeout: options?.timeout || 30000,
132
+ headers: options?.headers
133
+ });
134
+ return {
135
+ data: response.data,
136
+ status: response.status,
137
+ headers: response.headers
138
+ };
139
+ }
140
+ catch (error) {
141
+ throw new Error(error.response?.data?.message ||
142
+ error.message ||
143
+ 'Request failed');
144
+ }
145
+ }
146
+ async getAxios() {
147
+ if (!this.axiosInstance) {
148
+ const axiosModule = await Promise.resolve().then(() => __importStar(require('axios')));
149
+ this.axiosInstance = axiosModule.default;
150
+ }
151
+ return this.axiosInstance;
152
+ }
153
+ }
154
+ exports.AxiosTransport = AxiosTransport;
155
+ class RuntimeDetector {
156
+ static isEdgeRuntime() {
157
+ return !!(globalThis.EdgeRuntime ||
158
+ process.env.NEXT_RUNTIME === 'edge' ||
159
+ process.env.VERCEL_EDGE ||
160
+ globalThis.Deno ||
161
+ globalThis.Bun);
162
+ }
163
+ static isNodeRuntime() {
164
+ return !!(process.versions?.node &&
165
+ !this.isEdgeRuntime());
166
+ }
167
+ static hasFetch() {
168
+ return typeof globalThis.fetch === 'function';
169
+ }
170
+ static isLambda() {
171
+ return !!(process.env.AWS_LAMBDA_FUNCTION_NAME ||
172
+ process.env.LAMBDA_TASK_ROOT ||
173
+ process.env._HANDLER);
174
+ }
175
+ }
176
+ exports.RuntimeDetector = RuntimeDetector;
177
+ class TransportFactory {
178
+ static create(options) {
179
+ const transportType = options?.transport || 'auto';
180
+ if (transportType === 'fetch') {
181
+ if (!RuntimeDetector.hasFetch()) {
182
+ throw new Error('Fetch is not available in this runtime');
183
+ }
184
+ return new FetchTransport();
185
+ }
186
+ if (transportType === 'axios') {
187
+ return new AxiosTransport();
188
+ }
189
+ if (transportType === 'auto') {
190
+ if (RuntimeDetector.isEdgeRuntime() && RuntimeDetector.hasFetch()) {
191
+ return new FetchTransport();
192
+ }
193
+ if (RuntimeDetector.isLambda() && RuntimeDetector.hasFetch()) {
194
+ return new FetchTransport();
195
+ }
196
+ if (RuntimeDetector.isNodeRuntime()) {
197
+ return new AxiosTransport();
198
+ }
199
+ if (RuntimeDetector.hasFetch()) {
200
+ return new FetchTransport();
201
+ }
202
+ return new AxiosTransport();
203
+ }
204
+ throw new Error(`Unknown transport type: ${transportType}`);
205
+ }
206
+ }
207
+ exports.TransportFactory = TransportFactory;
package/dist/types.d.ts CHANGED
@@ -1,39 +1,81 @@
1
- /**
2
- * Type definitions for MCP-I challenge-response authentication
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;
1
+ export type RegistryName = string;
2
+ export type RegistryTier = 'verified';
13
3
  export interface RegistryConfig {
14
- /** Include specific registries or a tier */
15
- include?: RegistryName[] | RegistryTier;
16
- /** Exclude specific registries */
17
- exclude?: RegistryName[];
4
+ include?: string[] | 'verified';
5
+ exclude?: string[];
18
6
  }
7
+ export interface RegistryStatus {
8
+ name: string;
9
+ status: 'active' | 'pending' | 'failed';
10
+ registeredAt?: string;
11
+ type?: 'primary' | 'secondary';
12
+ error?: string;
13
+ }
14
+ export interface RegistryAdapter {
15
+ name: string;
16
+ type: 'primary' | 'secondary';
17
+ publish(data: any): Promise<any>;
18
+ verify?(did: string): Promise<boolean>;
19
+ }
20
+ export interface RegistryPublishData {
21
+ did: string;
22
+ name: string;
23
+ description?: string;
24
+ repository?: string;
25
+ publicKey: string;
26
+ metadata?: Record<string, any>;
27
+ }
28
+ export interface RegistryPublishResult {
29
+ success: boolean;
30
+ registryAgentId?: string;
31
+ profileUrl?: string;
32
+ error?: string;
33
+ }
34
+ export type DirectoryPreference = string[] | 'verified' | 'none';
35
+ export type DirectoryName = 'smithery' | 'glama' | string;
19
36
  export interface MCPIdentityOptions {
20
37
  name?: string;
21
38
  description?: string;
22
39
  repository?: string;
23
40
  apiEndpoint?: string;
24
41
  persistencePath?: string;
42
+ storage?: 'file' | 'memory' | 'auto';
43
+ memoryKey?: string;
44
+ transport?: 'axios' | 'fetch' | 'auto';
25
45
  timestampTolerance?: number;
26
46
  enableNonceTracking?: 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
- */
47
+ encryptionPassword?: string;
48
+ directories?: DirectoryPreference;
36
49
  mode?: 'development' | 'production';
50
+ logger?: Logger;
51
+ logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
52
+ }
53
+ export interface MCPServer {
54
+ setRequestHandler(method: string, handler: Function): void;
55
+ connect(transport: any): Promise<void>;
56
+ serverInfo?: {
57
+ capabilities?: Record<string, any>;
58
+ };
59
+ }
60
+ export interface MCPMiddleware {
61
+ (server: MCPServer, identity: any): void;
62
+ }
63
+ export interface MCPRequest<T = any> {
64
+ method: string;
65
+ params?: T;
66
+ }
67
+ export interface MCPResponse<T = any> {
68
+ content?: T;
69
+ error?: {
70
+ code: number;
71
+ message: string;
72
+ };
73
+ }
74
+ export interface Logger {
75
+ debug(message: string, ...args: any[]): void;
76
+ info(message: string, ...args: any[]): void;
77
+ warn(message: string, ...args: any[]): void;
78
+ error(message: string, ...args: any[]): void;
37
79
  }
38
80
  export interface AutoRegisterResponse {
39
81
  success: boolean;
@@ -56,81 +98,22 @@ export interface PersistedIdentity {
56
98
  agentId: string;
57
99
  agentSlug: string;
58
100
  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;
101
+ directories?: DirectoryPreference;
82
102
  }
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;
103
+ export interface RegistrationData {
105
104
  name: string;
106
105
  description?: string;
107
106
  repository?: string;
108
- publicKey: string;
109
- agentId?: string;
110
- agentSlug?: string;
107
+ publicKey?: string;
108
+ directories?: DirectoryPreference;
111
109
  metadata?: Record<string, any>;
112
110
  }
113
- /**
114
- * Result from registry publication
115
- */
116
- export interface RegistryPublishResult {
117
- success: boolean;
118
- registryAgentId?: string;
119
- profileUrl?: string;
120
- error?: string;
121
- }
122
- /**
123
- * MCP-I Challenge structure
124
- */
125
111
  export interface Challenge {
126
112
  nonce: string;
127
113
  timestamp: number;
128
114
  verifier_did?: string;
129
115
  scope?: string[];
130
116
  }
131
- /**
132
- * MCP-I Challenge Response structure
133
- */
134
117
  export interface ChallengeResponse {
135
118
  did: string;
136
119
  signature: string;
@@ -138,9 +121,6 @@ export interface ChallengeResponse {
138
121
  nonce: string;
139
122
  publicKey?: string;
140
123
  }
141
- /**
142
- * MCP-I Capabilities advertisement
143
- */
144
124
  export interface MCPICapabilities {
145
125
  version: string;
146
126
  did: string;
@@ -149,14 +129,8 @@ export interface MCPICapabilities {
149
129
  handshakeSupported: boolean;
150
130
  handshakeEndpoint?: string;
151
131
  verificationEndpoint?: string;
152
- registries?: {
153
- primary: string;
154
- secondary: string[];
155
- };
132
+ registry?: string;
156
133
  }
157
- /**
158
- * Response with MCP-I identity attached
159
- */
160
134
  export interface SignedResponse<T = any> {
161
135
  [key: string]: any;
162
136
  _mcp_identity: {
@@ -166,4 +140,3 @@ export interface SignedResponse<T = any> {
166
140
  conformanceLevel?: number;
167
141
  };
168
142
  }
169
- //# sourceMappingURL=types.d.ts.map
package/dist/types.js CHANGED
@@ -1,6 +1,2 @@
1
1
  "use strict";
2
- /**
3
- * Type definitions for MCP-I challenge-response authentication
4
- */
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kya-os/mcp-i",
3
- "version": "0.1.0-alpha.2.3",
4
- "description": "Give your MCP server cryptographic identity in 2 lines of code",
3
+ "version": "0.1.0-alpha.2.4",
4
+ "description": "Production-ready MCP Identity with automatic registration, key rotation, and optimized performance",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -27,11 +27,14 @@
27
27
  "LICENSE"
28
28
  ],
29
29
  "scripts": {
30
- "build": "tsc",
30
+ "build": "tsc -p tsconfig.prod.json",
31
+ "build:dev": "tsc",
32
+ "clean": "rm -rf dist",
31
33
  "test": "vitest",
32
34
  "test:watch": "vitest watch",
33
35
  "test:coverage": "vitest run --coverage",
34
- "prepublishOnly": "npm run build"
36
+ "prepublishOnly": "npm run clean && npm run build",
37
+ "size": "npm pack --dry-run && echo 'Bundled size:' && tar -tzf *.tgz | wc -c"
35
38
  },
36
39
  "keywords": [
37
40
  "mcp",
@@ -57,8 +60,15 @@
57
60
  "author": "Dylan Hobbs <dylan@vouched.id>",
58
61
  "license": "MIT",
59
62
  "dependencies": {
60
- "@noble/ed25519": "^2.1.0",
61
- "axios": "^1.6.7"
63
+ "@noble/ed25519": "^2.1.0"
64
+ },
65
+ "peerDependencies": {
66
+ "axios": "^1.6.0"
67
+ },
68
+ "peerDependenciesMeta": {
69
+ "axios": {
70
+ "optional": true
71
+ }
62
72
  },
63
73
  "devDependencies": {
64
74
  "@types/node": "^20.0.0",
@@ -1,5 +0,0 @@
1
- /**
2
- * Tests for challenge-response authentication
3
- */
4
- export {};
5
- //# sourceMappingURL=challenge-response.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"challenge-response.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/challenge-response.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}