@enactprotocol/mcp-server 1.2.7 → 1.2.9

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/index.js CHANGED
@@ -226294,6 +226294,13 @@ class EnactApiClient {
226294
226294
  throw new EnactApiError("Unknown error occurred", 0);
226295
226295
  }
226296
226296
  }
226297
+ async signTool(toolId, payload, token, tokenType = "cli") {
226298
+ const endpoint = `/functions/v1/tools/${encodeURIComponent(toolId)}/signatures`;
226299
+ return this.makeRequest(endpoint, {
226300
+ method: "POST",
226301
+ body: JSON.stringify(payload)
226302
+ }, token, tokenType);
226303
+ }
226297
226304
  generateOAuthUrl(options) {
226298
226305
  const params = new URLSearchParams({
226299
226306
  response_type: "code",
@@ -239018,6 +239025,33 @@ class EnactCore {
239018
239025
  };
239019
239026
  }
239020
239027
  }
239028
+ static async checkToolVerificationStatus(tool) {
239029
+ const documentForVerification = {
239030
+ command: tool.command,
239031
+ description: tool.description,
239032
+ from: tool.from,
239033
+ name: tool.name,
239034
+ signatures: tool.signatures?.map((sig) => ({
239035
+ signature: sig.value,
239036
+ publicKey: "",
239037
+ algorithm: sig.algorithm,
239038
+ timestamp: new Date(sig.created).getTime()
239039
+ }))
239040
+ };
239041
+ let isValid2 = false;
239042
+ if (tool.signatures && tool.signatures.length > 0) {
239043
+ isValid2 = tool.signatures.some((sig) => {
239044
+ const referenceSignature = {
239045
+ signature: sig.value,
239046
+ publicKey: "",
239047
+ algorithm: sig.algorithm,
239048
+ timestamp: new Date(sig.created).getTime()
239049
+ };
239050
+ return SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ["command", "description", "from", "name"] });
239051
+ });
239052
+ }
239053
+ return isValid2;
239054
+ }
239021
239055
  async verifyTool(tool, dangerouslySkipVerification = false) {
239022
239056
  if (dangerouslySkipVerification) {
239023
239057
  logger_default.warn(`Skipping signature verification for tool: ${tool.name}`);
@@ -239027,23 +239061,8 @@ class EnactCore {
239027
239061
  if (!tool.signatures || tool.signatures.length === 0) {
239028
239062
  throw new Error(`Tool ${tool.name} does not have any signatures`);
239029
239063
  }
239030
- const documentForVerification = {
239031
- command: tool.command,
239032
- description: tool.description,
239033
- from: tool.from,
239034
- name: tool.name
239035
- };
239036
- const referenceSignature = {
239037
- signature: tool.signatures[0].value,
239038
- publicKey: "",
239039
- algorithm: tool.signatures[0].algorithm,
239040
- timestamp: new Date(tool.signatures[0].created).getTime()
239041
- };
239042
- const canonicalDoc = SigningService.getCanonicalDocument(documentForVerification, { includeFields: ["command", "description", "from", "name"] });
239043
- const docString = JSON.stringify(canonicalDoc);
239044
- const messageHash = CryptoUtils.hash(docString);
239045
- const directVerify = CryptoUtils.verify(referenceSignature.publicKey, messageHash, referenceSignature.signature);
239046
- const isValid2 = SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ["command", "description", "from", "name"] });
239064
+ const isValid2 = await EnactCore.checkToolVerificationStatus(tool);
239065
+ console.log("Final verification result:", isValid2);
239047
239066
  if (!isValid2) {
239048
239067
  throw new Error(`Tool ${tool.name} has invalid signatures`);
239049
239068
  }
package/dist/index.js.bak CHANGED
@@ -226293,6 +226293,13 @@ class EnactApiClient {
226293
226293
  throw new EnactApiError("Unknown error occurred", 0);
226294
226294
  }
226295
226295
  }
226296
+ async signTool(toolId, payload, token, tokenType = "cli") {
226297
+ const endpoint = `/functions/v1/tools/${encodeURIComponent(toolId)}/signatures`;
226298
+ return this.makeRequest(endpoint, {
226299
+ method: "POST",
226300
+ body: JSON.stringify(payload)
226301
+ }, token, tokenType);
226302
+ }
226296
226303
  generateOAuthUrl(options) {
226297
226304
  const params = new URLSearchParams({
226298
226305
  response_type: "code",
@@ -239017,6 +239024,33 @@ class EnactCore {
239017
239024
  };
239018
239025
  }
239019
239026
  }
239027
+ static async checkToolVerificationStatus(tool) {
239028
+ const documentForVerification = {
239029
+ command: tool.command,
239030
+ description: tool.description,
239031
+ from: tool.from,
239032
+ name: tool.name,
239033
+ signatures: tool.signatures?.map((sig) => ({
239034
+ signature: sig.value,
239035
+ publicKey: "",
239036
+ algorithm: sig.algorithm,
239037
+ timestamp: new Date(sig.created).getTime()
239038
+ }))
239039
+ };
239040
+ let isValid2 = false;
239041
+ if (tool.signatures && tool.signatures.length > 0) {
239042
+ isValid2 = tool.signatures.some((sig) => {
239043
+ const referenceSignature = {
239044
+ signature: sig.value,
239045
+ publicKey: "",
239046
+ algorithm: sig.algorithm,
239047
+ timestamp: new Date(sig.created).getTime()
239048
+ };
239049
+ return SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ["command", "description", "from", "name"] });
239050
+ });
239051
+ }
239052
+ return isValid2;
239053
+ }
239020
239054
  async verifyTool(tool, dangerouslySkipVerification = false) {
239021
239055
  if (dangerouslySkipVerification) {
239022
239056
  logger_default.warn(`Skipping signature verification for tool: ${tool.name}`);
@@ -239026,23 +239060,8 @@ class EnactCore {
239026
239060
  if (!tool.signatures || tool.signatures.length === 0) {
239027
239061
  throw new Error(`Tool ${tool.name} does not have any signatures`);
239028
239062
  }
239029
- const documentForVerification = {
239030
- command: tool.command,
239031
- description: tool.description,
239032
- from: tool.from,
239033
- name: tool.name
239034
- };
239035
- const referenceSignature = {
239036
- signature: tool.signatures[0].value,
239037
- publicKey: "",
239038
- algorithm: tool.signatures[0].algorithm,
239039
- timestamp: new Date(tool.signatures[0].created).getTime()
239040
- };
239041
- const canonicalDoc = SigningService.getCanonicalDocument(documentForVerification, { includeFields: ["command", "description", "from", "name"] });
239042
- const docString = JSON.stringify(canonicalDoc);
239043
- const messageHash = CryptoUtils.hash(docString);
239044
- const directVerify = CryptoUtils.verify(referenceSignature.publicKey, messageHash, referenceSignature.signature);
239045
- const isValid2 = SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ["command", "description", "from", "name"] });
239063
+ const isValid2 = await EnactCore.checkToolVerificationStatus(tool);
239064
+ console.log("Final verification result:", isValid2);
239046
239065
  if (!isValid2) {
239047
239066
  throw new Error(`Tool ${tool.name} has invalid signatures`);
239048
239067
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enactprotocol/mcp-server",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "MCP server for the Enact Protocol - enables AI tools integration via Model Context Protocol",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "node": ">=18.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@enactprotocol/shared": "1.2.7",
41
+ "@enactprotocol/shared": "1.2.9",
42
42
  "@modelcontextprotocol/sdk": "^1.13.0",
43
43
  "zod": "^3.25.67"
44
44
  },