@kya-os/mcp-i 1.5.3-canary.0 → 1.5.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/dist/auth/jwt.d.ts +1 -1
- package/dist/auth/oauth/router.js +3 -8
- package/dist/cli-adapter/index.js +1 -1
- package/dist/cli-adapter/kta-registration.d.ts +1 -1
- package/dist/cli-adapter/kta-registration.js +2 -2
- package/dist/compiler/config/injection.js +2 -2
- package/dist/compiler/get-webpack-config/get-entries.js +12 -8
- package/dist/providers/node-providers.d.ts +1 -1
- package/dist/providers/node-providers.js +4 -4
- package/dist/runtime/adapter-express.js +1 -1
- package/dist/runtime/adapter-nextjs.js +1 -1
- package/dist/runtime/audit.d.ts +287 -3
- package/dist/runtime/audit.js +169 -4
- package/dist/runtime/auth-handshake.d.ts +1 -1
- package/dist/runtime/auth-handshake.js +1 -1
- package/dist/runtime/debug.d.ts +2 -2
- package/dist/runtime/debug.js +3 -3
- package/dist/runtime/delegation/index.d.ts +7 -0
- package/dist/runtime/delegation/index.js +23 -0
- package/dist/runtime/delegation/vc-issuer.d.ts +119 -0
- package/dist/runtime/delegation/vc-issuer.js +220 -0
- package/dist/runtime/delegation/vc-verifier.d.ts +193 -0
- package/dist/runtime/delegation/vc-verifier.js +387 -0
- package/dist/runtime/http.js +1 -1
- package/dist/runtime/identity.d.ts +10 -2
- package/dist/runtime/identity.js +68 -11
- package/dist/runtime/mcpi-runtime.d.ts +28 -1
- package/dist/runtime/mcpi-runtime.js +2 -2
- package/dist/runtime/migrate-identity.d.ts +16 -0
- package/dist/runtime/migrate-identity.js +118 -0
- package/dist/runtime/proof.js +2 -2
- package/dist/runtime/stdio.js +1 -1
- package/dist/runtime/transports/http/index.js +3 -1
- package/dist/runtime/utils/time.d.ts +80 -0
- package/dist/runtime/utils/time.js +117 -0
- package/dist/runtime/utils/tools.js +22 -3
- package/dist/runtime/verifier-middleware.js +1 -1
- package/dist/runtime/well-known.d.ts +0 -4
- package/dist/runtime/well-known.js +12 -26
- package/dist/storage/delegation.js +2 -2
- package/dist/test/deterministic-keys.d.ts +1 -1
- package/dist/test/deterministic-keys.js +6 -6
- package/dist/test/examples/test-usage-example.d.ts +6 -6
- package/dist/test/examples/test-usage-example.js +5 -5
- package/dist/test/local-verification.d.ts +1 -1
- package/dist/test/local-verification.js +10 -10
- package/dist/test/mock-identity-provider.d.ts +4 -4
- package/dist/test/mock-identity-provider.js +7 -7
- package/dist/test/runtime-integration.d.ts +2 -2
- package/package.json +4 -3
package/dist/auth/jwt.d.ts
CHANGED
|
@@ -3,18 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createOAuthRouter = createOAuthRouter;
|
|
4
4
|
exports.createOAuthMiddleware = createOAuthMiddleware;
|
|
5
5
|
const express_1 = require("express");
|
|
6
|
+
const mcp_i_core_1 = require("@kya-os/mcp-i-core");
|
|
6
7
|
function createOAuthRouter(config) {
|
|
7
8
|
const router = (0, express_1.Router)();
|
|
8
9
|
const { provider, issuerUrl, baseUrl, serviceDocumentationUrl, pathPrefix = "/oauth2", } = config;
|
|
9
10
|
router.use((req, res, next) => {
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
|
|
13
|
-
res.setHeader("Access-Control-Allow-Headers",
|
|
14
|
-
// should also pass the mcp-protocol-version header
|
|
15
|
-
// probably only that one since the rest can be set from the config side
|
|
16
|
-
"Content-Type, Authorization, Accept, mcp-protocol-version");
|
|
17
|
-
res.setHeader("Access-Control-Expose-Headers", "Content-Type");
|
|
11
|
+
// Apply shared CORS headers for OAuth endpoints
|
|
12
|
+
(0, mcp_i_core_1.applyCORSHeaders)(res, mcp_i_core_1.OAUTH_CORS_HEADERS);
|
|
18
13
|
if (req.method === "OPTIONS") {
|
|
19
14
|
res.sendStatus(200);
|
|
20
15
|
return;
|
|
@@ -55,7 +55,7 @@ async function enableMCPIdentityCLI(options = {}) {
|
|
|
55
55
|
registrationResult = await (0, kta_registration_1.registerWithKTA)({
|
|
56
56
|
did: identity.did,
|
|
57
57
|
publicKey: identity.publicKey,
|
|
58
|
-
|
|
58
|
+
kid: identity.kid,
|
|
59
59
|
name: name || "My Agent",
|
|
60
60
|
description: description || "XMCP-I agent with identity features",
|
|
61
61
|
repository,
|
|
@@ -28,7 +28,7 @@ const MCP_I_CAPABILITIES = [
|
|
|
28
28
|
* Returns registration details including claim URL.
|
|
29
29
|
*/
|
|
30
30
|
async function registerWithKTA(options) {
|
|
31
|
-
const { did, publicKey,
|
|
31
|
+
const { did, publicKey, kid, name, description, repository, endpoint = "https://knowthat.ai", } = options;
|
|
32
32
|
try {
|
|
33
33
|
// Construct verification endpoint from DID
|
|
34
34
|
const verificationEndpoint = did.includes("localhost")
|
|
@@ -38,7 +38,7 @@ async function registerWithKTA(options) {
|
|
|
38
38
|
const payload = {
|
|
39
39
|
did,
|
|
40
40
|
publicKey,
|
|
41
|
-
|
|
41
|
+
kid,
|
|
42
42
|
name,
|
|
43
43
|
description,
|
|
44
44
|
repository: repository || undefined,
|
|
@@ -115,8 +115,8 @@ function injectRuntimeConfigPath(projectRoot) {
|
|
|
115
115
|
break;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
//
|
|
118
|
+
// Single-stringify for webpack DefinePlugin (path strings don't need double-stringify)
|
|
119
119
|
return {
|
|
120
|
-
RUNTIME_CONFIG_PATH: JSON.stringify(
|
|
120
|
+
RUNTIME_CONFIG_PATH: JSON.stringify(runtimeConfigPath),
|
|
121
121
|
};
|
|
122
122
|
}
|
|
@@ -8,25 +8,29 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
/** Get what packages are gonna be built by xmcp */
|
|
9
9
|
function getEntries(xmcpConfig) {
|
|
10
10
|
const entries = {};
|
|
11
|
-
//
|
|
12
|
-
// This allows webpack to compile them directly without double-wrapping
|
|
13
|
-
// Cache bust: Updated adapter paths to correct locations (2025-10-09)
|
|
11
|
+
// Resolve to the mcp-i package root (works for both workspace and published packages)
|
|
14
12
|
const mcpiPackageRoot = path_1.default.resolve(__dirname, "../../..");
|
|
15
|
-
|
|
13
|
+
// Check if source files exist (workspace/development) or use dist files (published package)
|
|
14
|
+
const fs = require("fs");
|
|
15
|
+
const srcRuntimePath = path_1.default.join(mcpiPackageRoot, "src/runtime");
|
|
16
|
+
const distRuntimePath = path_1.default.join(mcpiPackageRoot, "dist/runtime");
|
|
17
|
+
const useSourceFiles = fs.existsSync(srcRuntimePath);
|
|
18
|
+
const runtimePath = useSourceFiles ? srcRuntimePath : distRuntimePath;
|
|
19
|
+
const fileExt = useSourceFiles ? ".ts" : ".js";
|
|
16
20
|
if (xmcpConfig.stdio) {
|
|
17
|
-
entries.stdio = path_1.default.join(
|
|
21
|
+
entries.stdio = path_1.default.join(runtimePath, `transports/stdio/index${fileExt}`);
|
|
18
22
|
}
|
|
19
23
|
if (xmcpConfig["http"]) {
|
|
20
24
|
// non adapter mode
|
|
21
25
|
if (!xmcpConfig.experimental?.adapter) {
|
|
22
|
-
entries["http"] = path_1.default.join(
|
|
26
|
+
entries["http"] = path_1.default.join(runtimePath, `transports/http/index${fileExt}`);
|
|
23
27
|
}
|
|
24
28
|
// adapter mode enabled
|
|
25
29
|
if (xmcpConfig.experimental?.adapter === "express") {
|
|
26
|
-
entries["adapter"] = path_1.default.join(
|
|
30
|
+
entries["adapter"] = path_1.default.join(runtimePath, `adapters/express/index${fileExt}`);
|
|
27
31
|
}
|
|
28
32
|
if (xmcpConfig.experimental?.adapter === "nextjs") {
|
|
29
|
-
entries["adapter"] = path_1.default.join(
|
|
33
|
+
entries["adapter"] = path_1.default.join(runtimePath, `adapters/nextjs/index${fileExt}`);
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
36
|
return entries;
|
|
@@ -34,7 +34,7 @@ export declare class NodeClockProvider extends ClockProvider {
|
|
|
34
34
|
export declare class NodeFetchProvider extends FetchProvider {
|
|
35
35
|
resolveDID(did: string): Promise<any>;
|
|
36
36
|
fetchStatusList(url: string): Promise<any>;
|
|
37
|
-
fetchDelegationChain(
|
|
37
|
+
fetchDelegationChain(_id: string): Promise<any[]>;
|
|
38
38
|
fetch(url: string, options?: any): Promise<Response>;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -166,7 +166,7 @@ class NodeFetchProvider extends mcp_i_core_1.FetchProvider {
|
|
|
166
166
|
const response = await axios_1.default.get(url);
|
|
167
167
|
return response.data;
|
|
168
168
|
}
|
|
169
|
-
async fetchDelegationChain(
|
|
169
|
+
async fetchDelegationChain(_id) {
|
|
170
170
|
// Would fetch from a delegation registry
|
|
171
171
|
return [];
|
|
172
172
|
}
|
|
@@ -287,7 +287,7 @@ class FileIdentityProvider extends mcp_i_core_1.IdentityProvider {
|
|
|
287
287
|
process.env.MCP_IDENTITY_AGENT_DID) {
|
|
288
288
|
return {
|
|
289
289
|
did: process.env.MCP_IDENTITY_AGENT_DID,
|
|
290
|
-
|
|
290
|
+
kid: `${process.env.MCP_IDENTITY_AGENT_DID}#key-1`,
|
|
291
291
|
privateKey: process.env.MCP_IDENTITY_PRIVATE_KEY,
|
|
292
292
|
publicKey: process.env.MCP_IDENTITY_PUBLIC_KEY,
|
|
293
293
|
createdAt: new Date().toISOString(),
|
|
@@ -304,7 +304,7 @@ class FileIdentityProvider extends mcp_i_core_1.IdentityProvider {
|
|
|
304
304
|
const did = this.generateDIDFromPublicKey(keyPair.publicKey);
|
|
305
305
|
const identity = {
|
|
306
306
|
did,
|
|
307
|
-
|
|
307
|
+
kid: `${did}#key-1`,
|
|
308
308
|
privateKey: keyPair.privateKey,
|
|
309
309
|
publicKey: keyPair.publicKey,
|
|
310
310
|
createdAt: new Date().toISOString(),
|
|
@@ -321,7 +321,7 @@ class FileIdentityProvider extends mcp_i_core_1.IdentityProvider {
|
|
|
321
321
|
const did = this.generateDIDFromPublicKey(keyPair.publicKey);
|
|
322
322
|
const identity = {
|
|
323
323
|
did,
|
|
324
|
-
|
|
324
|
+
kid: `${did}#key-1`,
|
|
325
325
|
privateKey: keyPair.privateKey,
|
|
326
326
|
publicKey: keyPair.publicKey,
|
|
327
327
|
createdAt: new Date().toISOString(),
|