@kya-os/mcp-i 0.1.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/README.md +406 -71
  2. package/dist/149.js +1 -0
  3. package/dist/189.js +1 -0
  4. package/dist/261.js +1 -0
  5. package/dist/28.js +1 -0
  6. package/dist/295.js +1 -0
  7. package/dist/460.js +1 -0
  8. package/dist/570.js +1 -0
  9. package/dist/634.js +1 -0
  10. package/dist/647.js +1 -0
  11. package/dist/67.js +1 -0
  12. package/dist/739.js +1 -0
  13. package/dist/742.js +1 -0
  14. package/dist/904.js +1 -0
  15. package/dist/938.js +1 -0
  16. package/dist/auth/api-key.d.ts +16 -0
  17. package/dist/auth/api-key.js +82 -0
  18. package/dist/auth/jwt.d.ts +43 -0
  19. package/dist/auth/jwt.js +51 -0
  20. package/dist/auth/oauth/factory.d.ts +12 -0
  21. package/dist/auth/oauth/factory.js +36 -0
  22. package/dist/auth/oauth/index.d.ts +5 -0
  23. package/dist/auth/oauth/index.js +27 -0
  24. package/dist/auth/oauth/providers/proxy-provider.d.ts +13 -0
  25. package/dist/auth/oauth/providers/proxy-provider.js +159 -0
  26. package/dist/auth/oauth/router.d.ts +4 -0
  27. package/dist/auth/oauth/router.js +294 -0
  28. package/dist/auth/oauth/storage/memory-storage.d.ts +12 -0
  29. package/dist/auth/oauth/storage/memory-storage.js +40 -0
  30. package/dist/auth/oauth/types.d.ts +112 -0
  31. package/dist/auth/oauth/types.js +2 -0
  32. package/dist/cache/__tests__/cloudflare-kv-nonce-cache.test.d.ts +4 -0
  33. package/dist/cache/__tests__/cloudflare-kv-nonce-cache.test.js +176 -0
  34. package/dist/cache/__tests__/concurrency.test.d.ts +5 -0
  35. package/dist/cache/__tests__/concurrency.test.js +300 -0
  36. package/dist/cache/__tests__/dynamodb-nonce-cache.test.d.ts +4 -0
  37. package/dist/cache/__tests__/dynamodb-nonce-cache.test.js +176 -0
  38. package/dist/cache/__tests__/memory-nonce-cache.test.d.ts +4 -0
  39. package/dist/cache/__tests__/memory-nonce-cache.test.js +132 -0
  40. package/dist/cache/__tests__/nonce-cache-factory-simple.test.d.ts +4 -0
  41. package/dist/cache/__tests__/nonce-cache-factory-simple.test.js +133 -0
  42. package/dist/cache/__tests__/nonce-cache-factory.test.d.ts +4 -0
  43. package/dist/cache/__tests__/nonce-cache-factory.test.js +252 -0
  44. package/dist/cache/__tests__/redis-nonce-cache.test.d.ts +4 -0
  45. package/dist/cache/__tests__/redis-nonce-cache.test.js +95 -0
  46. package/dist/cache/cloudflare-kv-nonce-cache.d.ts +14 -0
  47. package/dist/cache/cloudflare-kv-nonce-cache.js +93 -0
  48. package/dist/cache/dynamodb-nonce-cache.d.ts +15 -0
  49. package/dist/cache/dynamodb-nonce-cache.js +92 -0
  50. package/dist/cache/index.d.ts +16 -0
  51. package/dist/cache/index.js +32 -0
  52. package/dist/cache/memory-nonce-cache.d.ts +44 -0
  53. package/dist/cache/memory-nonce-cache.js +105 -0
  54. package/dist/cache/nonce-cache-factory.d.ts +20 -0
  55. package/dist/cache/nonce-cache-factory.js +208 -0
  56. package/dist/cache/redis-nonce-cache.d.ts +14 -0
  57. package/dist/cache/redis-nonce-cache.js +53 -0
  58. package/dist/compiler/compiler-context.d.ts +23 -0
  59. package/dist/compiler/compiler-context.js +24 -0
  60. package/dist/compiler/config/constants.d.ts +41 -0
  61. package/dist/compiler/config/constants.js +45 -0
  62. package/dist/compiler/config/index.d.ts +252 -0
  63. package/dist/compiler/config/index.js +15 -0
  64. package/dist/compiler/config/injection.d.ts +26 -0
  65. package/dist/compiler/config/injection.js +58 -0
  66. package/dist/compiler/config/schemas/experimental/index.d.ts +91 -0
  67. package/dist/compiler/config/schemas/experimental/index.js +16 -0
  68. package/dist/compiler/config/schemas/experimental/oauth.d.ts +74 -0
  69. package/dist/compiler/config/schemas/experimental/oauth.js +25 -0
  70. package/dist/compiler/config/schemas/index.d.ts +6 -0
  71. package/dist/compiler/config/schemas/index.js +17 -0
  72. package/dist/compiler/config/schemas/paths.d.ts +9 -0
  73. package/dist/compiler/config/schemas/paths.js +12 -0
  74. package/dist/compiler/config/schemas/transport/http.d.ts +82 -0
  75. package/dist/compiler/config/schemas/transport/http.js +33 -0
  76. package/dist/compiler/config/schemas/transport/stdio.d.ts +9 -0
  77. package/dist/compiler/config/schemas/transport/stdio.js +15 -0
  78. package/dist/compiler/config/schemas/webpack.d.ts +3 -0
  79. package/dist/compiler/config/schemas/webpack.js +15 -0
  80. package/dist/compiler/config/types.d.ts +1 -0
  81. package/dist/compiler/config/types.js +2 -0
  82. package/dist/compiler/config/utils.d.ts +20 -0
  83. package/dist/compiler/config/utils.js +36 -0
  84. package/dist/compiler/generate-env-code.d.ts +1 -0
  85. package/dist/compiler/generate-env-code.js +8 -0
  86. package/dist/compiler/generate-import-code.d.ts +1 -0
  87. package/dist/compiler/generate-import-code.js +24 -0
  88. package/dist/compiler/get-webpack-config/get-entries.d.ts +3 -0
  89. package/dist/compiler/get-webpack-config/get-entries.js +29 -0
  90. package/dist/compiler/get-webpack-config/get-externals.d.ts +7 -0
  91. package/dist/compiler/get-webpack-config/get-externals.js +88 -0
  92. package/dist/compiler/get-webpack-config/get-injected-variables.d.ts +8 -0
  93. package/dist/compiler/get-webpack-config/get-injected-variables.js +25 -0
  94. package/dist/compiler/get-webpack-config/index.d.ts +4 -0
  95. package/dist/compiler/get-webpack-config/index.js +101 -0
  96. package/dist/compiler/get-webpack-config/plugins.d.ts +8 -0
  97. package/dist/compiler/get-webpack-config/plugins.js +132 -0
  98. package/dist/compiler/get-webpack-config/resolve-tsconfig-paths.d.ts +9 -0
  99. package/dist/compiler/get-webpack-config/resolve-tsconfig-paths.js +40 -0
  100. package/dist/compiler/index.d.ts +6 -0
  101. package/dist/compiler/index.js +194 -0
  102. package/dist/compiler/on-first-build.d.ts +3 -0
  103. package/dist/compiler/on-first-build.js +58 -0
  104. package/dist/compiler/parse-xmcp-config.d.ts +9 -0
  105. package/dist/compiler/parse-xmcp-config.js +155 -0
  106. package/dist/compiler/start-http-server.d.ts +1 -0
  107. package/dist/compiler/start-http-server.js +34 -0
  108. package/dist/index.d.ts +12 -54
  109. package/dist/index.js +22 -190
  110. package/dist/index.js.LICENSE.txt +49 -0
  111. package/dist/runtime/__tests__/audit.test.d.ts +4 -0
  112. package/dist/runtime/__tests__/audit.test.js +328 -0
  113. package/dist/runtime/__tests__/identity.test.d.ts +4 -0
  114. package/dist/runtime/__tests__/identity.test.js +164 -0
  115. package/dist/runtime/__tests__/mcpi-runtime.test.d.ts +4 -0
  116. package/dist/runtime/__tests__/mcpi-runtime.test.js +372 -0
  117. package/dist/runtime/__tests__/proof.test.d.ts +4 -0
  118. package/dist/runtime/__tests__/proof.test.js +302 -0
  119. package/dist/runtime/__tests__/session.test.d.ts +4 -0
  120. package/dist/runtime/__tests__/session.test.js +254 -0
  121. package/dist/runtime/__tests__/well-known.test.d.ts +4 -0
  122. package/dist/runtime/__tests__/well-known.test.js +312 -0
  123. package/dist/runtime/adapter-express.js +2 -0
  124. package/dist/runtime/adapter-express.js.LICENSE.txt +252 -0
  125. package/dist/runtime/adapter-nextjs.js +2 -0
  126. package/dist/runtime/adapter-nextjs.js.LICENSE.txt +53 -0
  127. package/dist/runtime/adapters/express/index.d.ts +2 -0
  128. package/dist/runtime/adapters/express/index.js +48 -0
  129. package/dist/runtime/adapters/nextjs/index.d.ts +8 -0
  130. package/dist/runtime/adapters/nextjs/index.js +18 -0
  131. package/dist/runtime/audit.d.ts +93 -0
  132. package/dist/runtime/audit.js +212 -0
  133. package/dist/runtime/debug.d.ts +118 -0
  134. package/dist/runtime/debug.js +612 -0
  135. package/dist/runtime/delegation-hooks.d.ts +85 -0
  136. package/dist/runtime/delegation-hooks.js +116 -0
  137. package/dist/runtime/demo.d.ts +71 -0
  138. package/dist/runtime/demo.js +135 -0
  139. package/dist/runtime/headers.d.ts +1 -0
  140. package/dist/runtime/headers.js +9 -0
  141. package/dist/runtime/http.js +2 -0
  142. package/dist/runtime/http.js.LICENSE.txt +252 -0
  143. package/dist/runtime/identity.d.ts +105 -0
  144. package/dist/runtime/identity.js +232 -0
  145. package/dist/runtime/index.d.ts +16 -0
  146. package/dist/runtime/index.js +56 -0
  147. package/dist/runtime/mcpi-runtime.d.ts +164 -0
  148. package/dist/runtime/mcpi-runtime.js +352 -0
  149. package/dist/runtime/proof.d.ts +87 -0
  150. package/dist/runtime/proof.js +223 -0
  151. package/dist/runtime/session.d.ts +88 -0
  152. package/dist/runtime/session.js +216 -0
  153. package/dist/runtime/stdio.js +2 -0
  154. package/dist/runtime/stdio.js.LICENSE.txt +1 -0
  155. package/dist/runtime/templates/home.d.ts +2 -0
  156. package/dist/runtime/templates/home.js +50 -0
  157. package/dist/runtime/transports/http/base-streamable-http.d.ts +25 -0
  158. package/dist/runtime/transports/http/base-streamable-http.js +16 -0
  159. package/dist/runtime/transports/http/http-context.d.ts +9 -0
  160. package/dist/runtime/transports/http/http-context.js +8 -0
  161. package/dist/runtime/transports/http/index.d.ts +1 -0
  162. package/dist/runtime/transports/http/index.js +55 -0
  163. package/dist/runtime/transports/http/setup-cors.d.ts +4 -0
  164. package/dist/runtime/transports/http/setup-cors.js +24 -0
  165. package/dist/runtime/transports/http/stateless-streamable-http.d.ts +39 -0
  166. package/dist/runtime/transports/http/stateless-streamable-http.js +331 -0
  167. package/dist/runtime/transports/stdio/index.d.ts +1 -0
  168. package/dist/runtime/transports/stdio/index.js +51 -0
  169. package/dist/runtime/utils/server.d.ts +42 -0
  170. package/dist/runtime/utils/server.js +39 -0
  171. package/dist/runtime/utils/tools.d.ts +8 -0
  172. package/dist/runtime/utils/tools.js +115 -0
  173. package/dist/runtime/verifier-middleware.d.ts +76 -0
  174. package/dist/runtime/verifier-middleware.js +322 -0
  175. package/dist/runtime/well-known.d.ts +151 -0
  176. package/dist/runtime/well-known.js +258 -0
  177. package/dist/storage/config.d.ts +28 -0
  178. package/dist/storage/config.js +79 -0
  179. package/dist/storage/delegation.d.ts +59 -0
  180. package/dist/storage/delegation.js +130 -0
  181. package/dist/storage/merkle-verifier.d.ts +84 -0
  182. package/dist/storage/merkle-verifier.js +261 -0
  183. package/dist/test/__tests__/nonce-cache-integration.test.d.ts +1 -0
  184. package/dist/test/__tests__/nonce-cache-integration.test.js +116 -0
  185. package/dist/test/__tests__/nonce-cache.test.d.ts +1 -0
  186. package/dist/test/__tests__/nonce-cache.test.js +122 -0
  187. package/dist/test/__tests__/runtime-integration.test.d.ts +4 -0
  188. package/dist/test/__tests__/runtime-integration.test.js +192 -0
  189. package/dist/test/__tests__/test-infrastructure.test.d.ts +4 -0
  190. package/dist/test/__tests__/test-infrastructure.test.js +178 -0
  191. package/dist/test/deterministic-keys.d.ts +31 -0
  192. package/dist/test/deterministic-keys.js +108 -0
  193. package/dist/test/examples/test-usage-example.d.ts +140 -0
  194. package/dist/test/examples/test-usage-example.js +175 -0
  195. package/dist/test/index.d.ts +11 -0
  196. package/dist/test/index.js +27 -0
  197. package/dist/test/local-verification.d.ts +28 -0
  198. package/dist/test/local-verification.js +342 -0
  199. package/dist/test/mock-identity-provider.d.ts +96 -0
  200. package/dist/test/mock-identity-provider.js +243 -0
  201. package/dist/test/runtime-integration.d.ts +63 -0
  202. package/dist/test/runtime-integration.js +140 -0
  203. package/dist/test/test-environment.d.ts +26 -0
  204. package/dist/test/test-environment.js +50 -0
  205. package/dist/types/declarations.d.ts +1 -0
  206. package/dist/types/declarations.js +6 -0
  207. package/dist/types/middleware.d.ts +2 -0
  208. package/dist/types/middleware.js +2 -0
  209. package/dist/types/tool.d.ts +80 -0
  210. package/dist/types/tool.js +2 -0
  211. package/dist/utils/cli-icons.d.ts +3 -0
  212. package/dist/utils/cli-icons.js +7 -0
  213. package/dist/utils/constants.d.ts +6 -0
  214. package/dist/utils/constants.js +13 -0
  215. package/dist/utils/context.d.ts +33 -0
  216. package/dist/utils/context.js +58 -0
  217. package/dist/utils/file-watcher.d.ts +19 -0
  218. package/dist/utils/file-watcher.js +49 -0
  219. package/dist/utils/fs-utils.d.ts +2 -0
  220. package/dist/utils/fs-utils.js +22 -0
  221. package/dist/utils/path-validation.d.ts +3 -0
  222. package/dist/utils/path-validation.js +56 -0
  223. package/dist/utils/spawn-process.d.ts +9 -0
  224. package/dist/utils/spawn-process.js +50 -0
  225. package/dist/utils/subscribable.d.ts +12 -0
  226. package/dist/utils/subscribable.js +44 -0
  227. package/package.json +99 -21
  228. package/dist/index.d.ts.map +0 -1
  229. package/dist/index.js.map +0 -1
package/README.md CHANGED
@@ -1,117 +1,452 @@
1
- # @kya-os/mcp-i
1
+ <div align="center">
2
+ <a href="https://github.com/modelcontextprotocol-identity/xmcp-i">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/modelcontextprotocol-identity/xmcp-i/main/assets/mcp-i-logo-dark.png">
5
+ <img alt="MCP-I logo" src="https://raw.githubusercontent.com/modelcontextprotocol-identity/xmcp-i/main/assets/mcp-i-logo-light.png" height="128">
6
+ </picture>
7
+ </a>
8
+ <h1>xmcp-i</h1>
2
9
 
3
- Ultra-light MCP Identity auto-registration - Get agent identity with just 2 lines of code!
10
+ <a href="https://github.com/modelcontextprotocol-identity/xmcp-i"><img alt="XMCP-I" src="https://img.shields.io/badge/XMCP--I-000000.svg?style=for-the-badge&labelColor=000"></a>
11
+ <a href="https://www.npmjs.com/package/xmcp-i"><img alt="NPM version" src="https://img.shields.io/npm/v/xmcp-i.svg?style=for-the-badge&labelColor=000000"></a>
12
+ <a href="https://github.com/modelcontextprotocol-identity/xmcp-i/blob/main/license.md"><img alt="License" src="https://img.shields.io/npm/l/xmcp-i.svg?style=for-the-badge&labelColor=000000"></a>
4
13
 
5
- ## 🚀 Installation
14
+ </div>
15
+
16
+ ## Own Your AI Agent with Cryptographic Identity
17
+
18
+ `xmcp-i` enables you to **create your own AI agents** with cryptographic identity and secure delegation. Register and claim your agents with [knowthat.ai](https://knowthat.ai), store your identity securely within them, and delegate or revoke permissions as needed. Built on the XMCP framework with identity features baked in from day one.
19
+
20
+ ## Quick Start
21
+
22
+ Create your first owned AI agent:
23
+
24
+ ```bash
25
+ npx @kya-os/create-xmcpi-app@latest my-agent
26
+ ```
27
+
28
+ Then register and claim ownership at [knowthat.ai](https://knowthat.ai)
29
+
30
+ > **New to XMCP-I?** Use [`@kya-os/create-xmcpi-app`](https://www.npmjs.com/package/@kya-os/create-xmcpi-app) to scaffold a complete agent with identity. For existing projects, install `@kya-os/xmcpi` directly.
31
+
32
+ ## Installation
33
+
34
+ ### For New Projects
35
+
36
+ ```bash
37
+ npx create-xmcpi-app@latest my-agent
38
+ ```
39
+
40
+ ### For Existing Projects
41
+
42
+ ```bash
43
+ npx init-xmcp-i@latest
44
+ ```
45
+
46
+ This will add identity features to your existing Node.js/TypeScript project with automatic framework detection and configuration.
47
+
48
+ ## Why Agent Ownership Matters
49
+
50
+ ⊹ **True Ownership** - Your agent belongs to you, not a platform\
51
+ ⊹ **Cryptographic Security** - Ed25519 keys and DID-based identity\
52
+ ⊹ **Permission Control** - Delegate and revoke capabilities securely\
53
+ ⊹ **Verifiable Actions** - All responses are cryptographically signed\
54
+ ⊹ **Decentralized Trust** - No central authority controls your agent\
55
+ ⊹ **Portable Identity** - Move your agent between platforms while keeping ownership
56
+
57
+ ### Cryptographic Foundation
58
+
59
+ - **DID Generation**: Decentralized identifiers from public keys
60
+ - **Automatic Signing**: All responses signed with your private key
61
+ - **Key Security**: Private keys never leave your control
62
+
63
+ ## Security and Trust
64
+
65
+ **Agent Ownership Verification**: Every XMCP-I agent generates a cryptographic proof of ownership that can be verified independently. When you register your agent with knowthat.ai, you establish a permanent, tamper-proof claim to your agent's identity.
66
+
67
+ **Decentralized Trust**: Your agent's identity doesn't depend on any central authority. The cryptographic keys are generated locally and never shared. Even if knowthat.ai goes offline, your agent retains its identity and ownership proof.
68
+
69
+ **Secure Delegation**: Permission delegation uses time-bound, cryptographically signed tokens. You can grant specific capabilities to other users or systems, with full audit trails and instant revocation capabilities.
70
+
71
+ ## Real-World Benefits for Developers & Businesses
72
+
73
+ ### Privacy-First Tracking & Analytics
74
+
75
+ Unlike traditional web tracking (cookies, pixels), XMCP-I provides **ethical data collection**:
76
+
77
+ - Users can see exactly what data is stored about them
78
+ - Users can revoke access instantly at any time
79
+ - Businesses get analytics for retargeting without violating privacy
80
+ - Think "GDPR-compliant by design" - users control their data completely
81
+
82
+ ### XMCP-I Allows AI in Regulated Industries
83
+
84
+ Industries like healthcare, law, and finance can now use AI while maintaining compliance:
85
+
86
+ **The Problem**: These industries need AI efficiency but can't use most AI services due to:
87
+
88
+ - Data privacy regulations (HIPAA, GDPR, SOX)
89
+ - Audit requirements (who did what, when?)
90
+ - Client confidentiality obligations
91
+
92
+ **The Solution**: XMCP-I provides:
93
+
94
+ - **Provable Privacy**: Cryptographic proof of data handling
95
+ - **Complete Audit Trails**: Every AI action is signed and traceable
96
+ - **User Control**: Clients can revoke AI access to their data instantly
97
+ - **Regulatory Compliance**: Built-in features for GDPR, HIPAA, etc.
98
+ - **EU AI Act Compliance**: Built-in audit trails and user consent mechanisms
99
+
100
+ **Real Example**: A law firm can now use AI for document review because:
101
+
102
+ - Clients control exactly which documents the AI can access
103
+ - All AI actions are cryptographically logged
104
+ - Clients can revoke access immediately if they switch firms
105
+ - The firm can prove to regulators exactly how data was handled
106
+
107
+ ## Installation
108
+
109
+ ### For New Projects
110
+
111
+ ```bash
112
+ npx @kya-os/create-xmcpi-app@latest my-agent
113
+ ```
114
+
115
+ ### For Existing Projects
116
+
117
+ ```bash
118
+ npm install @kya-os/xmcpi
119
+ # or
120
+ yarn add @kya-os/xmcpi
121
+ # or
122
+ pnpm add @kya-os/xmcpi
123
+ ```
124
+
125
+ ## Migrating from XMCP
126
+
127
+ Your existing XMCP agents can gain ownership capabilities:
128
+
129
+ ```typescript
130
+ // Before (original XMCP - platform owned)
131
+ import { createXMCPServer } from "xmcp";
132
+
133
+ // After (XMCP-I - you own the agent!)
134
+ import { createXMCPServer } from "xmcp-i";
135
+ ```
136
+
137
+ Your existing code works unchanged, but now your agent:
138
+
139
+ - ✅ Has its own cryptographic identity
140
+ - ✅ Can be registered and claimed by you at knowthat.ai
141
+ - ✅ Signs all responses automatically
142
+ - ✅ Supports secure permission delegation
143
+ - ✅ Provides verifiable ownership proof
144
+
145
+ ## Core Identity Features
146
+
147
+ ### Agent Identity Verification
148
+
149
+ Your agent provides cryptographic proof of ownership:
6
150
 
7
151
  ```bash
8
- npm install @kya-os/mcp-i
152
+ # Your agent's identity includes:
153
+ {
154
+ "did": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK",
155
+ "publicKey": "-----BEGIN PUBLIC KEY-----\n...",
156
+ "privateKey": "-----BEGIN PRIVATE KEY-----\n...", // Never shared
157
+ "agentId": "agent-abc123...",
158
+ "capabilities": {
159
+ "tools": true,
160
+ "signing": true,
161
+ "verification": true,
162
+ "delegation": true
163
+ }
164
+ }
9
165
  ```
10
166
 
11
- ## 💡 Usage
167
+ - **Public Key**: Can be shared and verified by anyone
168
+ - **Private Key**: Never leaves your control, stored securely locally
169
+ - **DID**: Globally unique identifier generated from your public key
170
+ - **Signatures**: All agent responses include cryptographic signatures
171
+
172
+ ### Trust Infrastructure
173
+
174
+ - `GET /.well-known/mcp-identity/health` - Health check with identity
175
+ - `GET /.well-known/mcp-identity/self` - Agent identity information
176
+ - `POST /.well-known/mcp-identity/verify` - Verify signatures
177
+ - `GET /.well-known/mcp-identity/resolve/:did` - Resolve DIDs
178
+
179
+ ### Built-in Identity Tools & Self-Sovereign Features
180
+
181
+ - `get-identity-info` - Comprehensive agent identity details
182
+ - `sign-message` - Sign messages with your private key
183
+ - `verify-signature` - Verify signatures against DIDs
184
+ - `get-server-status` - Agent status with identity information
185
+ - `get-user-data` - Allow users to see all stored data about them
186
+ - `revoke-user-access` - Let users instantly revoke AI access to their data
187
+ - `export-user-data` - Enable users to export their data for portability
188
+
189
+ ## Secure Permission Delegation
190
+
191
+ Control what your agent can do and for whom:
12
192
 
13
193
  ```typescript
14
- import { MCPIdentity } from "@kya-os/mcp-i";
194
+ // Delegate specific permissions to other DIDs
195
+ await agent.delegate({
196
+ to: "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK",
197
+ permissions: ["read:data", "execute:safe-actions"],
198
+ expires: new Date("2025-12-31"),
199
+ conditions: {
200
+ rate_limit: "100/hour",
201
+ allowed_tools: ["get-weather", "search-docs"],
202
+ },
203
+ });
204
+
205
+ // Revoke permissions instantly
206
+ await agent.revoke({
207
+ delegation_id: "del_abc123",
208
+ reason: "Project completed",
209
+ });
210
+
211
+ // All delegation changes are cryptographically signed and verifiable
212
+ ```
213
+
214
+ ### Secure Delegation Example
15
215
 
16
- // That's it! Your MCP server now has identity
17
- const identity = await MCPIdentity.init();
216
+ Grant specific permissions to other users while maintaining ownership:
18
217
 
19
- console.log("My DID:", identity.did);
20
- // Output: did:web:knowthat.ai:agents:your-server-name
218
+ ```typescript
219
+ // Example: Grant read-only access to specific tools
220
+ await agent.delegate({
221
+ to: "user@example.com",
222
+ permissions: ["read:weather", "read:docs"],
223
+ expires: "2025-12-31T23:59:59Z",
224
+ conditions: { rate_limit: "100/hour" },
225
+ });
21
226
  ```
22
227
 
23
- ## 🎯 What It Does
228
+ ## Platform Support with Identity Persistence
229
+
230
+ Deploy your owned agents anywhere with secure identity storage:
231
+
232
+ ### Vercel
233
+
234
+ - **Edge Runtime**: Fast cold starts with identity context
235
+ - **KV Storage**: Secure identity persistence using Vercel KV
236
+ - **Zero Config**: Deploy with `vercel --prod` and identity works
237
+ - **Environment**: Automatic identity configuration and key management
24
238
 
25
- 1. **First Run**: Automatically registers your MCP server with knowthat.ai
26
- 2. **Gets DID**: Receives a decentralized identifier for your agent
27
- 3. **Saves Identity**: Stores credentials in `.env.local` and `.mcp-identity.json`
28
- 4. **Future Runs**: Loads existing identity (no re-registration)
239
+ ### AWS Lambda
29
240
 
30
- ## Features
241
+ - **Cold Start Optimized**: Minimal initialization with cached identity
242
+ - **DynamoDB**: Secure identity storage with DynamoDB persistence
243
+ - **Serverless**: Built-in serverless framework configuration
244
+ - **IAM Integration**: Pre-configured identity and permission policies
31
245
 
32
- - **Zero Configuration**: Works out of the box
33
- - **Ultra-Light**: Only depends on `axios`
34
- - **No Other Dependencies**: Completely standalone package
35
- - **Persistent Identity**: Same DID across restarts
36
- - **Verification Badges**: Get verified status in MCP directories
246
+ ### Next.js
37
247
 
38
- ## 🔧 Options
248
+ - **API Routes**: Identity-enabled API endpoints out of the box
249
+ - **Middleware**: Request-level identity verification and delegation
250
+ - **SSR Support**: Server-side identity rendering and verification
251
+ - **Full Stack**: Complete client and server identity integration
252
+
253
+ ### Express
254
+
255
+ - **Middleware Stack**: Identity verification middleware for existing apps
256
+ - **Flexible Routing**: Identity-aware route handlers and permission checking
257
+ - **Production Ready**: Battle-tested middleware for production workloads
258
+ - **Custom Auth**: Extensible identity providers and authentication flows
259
+
260
+ ### Standalone
261
+
262
+ - **File Persistence**: Local identity storage with file-based backend
263
+ - **Docker Ready**: Containerized deployment with identity intact
264
+ - **Self Hosted**: Complete control over your agent and its identity
265
+ - **Process Management**: PM2 and systemd configurations included
266
+
267
+ ## CLI Usage
268
+
269
+ ```bash
270
+ # Development with identity features
271
+ xmcp-i dev
272
+
273
+ # Build for production deployment
274
+ mcpi build
275
+
276
+ # Platform-specific builds with identity optimization
277
+ mcpi build --vercel
278
+ mcpi build --lambda
279
+ mcpi build --docker
280
+ ```
281
+
282
+ ## Framework Integration
283
+
284
+ ### Agent Ownership in Action
39
285
 
40
286
  ```typescript
41
- const identity = await MCPIdentity.init({
42
- name: "My Awesome MCP Server", // Optional: Server name
43
- description: "Does amazing things", // Optional: Description
44
- repository: "https://github.com/...", // Optional: GitHub URL
45
- apiEndpoint: "https://knowthat.ai" // Optional: Custom endpoint
287
+ import { createXMCPServer } from "@kya-os/xmcpi";
288
+
289
+ // Create an agent with built-in cryptographic identity
290
+ const agent = await createXMCPServer({
291
+ name: "my-personal-agent",
292
+ identity: {
293
+ // Identity generated automatically with Ed25519 keys
294
+ autoSign: true, // All responses signed with your key
295
+ trustEndpoints: true, // Verification endpoints enabled
296
+ persistence: "file", // Store identity securely
297
+ },
298
+ tools: [
299
+ {
300
+ name: "secure-action",
301
+ description: "Execute action with verified identity",
302
+ parameters: { action: { type: "string", required: true } },
303
+ handler: async ({ action }, context) => {
304
+ // Every response includes your cryptographic signature
305
+ return {
306
+ action: `Executed: ${action}`,
307
+ agent_did: context.server.identity.did,
308
+ owner: "you@knowthat.ai",
309
+ timestamp: new Date().toISOString(),
310
+ // ↑ This response is automatically signed with your private key
311
+ };
312
+ },
313
+ },
314
+ ],
315
+ });
316
+
317
+ // Register your agent's DID with knowthat.ai to claim ownership
318
+ await agent.register("https://knowthat.ai");
319
+
320
+ agent.listen(3000, () => {
321
+ console.log(`🤖 Your agent is running: ${agent.identity.did}`);
322
+ console.log(
323
+ `🔐 Claim ownership: https://knowthat.ai/claim/${agent.identity.did}`
324
+ );
46
325
  });
47
326
  ```
48
327
 
49
- ## 📁 Identity Storage
328
+ ## Migrating from XMCP
329
+
330
+ Your existing XMCP agents can gain ownership capabilities:
50
331
 
51
- The package stores identity in multiple locations (checked in order):
332
+ ```typescript
333
+ // Before (original XMCP - platform owned)
334
+ import { createXMCPServer } from "xmcp";
52
335
 
53
- 1. **Environment Variables**
54
- - `AGENT_DID`
55
- - `AGENT_PUBLIC_KEY`
56
- - `AGENT_PRIVATE_KEY`
336
+ // After (XMCP-I - you own the agent!)
337
+ import { createXMCPServer } from "xmcp-i";
338
+ ```
57
339
 
58
- 2. **Local Files**
59
- - `.env.local` (auto-generated)
60
- - `.mcp-identity.json` (auto-generated)
340
+ Your existing code works unchanged, but now your agent:
61
341
 
62
- ## 🔐 Security
342
+ - Has its own cryptographic identity
343
+ - ✅ Can be registered and claimed by you at knowthat.ai
344
+ - ✅ Signs all responses automatically
345
+ - ✅ Supports secure permission delegation
346
+ - ✅ Provides verifiable ownership proof
63
347
 
64
- - Private keys are stored locally only
65
- - Never share your `.env.local` or `.mcp-identity.json` files
66
- - Add them to `.gitignore`
348
+ ## Advanced Identity Features
67
349
 
68
- ## 🤝 Integration with MCP Servers
350
+ ### Custom Identity Providers
69
351
 
70
352
  ```typescript
71
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
72
- import { MCPIdentity } from "@kya-os/mcp-i";
353
+ import { createCustomIdentityProvider } from "@kya-os/xmcpi/platforms";
354
+
355
+ const customProvider = createCustomIdentityProvider({
356
+ keyType: "secp256k1", // Alternative key types
357
+ generateDID: (pubKey) => `did:custom:${hash(pubKey)}`,
358
+ persistence: "redis", // Custom storage backends
359
+ knowthat: {
360
+ apiKey: process.env.KNOWTHAT_API_KEY,
361
+ autoRegister: true, // Automatic agent registration
362
+ },
363
+ });
73
364
 
74
- // Initialize identity
75
- const identity = await MCPIdentity.init({
76
- name: "Calendar Booker"
365
+ const agent = await createXMCPServer({
366
+ name: "my-custom-agent",
367
+ identity: { provider: customProvider },
77
368
  });
369
+ ```
370
+
371
+ ### Identity Middleware Integration
78
372
 
79
- // Pass to your MCP server
80
- const server = new Server({
81
- name: "calendar-booker",
82
- version: "1.0.0",
83
- identity // Your server now has verifiable identity!
373
+ ```typescript
374
+ import { identityMiddleware, delegationMiddleware } from "@kya-os/xmcpi";
375
+
376
+ const agent = await createXMCPServer({
377
+ name: "my-secure-agent",
378
+ middlewares: [
379
+ identityMiddleware({
380
+ requireSignature: true, // Require signed requests
381
+ trustLevel: "verified", // Only accept verified DIDs
382
+ }),
383
+ delegationMiddleware({
384
+ checkPermissions: true, // Validate delegated permissions
385
+ rateLimiting: true, // Enforce delegation rate limits
386
+ }),
387
+ ],
84
388
  });
85
389
  ```
86
390
 
87
- ## 📊 What Happens After Registration
391
+ ## Dependencies and Architecture
392
+
393
+ XMCP-I builds on proven cryptographic foundations:
394
+
395
+ ### Core Identity Stack
396
+
397
+ - **@kya-os/mcp-i** - Core identity protocol implementation with knowthat.ai integration
398
+ - **jose** - JWT and cryptographic operations (JWS, JWE, JWK)
399
+ - **@modelcontextprotocol/sdk** - MCP protocol SDK for agent communication
400
+ - **axios** - HTTP client for identity resolution and knowthat.ai API calls
88
401
 
89
- 1. **Profile Created**: `https://knowthat.ai/agents/your-server-slug`
90
- 2. **Verification Badge**: Shows "Auto-Registered" status
91
- 3. **DID Resolution**: Your DID becomes resolvable immediately
92
- 4. **Trust Building**: Usage builds reputation over time
402
+ ### Development Stack
93
403
 
94
- ## 🚨 Troubleshooting
404
+ - **express** - Web server framework for identity endpoints
405
+ - **webpack** - Module bundler with identity-aware compilation
406
+ - **chalk** - Beautiful CLI output for identity operations
407
+ - **chokidar** - File watching with identity file monitoring
95
408
 
96
- ### Rate Limiting
97
- If you see "Rate limit exceeded", wait a few minutes and try again. The API allows 10 registrations per hour per IP.
409
+ ### Cryptographic Security
98
410
 
99
- ### No Identity Found
100
- Make sure you have write permissions in your project directory for saving the identity files.
411
+ - **Ed25519** - Elliptic curve digital signatures (default)
412
+ - **secp256k1** - Bitcoin-compatible signatures (optional)
413
+ - **DID Keys** - Decentralized identifier generation from public keys
414
+ - **JWS/JWE** - JSON Web Signatures and Encryption for secure transport
101
415
 
102
- ### Network Issues
103
- The package needs to reach `https://knowthat.ai` for auto-registration. Check your network connection and proxy settings.
416
+ ## Development
417
+
418
+ Build your own identity-enabled MCP agents:
419
+
420
+ ```bash
421
+ # Clone the repository
422
+ git clone https://github.com/modelcontextprotocol-identity/xmcp-i.git
423
+
424
+ # Install dependencies
425
+ pnpm install
426
+
427
+ # Start development with identity features
428
+ pnpm run dev
429
+
430
+ # Build for production with identity optimization
431
+ pnpm run build
432
+
433
+ # Run identity-aware tests
434
+ pnpm run test
435
+
436
+ # Lint code including identity modules
437
+ pnpm run lint
438
+ ```
104
439
 
105
- ## 📄 License
440
+ ## Learn more
106
441
 
107
- MIT
442
+ ⊹ **Register Your Agent**: [knowthat.ai](https://knowthat.ai) - Claim ownership of your AI agents\
443
+ ⊹ **Original XMCP Framework**: [xmcp.dev](https://xmcp.dev) - Base framework documentation\
444
+ ⊹ **Model Context Protocol**: [modelcontextprotocol.io](https://modelcontextprotocol.io) - Core protocol specification
108
445
 
109
- ## 🔗 Links
446
+ ## Security
110
447
 
111
- - [KYA-OS Documentation](https://docs.kya-os.com)
112
- - [MCP-I Specification](https://github.com/vouched/kya-os/blob/main/docs/mcp-i.md)
113
- - [Report Issues](https://github.com/vouched/kya-os/issues)
448
+ If you believe you have found a security vulnerability, please report it to [security@xmcp-i.dev](mailto:security@xmcp-i.dev). We take agent ownership security seriously and will investigate all reports promptly.
114
449
 
115
- ---
450
+ ## License
116
451
 
117
- Made with ❤️ by the KYA-OS team
452
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/modelcontextprotocol-identity/xmcp-i/blob/main/license.md) file for details.
package/dist/149.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";exports.id=149,exports.ids=[149],exports.modules={10602:(e,t,s)=>{s.d(t,{$:()=>o});const o="***SensitiveInformation***"},11149:(e,t,s)=>{s.d(t,{GetRoleCredentialsCommand:()=>M,SSOClient:()=>dt});var o=s(66403),n=s(53340),r=s(3594);const i={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var a=s(10602),c=s(92309);class d extends c.T{constructor(e){super(e),Object.setPrototypeOf(this,d.prototype)}}class u extends d{name="InvalidRequestException";$fault="client";constructor(e){super({name:"InvalidRequestException",$fault:"client",...e}),Object.setPrototypeOf(this,u.prototype)}}class p extends d{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,p.prototype)}}class h extends d{name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),Object.setPrototypeOf(this,h.prototype)}}class l extends d{name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),Object.setPrototypeOf(this,l.prototype)}}const m=e=>({...e,...e.accessToken&&{accessToken:a.$}}),g=e=>({...e,...e.secretAccessKey&&{secretAccessKey:a.$},...e.sessionToken&&{sessionToken:a.$}}),y=e=>({...e,...e.roleCredentials&&{roleCredentials:g(e.roleCredentials)}});var f=s(46071),S=s(65875),b=s(93907);const v=e=>null!=e;var P=s(86343),w=s(10001),x=s(63976);const I=async(e,t)=>{const s=(0,S.l)(e,t),o=(0,b.Tj)({},v,{[U]:e[O]});s.bp("/federation/credentials");const n=(0,b.Tj)({[F]:[,(0,P.Y0)(e[z],"roleName")],[D]:[,(0,P.Y0)(e[j],"accountId")]});return s.m("GET").h(o).q(n).b(void 0),s.build()},E=async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return k(e,t);const s=(0,b.Tj)({$metadata:T(e)}),o=(0,P.Y0)((0,P.Xk)(await(0,f.Y2)(e.body,t)),"body"),n=(0,b.s)(o,{roleCredentials:w.S});return Object.assign(s,n),s},k=async(e,t)=>{const s={...e,body:await(0,f.CG)(e.body,t)},o=(0,f.cJ)(e,s.body);switch(o){case"InvalidRequestException":case"com.amazonaws.sso#InvalidRequestException":throw await A(s,t);case"ResourceNotFoundException":case"com.amazonaws.sso#ResourceNotFoundException":throw await C(s,t);case"TooManyRequestsException":case"com.amazonaws.sso#TooManyRequestsException":throw await $(s,t);case"UnauthorizedException":case"com.amazonaws.sso#UnauthorizedException":throw await q(s,t);default:const n=s.body;return R({output:e,parsedBody:n,errorCode:o})}},R=(0,x.j)(d),A=async(e,t)=>{const s=(0,b.Tj)({}),o=e.body,n=(0,b.s)(o,{message:P.lK});Object.assign(s,n);const r=new u({$metadata:T(e),...s});return(0,c.M)(r,e.body)},C=async(e,t)=>{const s=(0,b.Tj)({}),o=e.body,n=(0,b.s)(o,{message:P.lK});Object.assign(s,n);const r=new p({$metadata:T(e),...s});return(0,c.M)(r,e.body)},$=async(e,t)=>{const s=(0,b.Tj)({}),o=e.body,n=(0,b.s)(o,{message:P.lK});Object.assign(s,n);const r=new h({$metadata:T(e),...s});return(0,c.M)(r,e.body)},q=async(e,t)=>{const s=(0,b.Tj)({}),o=e.body,n=(0,b.s)(o,{message:P.lK});Object.assign(s,n);const r=new l({$metadata:T(e),...s});return(0,c.M)(r,e.body)},T=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),j="accountId",O="accessToken",D="account_id",z="roleName",F="role_name",U="x-amz-sso_bearer_token";class M extends(r.u.classBuilder().ep(i).m(function(e,t,s,r){return[(0,n.TM)(s,this.serialize,this.deserialize),(0,o.r)(s,e.getEndpointParameterInstructions())]}).s("SWBPortalService","GetRoleCredentials",{}).n("SSOClient","GetRoleCredentialsCommand").f(m,y).ser(I).de(E).build()){}var K=s(67317),N=s(27847),H=s(33182),G=s(67868),Z=s(4518),L=s(20459),V=s(23369),Y=s(83007),B=s(58001),_=s(88244),W=s(79244),J=s(74499),X=s(29163),Q=s(8928),ee=s(27792),te=s(80835),se=s(6670);const oe=async(e,t,s)=>({operation:(0,te.u)(t).operation,region:await(0,se.t)(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),ne=e=>{const t=[];switch(e.operation){case"GetRoleCredentials":case"ListAccountRoles":case"ListAccounts":case"Logout":t.push({schemeId:"smithy.api#noAuth"});break;default:t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"awsssoportal",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e))}return t};var re=s(21674),ie=s(61008),ae=s(4425),ce=s(34767),de=s(91968),ue=s(28164),pe=s(41942),he=s(13820),le=s(43316),me=s(41911),ge=s(46553),ye=s(31680),fe=s(88468),Se=s(57180),be=s(31305),ve=s(96527),Pe=s(72804),we=s(69367),xe=s(19506),Ie=s(40935),Ee=s(2914),ke=s(56771),Re=s(2257),Ae=s(63305),Ce=s(60248);const $e="required",qe="fn",Te="argv",je="ref",Oe=!0,De="isSet",ze="booleanEquals",Fe="error",Ue="endpoint",Me="tree",Ke="PartitionResult",Ne="getAttr",He={[$e]:!1,type:"String"},Ge={[$e]:!0,default:!1,type:"Boolean"},Ze={[je]:"Endpoint"},Le={[qe]:ze,[Te]:[{[je]:"UseFIPS"},!0]},Ve={[qe]:ze,[Te]:[{[je]:"UseDualStack"},!0]},Ye={},Be={[qe]:Ne,[Te]:[{[je]:Ke},"supportsFIPS"]},_e={[je]:Ke},We={[qe]:ze,[Te]:[!0,{[qe]:Ne,[Te]:[_e,"supportsDualStack"]}]},Je=[Le],Xe=[Ve],Qe=[{[je]:"Region"}],et={version:"1.0",parameters:{Region:He,UseDualStack:Ge,UseFIPS:Ge,Endpoint:He},rules:[{conditions:[{[qe]:De,[Te]:[Ze]}],rules:[{conditions:Je,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Fe},{conditions:Xe,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Fe},{endpoint:{url:Ze,properties:Ye,headers:Ye},type:Ue}],type:Me},{conditions:[{[qe]:De,[Te]:Qe}],rules:[{conditions:[{[qe]:"aws.partition",[Te]:Qe,assign:Ke}],rules:[{conditions:[Le,Ve],rules:[{conditions:[{[qe]:ze,[Te]:[Oe,Be]},We],rules:[{endpoint:{url:"https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Ye,headers:Ye},type:Ue}],type:Me},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Fe}],type:Me},{conditions:Je,rules:[{conditions:[{[qe]:ze,[Te]:[Be,Oe]}],rules:[{conditions:[{[qe]:"stringEquals",[Te]:[{[qe]:Ne,[Te]:[_e,"name"]},"aws-us-gov"]}],endpoint:{url:"https://portal.sso.{Region}.amazonaws.com",properties:Ye,headers:Ye},type:Ue},{endpoint:{url:"https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Ye,headers:Ye},type:Ue}],type:Me},{error:"FIPS is enabled but this partition does not support FIPS",type:Fe}],type:Me},{conditions:Xe,rules:[{conditions:[We],rules:[{endpoint:{url:"https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Ye,headers:Ye},type:Ue}],type:Me},{error:"DualStack is enabled but this partition does not support DualStack",type:Fe}],type:Me},{endpoint:{url:"https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",properties:Ye,headers:Ye},type:Ue}],type:Me}],type:Me},{error:"Invalid Configuration: Missing Region",type:Fe}]},tt=new Re.k({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),st=(e,t={})=>tt.get(e,()=>(0,Ae.s)(et,{endpointParams:e,logger:t.logger}));Ce.m.aws=ke.UF;var ot=s(72617),nt=s(70758),rt=s(97252);var it=s(96374),at=s(59326),ct=s(61701);class dt extends Q.K{config;constructor(...[e]){const t=(e=>{(0,rt.I)(process.version);const t=(0,nt.I)(e),s=()=>t().then(ot.l),o=(e=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??we.E,base64Encoder:e?.base64Encoder??xe.n,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??st,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??ne,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Se.f2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new be.m}],logger:e?.logger??new ve.N,serviceId:e?.serviceId??"SSO",urlParser:e?.urlParser??Pe.D,utf8Decoder:e?.utf8Decoder??Ie.a,utf8Encoder:e?.utf8Encoder??Ee.P}))(e);(0,re.I)(process.version);const n={profile:e?.profile,logger:o.logger};return{...o,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,le.Z)(ie.$,n),bodyLengthChecker:e?.bodyLengthChecker??ye.n,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,ae.pf)({serviceId:o.serviceId,clientVersion:"3.901.0"}),maxAttempts:e?.maxAttempts??(0,le.Z)(J.qs,e),region:e?.region??(0,le.Z)(de.GG,{...de.zH,...n}),requestHandler:me.$.create(e?.requestHandler??s),retryMode:e?.retryMode??(0,le.Z)({...J.kN,default:async()=>(await s()).retryMode||fe.L0},e),sha256:e?.sha256??he.V.bind(null,"sha256"),streamCollector:e?.streamCollector??ge.k,useDualstackEndpoint:e?.useDualstackEndpoint??(0,le.Z)(ue.e$,n),useFipsEndpoint:e?.useFipsEndpoint??(0,le.Z)(pe.Ko,n),userAgentAppId:e?.userAgentAppId??(0,le.Z)(ce.hV,n)}})(e||{});super(t),this.initConfig=t;const s=(o=t,Object.assign(o,{useDualstackEndpoint:o.useDualstackEndpoint??!1,useFipsEndpoint:o.useFipsEndpoint??!1,defaultSigningName:"awsssoportal"}));var o;const n=(0,G.D)(s),r=(0,J.$z)(n),i=(0,L.T)(r),a=(0,K.OV)(i),c=((e,t)=>{const s=Object.assign((0,it.R)(e),(0,ct.xA)(e),(0,at.e)(e),(e=>{const t=e.httpAuthSchemes;let s=e.httpAuthSchemeProvider,o=e.credentials;return{setHttpAuthScheme(e){const s=t.findIndex(t=>t.schemeId===e.schemeId);-1===s?t.push(e):t.splice(s,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){s=e},httpAuthSchemeProvider:()=>s,setCredentials(e){o=e},credentials:()=>o}})(e));return t.forEach(e=>e.configure(s)),Object.assign(e,(0,it.$)(s),(0,ct.uv)(s),(0,at.j)(s),{httpAuthSchemes:(o=s).httpAuthSchemes(),httpAuthSchemeProvider:o.httpAuthSchemeProvider(),credentials:o.credentials()});var o})((e=>{const t=(0,ee.h)(e);return Object.assign(t,{authSchemePreference:(0,se.t)(e.authSchemePreference??[])})})((0,W.C)(a)),e?.extensions||[]);this.config=c,this.middlewareStack.use((0,Z.sM)(this.config)),this.middlewareStack.use((0,X.ey)(this.config)),this.middlewareStack.use((0,_.vK)(this.config)),this.middlewareStack.use((0,K.TC)(this.config)),this.middlewareStack.use((0,N.Y7)(this.config)),this.middlewareStack.use((0,H.n)(this.config)),this.middlewareStack.use((0,V.w)(this.config,{httpAuthSchemeParametersProvider:oe,identityProviderConfigProvider:async e=>new Y.h({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use((0,B.l)(this.config))}destroy(){super.destroy()}}},31305:(e,t,s)=>{s.d(t,{m:()=>o});class o{async sign(e,t,s){return e}}},37579:(e,t,s)=>{function o(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}s.d(t,{$:()=>o})},65875:(e,t,s)=>{s.d(t,{l:()=>r});var o=s(32141),n=s(37579);function r(e,t){return new i(e,t)}class i{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,t){this.input=e,this.context=t}async build(){const{hostname:e,protocol:t="https",port:s,path:n}=await this.context.endpoint();this.path=n;for(const e of this.resolvePathStack)e(this.path);return new o.K({protocol:t,hostname:this.hostname||e,port:s,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push(t=>{this.path=`${t?.endsWith("/")?t.slice(0,-1):t||""}`+e}),this}p(e,t,s,o){return this.resolvePathStack.push(r=>{this.path=((e,t,s,o,r,i)=>{if(null==t||void 0===t[s])throw new Error("No value provided for input HTTP label: "+s+".");{const t=o();if(t.length<=0)throw new Error("Empty value provided for input HTTP label: "+s+".");e=e.replace(r,i?t.split("/").map(e=>(0,n.$)(e)).join("/"):(0,n.$)(t))}return e})(r,this.input,e,t,s,o)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}}};
package/dist/189.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";exports.id=189,exports.ids=[189],exports.modules={37481:(e,r,o)=>{o.d(r,{Z:()=>c});var t=o(51869),s=o(31493);const c={getFileRecord:()=>s.Jj,interceptFile(e,r){s.Jj[e]=Promise.resolve(r)},getTokenRecord:()=>t.a,interceptToken(e,r){t.a[e]=r}}},51869:(e,r,o)=>{o.d(r,{a:()=>i,v:()=>n});var t=o(79896),s=o(55786);const{readFile:c}=t.promises,i={},n=async e=>{if(i[e])return i[e];const r=(0,s.C)(e),o=await c(r,"utf8");return JSON.parse(o)}},55786:(e,r,o)=>{o.d(r,{C:()=>i});var t=o(76982),s=o(16928),c=o(47741);const i=e=>{const r=(0,t.createHash)("sha1").update(e).digest("hex");return(0,s.join)((0,c.R)(),".aws","sso","cache",`${r}.json`)}},66189:(e,r,o)=>{o.r(r),o.d(r,{fromProcess:()=>l});var t=o(98306),s=o(67789),c=o(3721),i=o(37481),n=o(35317),a=o(39023),d=o(64172);const l=(e={})=>async({callerClientConfig:r}={})=>{e.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");const o=await(0,t.Y)(e);return(async(e,r,o)=>{const t=r[e];if(!r[e])throw new c.C(`Profile ${e} could not be found in shared credentials file.`,{logger:o});{const s=t.credential_process;if(void 0===s)throw new c.C(`Profile ${e} did not contain credential_process.`,{logger:o});{const t=(0,a.promisify)(i.Z?.getTokenRecord?.().exec??n.exec);try{const{stdout:o}=await t(s);let c;try{c=JSON.parse(o.trim())}catch{throw Error(`Profile ${e} credential_process returned invalid JSON.`)}return((e,r,o)=>{if(1!==r.Version)throw Error(`Profile ${e} credential_process did not return Version 1.`);if(void 0===r.AccessKeyId||void 0===r.SecretAccessKey)throw Error(`Profile ${e} credential_process returned invalid credentials.`);if(r.Expiration){const o=new Date;if(new Date(r.Expiration)<o)throw Error(`Profile ${e} credential_process returned expired credentials.`)}let t=r.AccountId;!t&&o?.[e]?.aws_account_id&&(t=o[e].aws_account_id);const s={accessKeyId:r.AccessKeyId,secretAccessKey:r.SecretAccessKey,...r.SessionToken&&{sessionToken:r.SessionToken},...r.Expiration&&{expiration:new Date(r.Expiration)},...r.CredentialScope&&{credentialScope:r.CredentialScope},...t&&{accountId:t}};return(0,d.g)(s,"CREDENTIALS_PROCESS","w"),s})(e,c,r)}catch(e){throw new c.C(e.message,{logger:o})}}}})((0,s.Bz)({profile:e.profile??r?.profile}),o,e.logger)}}};