@kya-os/mcp-i-core 1.3.28 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1000,6 +1000,119 @@ class MCPIRuntimeBase {
1000
1000
  timestamp: this.clock.now(),
1001
1001
  };
1002
1002
  }
1003
+ // SEP-1649 MCP Server Card for client discovery
1004
+ // Support both paths during spec transition:
1005
+ // - /.well-known/mcp.json (current Cursor/Claude Desktop usage)
1006
+ // - /.well-known/mcp/server-card.json (SEP-1649 proposed spec)
1007
+ if (path === "/.well-known/mcp.json" || path === "/.well-known/mcp/server-card.json") {
1008
+ const serverName = config?.serviceName || "mcp-i-server";
1009
+ // SEP-1649 compliant MCP Server Card
1010
+ const mcpServerCard = {
1011
+ $schema: "https://static.modelcontextprotocol.io/schemas/mcp-server-card/v1.json",
1012
+ version: "1.0",
1013
+ protocolVersion: config?.protocolVersion || "2025-06-18",
1014
+ serverInfo: {
1015
+ name: serverName,
1016
+ title: config?.serviceTitle || config?.serviceName || "MCP-I Server",
1017
+ version: config?.serverVersion || "1.0.0",
1018
+ },
1019
+ description: config?.description || "MCP-I enabled server with cryptographic identity",
1020
+ ...(config?.iconUrl && { iconUrl: config.iconUrl }),
1021
+ ...(config?.documentationUrl && { documentationUrl: config.documentationUrl }),
1022
+ transport: {
1023
+ type: "streamable-http",
1024
+ endpoint: "/mcp",
1025
+ },
1026
+ capabilities: {
1027
+ tools: { listChanged: true },
1028
+ },
1029
+ ...(config?.requiresAuth && {
1030
+ authentication: {
1031
+ required: true,
1032
+ schemes: config.authSchemes || ["oauth2"],
1033
+ },
1034
+ }),
1035
+ ...(config?.instructions && { instructions: config.instructions }),
1036
+ // Tools are dynamic - discovered via protocol
1037
+ tools: "dynamic",
1038
+ _meta: {
1039
+ ...config?.metadata,
1040
+ "mcp-i": {
1041
+ agentDid: identity.did,
1042
+ publicKey: identity.publicKey,
1043
+ generatedAt: this.clock.now(),
1044
+ },
1045
+ },
1046
+ };
1047
+ const headers = {
1048
+ "Content-Type": "application/json",
1049
+ "Cache-Control": this.config.environment === "production"
1050
+ ? "public, max-age=3600" // SEP-1649 recommends 1 hour
1051
+ : "no-store",
1052
+ // SEP-1649 CORS requirements for browser-based client discovery
1053
+ "Access-Control-Allow-Origin": "*",
1054
+ "Access-Control-Allow-Methods": "GET",
1055
+ "Access-Control-Allow-Headers": "Content-Type",
1056
+ };
1057
+ return {
1058
+ status: 200,
1059
+ headers,
1060
+ body: JSON.stringify(mcpServerCard, null, 2),
1061
+ };
1062
+ }
1063
+ // Client configuration helper - ready-to-use config for Cursor/Claude Desktop
1064
+ if (path === "/.well-known/mcp-client-config.json") {
1065
+ const serviceEndpoint = config?.serviceEndpoint || "https://example.com";
1066
+ const serverName = config?.serviceName || "mcp-i-server";
1067
+ const mcpUrl = `${serviceEndpoint}/mcp`;
1068
+ // Generate Cursor deep link
1069
+ // Note: Base64 can contain +, /, = which have special meaning in URLs
1070
+ // Must URL-encode the base64 string for safe transmission
1071
+ const cursorConfig = { [serverName]: { url: mcpUrl, transport: "sse" } };
1072
+ const encodedConfig = Buffer.from(JSON.stringify(cursorConfig)).toString("base64");
1073
+ const cursorDeepLink = `cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(serverName)}&config=${encodeURIComponent(encodedConfig)}`;
1074
+ const clientConfig = {
1075
+ // For claude_desktop_config.json
1076
+ claudeDesktop: {
1077
+ mcpServers: {
1078
+ [serverName]: {
1079
+ url: mcpUrl,
1080
+ transport: "sse",
1081
+ },
1082
+ },
1083
+ },
1084
+ // For .cursor/mcp.json
1085
+ cursor: {
1086
+ mcpServers: {
1087
+ [serverName]: {
1088
+ url: mcpUrl,
1089
+ transport: "sse",
1090
+ },
1091
+ },
1092
+ },
1093
+ // One-click install for Cursor
1094
+ cursorDeepLink,
1095
+ // Additional info
1096
+ _meta: {
1097
+ serverName,
1098
+ serverUrl: serviceEndpoint,
1099
+ mcpEndpoint: mcpUrl,
1100
+ agentDid: identity.did,
1101
+ generatedAt: this.clock.now(),
1102
+ instructions: "Copy the appropriate config section to your client configuration file.",
1103
+ },
1104
+ };
1105
+ return {
1106
+ status: 200,
1107
+ headers: {
1108
+ "Content-Type": "application/json",
1109
+ "Cache-Control": this.config.environment === "production"
1110
+ ? "public, max-age=300"
1111
+ : "no-store",
1112
+ },
1113
+ body: JSON.stringify(clientConfig, null, 2),
1114
+ };
1115
+ }
1003
1116
  return null;
1004
1117
  };
1005
1118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/mcp-i-core",
3
- "version": "1.3.28",
3
+ "version": "1.4.0",
4
4
  "description": "Core runtime and types for MCP-I framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "prepublishOnly": "npm run build && node ../create-mcpi-app/scripts/validate-no-workspace.js"
29
29
  },
30
30
  "dependencies": {
31
- "@kya-os/contracts": "^1.6.18",
31
+ "@kya-os/contracts": "^1.7.0",
32
32
  "jose": "^5.6.3",
33
33
  "json-canonicalize": "^2.0.0",
34
34
  "zod": "^3.25.76"