@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.
- package/README.md +192 -216
- package/dist/auto.d.ts +0 -12
- package/dist/auto.js +3 -14
- package/dist/crypto.d.ts +10 -26
- package/dist/crypto.js +117 -37
- package/dist/dev-helper.d.ts +3 -0
- package/dist/dev-helper.js +54 -0
- package/dist/encrypted-storage.d.ts +11 -0
- package/dist/encrypted-storage.js +73 -0
- package/dist/index.d.ts +29 -106
- package/dist/index.js +225 -392
- package/dist/logger.d.ts +32 -0
- package/dist/logger.js +66 -0
- package/dist/registry/index.d.ts +0 -31
- package/dist/registry/index.js +2 -42
- package/dist/registry/knowthat.d.ts +3 -18
- package/dist/registry/knowthat.js +10 -35
- package/dist/rotation.d.ts +35 -0
- package/dist/rotation.js +102 -0
- package/dist/storage.d.ts +41 -0
- package/dist/storage.js +163 -0
- package/dist/transport.d.ts +34 -0
- package/dist/transport.js +207 -0
- package/dist/types.d.ts +72 -99
- package/dist/types.js +0 -4
- package/package.json +16 -6
- package/dist/__tests__/challenge-response.test.d.ts +0 -5
- package/dist/__tests__/challenge-response.test.d.ts.map +0 -1
- package/dist/__tests__/challenge-response.test.js +0 -218
- package/dist/__tests__/challenge-response.test.js.map +0 -1
- package/dist/__tests__/crypto.test.d.ts +0 -5
- package/dist/__tests__/crypto.test.d.ts.map +0 -1
- package/dist/__tests__/crypto.test.js +0 -153
- package/dist/__tests__/crypto.test.js.map +0 -1
- package/dist/auto.d.ts.map +0 -1
- package/dist/auto.js.map +0 -1
- package/dist/crypto.d.ts.map +0 -1
- package/dist/crypto.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/registry/cursor.d.ts +0 -25
- package/dist/registry/cursor.d.ts.map +0 -1
- package/dist/registry/cursor.js +0 -108
- package/dist/registry/cursor.js.map +0 -1
- package/dist/registry/glama.d.ts +0 -25
- package/dist/registry/glama.d.ts.map +0 -1
- package/dist/registry/glama.js +0 -111
- package/dist/registry/glama.js.map +0 -1
- package/dist/registry/index.d.ts.map +0 -1
- package/dist/registry/index.js.map +0 -1
- package/dist/registry/knowthat.d.ts.map +0 -1
- package/dist/registry/knowthat.js.map +0 -1
- package/dist/registry/smithery.d.ts +0 -29
- package/dist/registry/smithery.d.ts.map +0 -1
- package/dist/registry/smithery.js +0 -119
- package/dist/registry/smithery.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @kya-os/mcp-i
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The SEO package for AI agents. Register your MCP server and get automatic directory listings in 2 lines of code.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@kya-os/mcp-i)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -10,36 +10,25 @@ Give your MCP server a decentralized identity (DID) in 2 lines of code. Build re
|
|
|
10
10
|
|
|
11
11
|
**For MCP Server Developers:**
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
13
|
+
- **Get a DID** - Your agent gets a permanent, cryptographic identity from knowthat.ai
|
|
14
|
+
- **Automatic Directory Listings** - Submit to multiple directories with zero extra work
|
|
15
|
+
- **Build Reputation** - Every interaction is signed and verifiable
|
|
16
|
+
- **Future-Proof** - Ready for the decentralized agent ecosystem
|
|
17
|
+
- **Production-Ready** - Optimized for Lambda, Edge, Next.js, and traditional deployments
|
|
17
18
|
|
|
18
19
|
**For Directory Maintainers:**
|
|
19
20
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
21
|
+
- **Easy Integration** - List MCP-I compliant agents automatically
|
|
22
|
+
- **Verified Agents** - Only list agents with cryptographic proof
|
|
23
|
+
- **Join the Network** - Tap into the growing MCP-I ecosystem
|
|
23
24
|
|
|
24
|
-
##
|
|
25
|
+
## How It Works
|
|
25
26
|
|
|
26
|
-
Your
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- **Access APIs** that require identity verification (capability)
|
|
32
|
-
|
|
33
|
-
## 🚨 IMPORTANT: API Call Behavior
|
|
34
|
-
|
|
35
|
-
**This package is designed to be spam-free:**
|
|
36
|
-
|
|
37
|
-
- **First run only**: API calls happen ONLY on first initialization
|
|
38
|
-
- **Persistent identity**: After first run, loads from disk with ZERO API calls
|
|
39
|
-
- **No spam on restarts**: Restart your server 1000 times = still zero API calls
|
|
40
|
-
- **Rate limited**: Built-in protection against accidental registry spam
|
|
41
|
-
|
|
42
|
-
[Read the full API behavior guide →](./API_BEHAVIOR.md)
|
|
27
|
+
1. **Identity Registration**: Your agent is registered with knowthat.ai (the MCP-I registry)
|
|
28
|
+
2. **DID Generation**: You get a `did:web:knowthat.ai:agents:your-agent` identifier
|
|
29
|
+
3. **Directory Submission**: Based on your preferences, knowthat.ai submits your agent to directories
|
|
30
|
+
4. **Cryptographic Signing**: All agent responses are signed with your private key
|
|
31
|
+
5. **Verification**: Anyone can verify your agent's identity and authenticity
|
|
43
32
|
|
|
44
33
|
## Installation
|
|
45
34
|
|
|
@@ -56,206 +45,159 @@ import "@kya-os/mcp-i/auto";
|
|
|
56
45
|
// That's it! Your server now has cryptographic identity
|
|
57
46
|
```
|
|
58
47
|
|
|
59
|
-
### 2.
|
|
48
|
+
### 2. Production Configuration
|
|
60
49
|
|
|
61
50
|
```typescript
|
|
62
51
|
import { enableMCPIdentity } from "@kya-os/mcp-i";
|
|
63
52
|
|
|
64
|
-
await enableMCPIdentity({
|
|
65
|
-
name: "
|
|
66
|
-
description: "AI agent for professional calendar management",
|
|
67
|
-
repository: "https://github.com/your-org/calendar-assistant",
|
|
68
|
-
});
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Current State & Roadmap
|
|
53
|
+
const identity = await enableMCPIdentity({
|
|
54
|
+
name: "Production Agent",
|
|
72
55
|
|
|
73
|
-
|
|
56
|
+
// Auto-detect runtime (Lambda, Edge, Node.js)
|
|
57
|
+
storage: "auto",
|
|
58
|
+
transport: "auto",
|
|
74
59
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- ✅ Registered on KnowThat.ai registry
|
|
78
|
-
- ✅ Full MCP-I Level 2 conformance
|
|
60
|
+
// Encrypt private keys at rest
|
|
61
|
+
encryptionPassword: process.env.AGENT_KEY_PASSWORD,
|
|
79
62
|
|
|
80
|
-
|
|
63
|
+
// Professional logging
|
|
64
|
+
logLevel: "error", // or 'silent' for production
|
|
81
65
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
## What Happens Under the Hood
|
|
88
|
-
|
|
89
|
-
When you import this package:
|
|
66
|
+
// Directory preferences (optional)
|
|
67
|
+
directories: "verified", // List on all verified directories
|
|
68
|
+
// OR directories: ["smithery", "glama"] // Specific directories
|
|
69
|
+
// OR directories: "none" // No directory listings
|
|
70
|
+
});
|
|
90
71
|
|
|
91
|
-
|
|
72
|
+
// Enable automatic key rotation
|
|
73
|
+
await identity.enableAutoRotation({
|
|
74
|
+
maxAge: 90 * 24 * 60 * 60 * 1000, // 90 days
|
|
75
|
+
maxSignatures: 1_000_000, // 1M signatures
|
|
76
|
+
});
|
|
77
|
+
```
|
|
92
78
|
|
|
93
|
-
|
|
94
|
-
- Registers with KnowThat.ai to obtain a DID
|
|
95
|
-
- Saves identity to `.mcp-identity.json`
|
|
96
|
-
- Total time: ~2 seconds
|
|
79
|
+
### 3. Lambda/Edge Runtime
|
|
97
80
|
|
|
98
|
-
|
|
81
|
+
```typescript
|
|
82
|
+
// Automatic configuration for serverless
|
|
83
|
+
const identity = await enableMCPIdentity({
|
|
84
|
+
name: "Serverless Agent",
|
|
85
|
+
storage: "memory", // No file system needed
|
|
86
|
+
transport: "fetch", // Native fetch for edge
|
|
87
|
+
logLevel: "silent", // No console output
|
|
88
|
+
});
|
|
89
|
+
```
|
|
99
90
|
|
|
100
|
-
|
|
101
|
-
- Zero API calls, instant startup
|
|
102
|
-
- Maintains the same DID forever
|
|
91
|
+
## Production Features
|
|
103
92
|
|
|
104
|
-
|
|
105
|
-
- Every response includes `_mcp_identity` field with cryptographic signature
|
|
106
|
-
- Handles MCP-I challenge-response authentication automatically
|
|
107
|
-
- Advertises identity capabilities to clients
|
|
93
|
+
### Performance Optimizations
|
|
108
94
|
|
|
109
|
-
|
|
95
|
+
- **Lazy Loading**: Crypto libraries load only when needed
|
|
96
|
+
- **Signature Caching**: Repeated signatures are 10x faster
|
|
97
|
+
- **Precomputed Values**: DIDs and keys cached in memory
|
|
98
|
+
- **Optimized Transport**: Auto-selects axios vs fetch
|
|
110
99
|
|
|
111
|
-
|
|
100
|
+
### Security Features
|
|
112
101
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"type": "text",
|
|
118
|
-
"text": "Meeting scheduled for tomorrow at 2 PM"
|
|
119
|
-
}
|
|
120
|
-
],
|
|
121
|
-
"_mcp_identity": {
|
|
122
|
-
"did": "did:web:knowthat.ai:agents:calendar-assistant",
|
|
123
|
-
"signature": "0x3045...",
|
|
124
|
-
"timestamp": "2025-01-06T10:00:00Z",
|
|
125
|
-
"conformanceLevel": 2
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
```
|
|
102
|
+
- **Key Encryption**: Private keys encrypted with AES-256-GCM
|
|
103
|
+
- **Key Rotation**: Automatic rotation based on age/usage
|
|
104
|
+
- **Nonce Tracking**: Prevents replay attacks
|
|
105
|
+
- **Timestamp Validation**: Configurable tolerance windows
|
|
129
106
|
|
|
130
|
-
|
|
107
|
+
### Runtime Support
|
|
131
108
|
|
|
132
|
-
|
|
109
|
+
- **AWS Lambda**: Automatic memory storage
|
|
110
|
+
- **Vercel Edge**: Native fetch transport
|
|
111
|
+
- **Cloudflare Workers**: Full compatibility
|
|
112
|
+
- **Node.js**: Traditional file storage
|
|
133
113
|
|
|
134
|
-
|
|
114
|
+
### Directory Listings
|
|
135
115
|
|
|
136
116
|
```typescript
|
|
117
|
+
// Configure directory listings
|
|
137
118
|
await enableMCPIdentity({
|
|
138
119
|
name: "My Agent",
|
|
139
|
-
registries: "verified", // default
|
|
140
|
-
// Currently registers with KnowThat.ai
|
|
141
|
-
// Additional registries will be supported as they adopt MCP-I
|
|
142
|
-
});
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
**Note for Directory Maintainers:** Want to add your directory as a supported registry? [Contact us](https://github.com/orgs/modelcontextprotocol-identity/discussions/new?category=mcp-i-directories) to discuss integration.
|
|
146
120
|
|
|
147
|
-
|
|
121
|
+
// Option 1: List on all verified directories
|
|
122
|
+
directories: "verified",
|
|
148
123
|
|
|
149
|
-
|
|
124
|
+
// Option 2: List on specific directories
|
|
125
|
+
directories: ["smithery", "glama"],
|
|
150
126
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
name: "Enterprise Agent",
|
|
154
|
-
didHost: "company.com", // Creates did:web:company.com:agents:...
|
|
127
|
+
// Option 3: No directory listings (registry only)
|
|
128
|
+
directories: "none",
|
|
155
129
|
});
|
|
156
|
-
```
|
|
157
130
|
|
|
158
|
-
|
|
131
|
+
// Directory preferences are sent to knowthat.ai
|
|
132
|
+
// The registry handles submissions to your chosen directories
|
|
133
|
+
```
|
|
159
134
|
|
|
160
|
-
|
|
135
|
+
## Advanced Usage
|
|
161
136
|
|
|
162
|
-
|
|
137
|
+
### Key Rotation
|
|
163
138
|
|
|
164
139
|
```typescript
|
|
165
|
-
|
|
140
|
+
// Check key health
|
|
141
|
+
const health = identity.checkKeyHealth();
|
|
142
|
+
console.log(`Key age: ${health.age}ms`);
|
|
143
|
+
console.log(`Signatures: ${health.signatureCount}`);
|
|
144
|
+
console.log(`Should rotate: ${health.shouldRotate}`);
|
|
145
|
+
|
|
146
|
+
// Manual rotation
|
|
147
|
+
const result = await identity.rotateKeys("security-policy");
|
|
148
|
+
if (result.success) {
|
|
149
|
+
console.log(`Grace period ends: ${result.gracePeriodEnd}`);
|
|
150
|
+
}
|
|
166
151
|
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
//
|
|
152
|
+
// Automatic rotation
|
|
153
|
+
await identity.enableAutoRotation({
|
|
154
|
+
maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days
|
|
155
|
+
maxSignatures: 500_000, // 500k signatures
|
|
156
|
+
});
|
|
171
157
|
```
|
|
172
158
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
**Immediate Benefits:**
|
|
176
|
-
|
|
177
|
-
- 🛡️ **Cryptographic Identity**: Every response is signed with Ed25519
|
|
178
|
-
- 🆔 **Permanent DID**: Your agent gets a decentralized identifier that you control
|
|
179
|
-
- 🔐 **Impersonation Protection**: Nobody can pretend to be your agent
|
|
180
|
-
- ✅ **Verification Ready**: Cryptographic proof of authenticity
|
|
159
|
+
### Edit/Claim URLs
|
|
181
160
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
- 📈 **Reputation Building**: Verifiable interaction history across platforms
|
|
186
|
-
- 🚀 **Priority Access**: Identity-aware APIs will offer higher rate limits
|
|
187
|
-
- 🏆 **Trust Badges**: Stand out as an early adopter of decentralized identity
|
|
188
|
-
|
|
189
|
-
## How MCP-I Works
|
|
161
|
+
```typescript
|
|
162
|
+
// Get signed URLs for editing
|
|
163
|
+
const { editUrl, claimUrl } = await identity.requestEditAccess();
|
|
190
164
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
participant User
|
|
194
|
-
participant Client as AI Client
|
|
195
|
-
participant Agent as Your MCP Server
|
|
196
|
-
participant API as Protected API
|
|
165
|
+
// Edit URL - for existing agents
|
|
166
|
+
console.log("Edit your agent:", editUrl);
|
|
197
167
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
Note over Agent: Signs response with private key
|
|
201
|
-
Agent->>Client: Response + _mcp_identity
|
|
202
|
-
Client->>API: Forward request with identity
|
|
203
|
-
API->>API: Verify signature
|
|
204
|
-
API->>Client: Authorized response
|
|
205
|
-
Client->>User: "Meeting booked!"
|
|
168
|
+
// Claim URL - for draft/unclaimed agents
|
|
169
|
+
console.log("Claim your agent:", claimUrl);
|
|
206
170
|
```
|
|
207
171
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
After initialization, you'll see these files in your project root:
|
|
172
|
+
### Custom Storage
|
|
211
173
|
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
|
|
174
|
+
```typescript
|
|
175
|
+
// Encrypted file storage
|
|
176
|
+
await enableMCPIdentity({
|
|
177
|
+
storage: "file",
|
|
178
|
+
persistencePath: "/secure/location/.identity",
|
|
179
|
+
encryptionPassword: "strong-password",
|
|
180
|
+
});
|
|
215
181
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
"publicKey": "base64-encoded-public-key",
|
|
222
|
-
"privateKey": "base64-encoded-private-key", // Keep this secret!
|
|
223
|
-
"agentId": "uuid",
|
|
224
|
-
"agentSlug": "your-agent-slug",
|
|
225
|
-
"registeredAt": "2025-01-06T10:00:00Z",
|
|
226
|
-
"didHost": "knowthat.ai",
|
|
227
|
-
"registry": {
|
|
228
|
-
"name": "knowthat.ai",
|
|
229
|
-
"status": "active",
|
|
230
|
-
"url": "https://knowthat.ai/agents/your-agent-slug"
|
|
231
|
-
}
|
|
232
|
-
}
|
|
182
|
+
// Memory storage with custom key
|
|
183
|
+
await enableMCPIdentity({
|
|
184
|
+
storage: "memory",
|
|
185
|
+
memoryKey: "agent-123", // Useful for multiple agents
|
|
186
|
+
});
|
|
233
187
|
```
|
|
234
188
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
- 🔐 **Private keys never leave your server** - stored locally only
|
|
238
|
-
- ✍️ **Ed25519 signatures** - cryptographically secure
|
|
239
|
-
- 🛡️ **Replay protection** - timestamps and nonces prevent attacks
|
|
240
|
-
- 🔑 **Add `.mcp-identity.json` to .gitignore** - contains private key!
|
|
241
|
-
|
|
242
|
-
## Troubleshooting
|
|
243
|
-
|
|
244
|
-
### "Rate limit exceeded"
|
|
245
|
-
|
|
246
|
-
- Wait 1 hour before retrying
|
|
247
|
-
- Each IP can register 10 agents/hour on KnowThat.ai
|
|
248
|
-
|
|
249
|
-
### Agent not showing as verified
|
|
250
|
-
|
|
251
|
-
- Verification can take up to 5 minutes
|
|
252
|
-
- Check https://knowthat.ai/agents/YOUR-AGENT-SLUG
|
|
189
|
+
### Custom Logger
|
|
253
190
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
191
|
+
```typescript
|
|
192
|
+
await enableMCPIdentity({
|
|
193
|
+
logger: {
|
|
194
|
+
debug: (msg, ...args) => myLogger.debug(msg, args),
|
|
195
|
+
info: (msg, ...args) => myLogger.info(msg, args),
|
|
196
|
+
warn: (msg, ...args) => myLogger.warn(msg, args),
|
|
197
|
+
error: (msg, ...args) => myLogger.error(msg, args),
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
```
|
|
259
201
|
|
|
260
202
|
## API Reference
|
|
261
203
|
|
|
@@ -265,56 +207,90 @@ Main function to enable identity for your MCP server.
|
|
|
265
207
|
|
|
266
208
|
**Options:**
|
|
267
209
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
210
|
+
```typescript
|
|
211
|
+
interface MCPIdentityOptions {
|
|
212
|
+
// Basic info
|
|
213
|
+
name?: string;
|
|
214
|
+
description?: string;
|
|
215
|
+
repository?: string;
|
|
216
|
+
|
|
217
|
+
// Storage
|
|
218
|
+
storage?: "file" | "memory" | "auto";
|
|
219
|
+
persistencePath?: string;
|
|
220
|
+
memoryKey?: string;
|
|
221
|
+
encryptionPassword?: string;
|
|
222
|
+
|
|
223
|
+
// Transport
|
|
224
|
+
transport?: "axios" | "fetch" | "auto";
|
|
225
|
+
|
|
226
|
+
// Security
|
|
227
|
+
timestampTolerance?: number; // Default: 60000ms
|
|
228
|
+
enableNonceTracking?: boolean; // Default: true
|
|
229
|
+
|
|
230
|
+
// Directory listings
|
|
231
|
+
directories?: string[] | "verified" | "none"; // Default: "verified"
|
|
232
|
+
|
|
233
|
+
// Development
|
|
234
|
+
mode?: "development" | "production";
|
|
235
|
+
|
|
236
|
+
// Logging
|
|
237
|
+
logger?: Logger;
|
|
238
|
+
logLevel?: "debug" | "info" | "warn" | "error" | "silent";
|
|
239
|
+
}
|
|
240
|
+
```
|
|
274
241
|
|
|
275
|
-
### `MCPIdentity`
|
|
242
|
+
### `MCPIdentity` Methods
|
|
276
243
|
|
|
277
|
-
|
|
244
|
+
- `sign(message)`: Sign with caching
|
|
245
|
+
- `verify(message, signature, publicKey?)`: Verify signatures
|
|
246
|
+
- `respondToChallenge(challenge)`: MCP-I authentication
|
|
247
|
+
- `signResponse(response)`: Add identity to responses
|
|
248
|
+
- `requestEditAccess()`: Get edit/claim URLs
|
|
249
|
+
- `rotateKeys(reason?)`: Manual key rotation
|
|
250
|
+
- `enableAutoRotation(policy?)`: Automatic rotation
|
|
251
|
+
- `checkKeyHealth()`: Key rotation status
|
|
278
252
|
|
|
279
|
-
|
|
280
|
-
- `verify(message, signature)`: Verify a signature
|
|
281
|
-
- `respondToChallenge(challenge)`: Handle MCP-I authentication
|
|
282
|
-
- `signResponse(response)`: Add identity to any response
|
|
283
|
-
- `requestEditAccess()`: Get edit URL for your agent profile
|
|
284
|
-
- `getRegistryStatus()`: Check registration status
|
|
253
|
+
## Files Created
|
|
285
254
|
|
|
286
|
-
|
|
255
|
+
```
|
|
256
|
+
.mcp-identity.json # Your agent's identity (encrypted if password set)
|
|
257
|
+
```
|
|
287
258
|
|
|
288
|
-
|
|
289
|
-
A: No, this is a community package implementing the MCP-I specification.
|
|
259
|
+
## Security Best Practices
|
|
290
260
|
|
|
291
|
-
**
|
|
292
|
-
|
|
261
|
+
1. **Use encryption in production**: Always set `encryptionPassword`
|
|
262
|
+
2. **Enable key rotation**: Set up automatic rotation policies
|
|
263
|
+
3. **Secure storage**: Use appropriate file permissions
|
|
264
|
+
4. **Monitor key health**: Check rotation status regularly
|
|
265
|
+
5. **Add to .gitignore**: Never commit identity files
|
|
293
266
|
|
|
294
|
-
|
|
295
|
-
A: After initial registration, your agent works offline. The DID is self-contained.
|
|
267
|
+
## Performance Tips
|
|
296
268
|
|
|
297
|
-
**
|
|
298
|
-
|
|
269
|
+
1. **Use memory storage** for Lambda/Edge runtimes
|
|
270
|
+
2. **Enable signature caching** (automatic)
|
|
271
|
+
3. **Use 'silent' log level** in production
|
|
272
|
+
4. **Let transport auto-select** based on runtime
|
|
273
|
+
5. **Preload identity** during cold starts
|
|
299
274
|
|
|
300
|
-
|
|
301
|
-
A: We're building the ecosystem! As directories adopt MCP-I, your agent will automatically be discoverable across all of them.
|
|
275
|
+
## Troubleshooting
|
|
302
276
|
|
|
303
|
-
|
|
304
|
-
A: [Contact us](https://github.com/kya-os/mcp-i/issues) to discuss integration. We're actively seeking directory partners.
|
|
277
|
+
### Lambda/Edge Issues
|
|
305
278
|
|
|
306
|
-
|
|
307
|
-
|
|
279
|
+
- Ensure `storage: 'memory'` or `'auto'`
|
|
280
|
+
- Use `transport: 'fetch'` for edge runtimes
|
|
281
|
+
- Set `logLevel: 'silent'` to avoid console issues
|
|
308
282
|
|
|
309
|
-
|
|
283
|
+
### Key Rotation Failures
|
|
310
284
|
|
|
311
|
-
|
|
285
|
+
- Check network connectivity to knowthat.ai
|
|
286
|
+
- Verify current keys are not corrupted
|
|
287
|
+
- Manual rotation: `await identity.rotateKeys('recovery')`
|
|
312
288
|
|
|
313
|
-
|
|
314
|
-
npm install @kya-os/mcp-i
|
|
315
|
-
```
|
|
289
|
+
### Performance Issues
|
|
316
290
|
|
|
317
|
-
|
|
291
|
+
- Verify signature caching is working
|
|
292
|
+
- Check lazy loading (should see delayed first signature)
|
|
293
|
+
- Use memory storage when possible
|
|
318
294
|
|
|
319
295
|
## License
|
|
320
296
|
|
package/dist/auto.d.ts
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auto-initialization for MCP Identity
|
|
3
|
-
*
|
|
4
|
-
* Just import this file to automatically enable MCP-I for any MCP server:
|
|
5
|
-
*
|
|
6
|
-
* ```typescript
|
|
7
|
-
* import "@kya-os/mcp-i/auto";
|
|
8
|
-
* ```
|
|
9
|
-
*
|
|
10
|
-
* That's it! Your MCP server now has identity.
|
|
11
|
-
*/
|
|
12
1
|
export {};
|
|
13
|
-
//# sourceMappingURL=auto.d.ts.map
|
package/dist/auto.js
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Auto-initialization for MCP Identity
|
|
4
|
-
*
|
|
5
|
-
* Just import this file to automatically enable MCP-I for any MCP server:
|
|
6
|
-
*
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import "@kya-os/mcp-i/auto";
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* That's it! Your MCP server now has identity.
|
|
12
|
-
*/
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
const index_1 = require("./index");
|
|
15
|
-
|
|
4
|
+
const logger_1 = require("./logger");
|
|
16
5
|
(async () => {
|
|
17
6
|
try {
|
|
18
7
|
await (0, index_1.enableMCPIdentity)();
|
|
19
8
|
}
|
|
20
9
|
catch (error) {
|
|
21
|
-
|
|
10
|
+
const logger = (0, logger_1.getLogger)();
|
|
11
|
+
logger.error('[MCP-I] Failed to auto-initialize:', error);
|
|
22
12
|
}
|
|
23
13
|
})();
|
|
24
|
-
//# sourceMappingURL=auto.js.map
|
package/dist/crypto.d.ts
CHANGED
|
@@ -1,32 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
* Cryptographic utilities for MCP-I
|
|
3
|
-
* Implements Ed25519 signing and verification for challenge-response authentication
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Generate a new Ed25519 key pair
|
|
7
|
-
*/
|
|
8
|
-
export declare function generateKeyPair(): Promise<{
|
|
1
|
+
export interface PrecomputedKeyPair {
|
|
9
2
|
publicKey: string;
|
|
10
3
|
privateKey: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
publicKeyBytes?: Uint8Array;
|
|
5
|
+
privateKeyBytes?: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
export declare function generateKeyPair(): Promise<PrecomputedKeyPair>;
|
|
15
8
|
export declare function sign(message: string | Buffer, privateKeyBase64: string): Promise<string>;
|
|
16
|
-
/**
|
|
17
|
-
* Verify an Ed25519 signature
|
|
18
|
-
*/
|
|
19
9
|
export declare function verify(message: string | Buffer, signatureBase64: string, publicKeyBase64: string): Promise<boolean>;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
export declare function generateNonce(length?: number): string;
|
|
24
|
-
/**
|
|
25
|
-
* Constant-time string comparison to prevent timing attacks
|
|
26
|
-
*/
|
|
10
|
+
export declare function generateNonce(length?: number): Promise<string>;
|
|
11
|
+
export declare function generateNonceSync(length?: number): string;
|
|
27
12
|
export declare function constantTimeEqual(a: string, b: string): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Convert Ed25519 public key to did:key format
|
|
30
|
-
*/
|
|
31
13
|
export declare function publicKeyToDid(publicKeyBase64: string): string;
|
|
32
|
-
|
|
14
|
+
export declare function encrypt(data: string, password: string): Promise<string>;
|
|
15
|
+
export declare function decrypt(encryptedData: string, password: string): Promise<string>;
|
|
16
|
+
export declare function clearCache(): void;
|