@aipermission/mcp 0.2.37 → 0.2.39

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/server.js CHANGED
@@ -11,6 +11,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
11
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
12
12
  import { z } from "zod";
13
13
  import { callVaultActionSchema, listVaultItemsSchema, vaultActionRequestSchema } from "./vault-tools.js";
14
+ import { MCP_SERVER_INSTRUCTIONS } from "./instructions.js";
14
15
  import { normalizeLocalAPIURL } from "./local-url.js";
15
16
  import { jsonToolResult } from "./results.js";
16
17
 
@@ -19,10 +20,13 @@ const apiUrl = normalizeLocalAPIURL(process.env.AIPERMISSION_API_URL);
19
20
  const apiToken = process.env.AIPERMISSION_API_TOKEN || "";
20
21
  const apiTimeoutMs = Number.parseInt(process.env.AIPERMISSION_HTTP_TIMEOUT_MS || "60000", 10);
21
22
 
22
- const server = new McpServer({
23
- name: "aipermission",
24
- version: packageMetadata.version,
25
- });
23
+ const server = new McpServer(
24
+ {
25
+ name: "aipermission",
26
+ version: packageMetadata.version,
27
+ },
28
+ { instructions: MCP_SERVER_INSTRUCTIONS },
29
+ );
26
30
 
27
31
  server.tool(
28
32
  "list_connector_targets",
@@ -30,7 +34,7 @@ server.tool(
30
34
  {},
31
35
  async () => {
32
36
  return jsonToolResult(() => apiGet("/api/mcp/connector-targets"));
33
- }
37
+ },
34
38
  );
35
39
 
36
40
  server.tool(
@@ -44,7 +48,7 @@ server.tool(
44
48
  const params = new URLSearchParams({ target_ref });
45
49
  return apiGet(`/api/mcp/connector-help?${params.toString()}`);
46
50
  });
47
- }
51
+ },
48
52
  );
49
53
 
50
54
  server.tool(
@@ -58,7 +62,7 @@ server.tool(
58
62
  const params = new URLSearchParams({ target_ref });
59
63
  return apiGet(`/api/mcp/connector-actions?${params.toString()}`);
60
64
  });
61
- }
65
+ },
62
66
  );
63
67
 
64
68
  server.tool(
@@ -69,17 +73,24 @@ server.tool(
69
73
  action_name: z.string().min(1).describe("Action name from get_connector_actions."),
70
74
  input: z.record(z.unknown()).optional().describe("Connector-specific action input."),
71
75
  reason: z.string().optional().describe("Why this connector action is needed."),
72
- idempotency_key: z.string().min(1).max(128).optional().describe("Caller-stable key that makes retries return the original request without running twice."),
76
+ idempotency_key: z
77
+ .string()
78
+ .min(1)
79
+ .max(128)
80
+ .optional()
81
+ .describe("Caller-stable key that makes retries return the original request without running twice."),
73
82
  },
74
83
  async ({ target_ref, action_name, input, reason, idempotency_key }) => {
75
- return jsonToolResult(() => apiPost("/api/mcp/connector-actions/call", {
76
- target_ref,
77
- action_name,
78
- input: input || {},
79
- reason: reason || "",
80
- idempotency_key,
81
- }));
82
- }
84
+ return jsonToolResult(() =>
85
+ apiPost("/api/mcp/connector-actions/call", {
86
+ target_ref,
87
+ action_name,
88
+ input: input || {},
89
+ reason: reason || "",
90
+ idempotency_key,
91
+ }),
92
+ );
93
+ },
83
94
  );
84
95
 
85
96
  server.tool(
@@ -90,7 +101,7 @@ server.tool(
90
101
  },
91
102
  async ({ request_id }) => {
92
103
  return jsonToolResult(() => apiGet(`/api/mcp/connector-action-requests/${request_id}`));
93
- }
104
+ },
94
105
  );
95
106
 
96
107
  server.tool(
@@ -104,7 +115,7 @@ server.tool(
104
115
  const query = params.toString();
105
116
  return apiGet(`/api/mcp/vault-items${query ? `?${query}` : ""}`);
106
117
  });
107
- }
118
+ },
108
119
  );
109
120
 
110
121
  server.tool(
@@ -112,14 +123,16 @@ server.tool(
112
123
  "Run a Vault action under the configured project capability. Prompt waits for local approval; Always executes immediately through the same tracked request path. generate_item input accepts name, secret_type, generator_kind, provider, environment, description, expires_at, expiry_warning_days, tags (string array), usage_notes (array of {location, notes}), and shared_project_ids (integer array). restart_session_with_environment input requires target_ref and items with item_id, source_project_id, and optional replace_existing. Never include raw secret values.",
113
124
  callVaultActionSchema,
114
125
  async ({ project_ref, action_name, input, reason, idempotency_key }) => {
115
- return jsonToolResult(() => apiPost("/api/mcp/vault-actions/call", {
116
- project_ref,
117
- action_name,
118
- input,
119
- reason,
120
- idempotency_key,
121
- }));
122
- }
126
+ return jsonToolResult(() =>
127
+ apiPost("/api/mcp/vault-actions/call", {
128
+ project_ref,
129
+ action_name,
130
+ input,
131
+ reason,
132
+ idempotency_key,
133
+ }),
134
+ );
135
+ },
123
136
  );
124
137
 
125
138
  server.tool(
@@ -128,7 +141,7 @@ server.tool(
128
141
  vaultActionRequestSchema,
129
142
  async ({ request_id }) => {
130
143
  return jsonToolResult(() => apiGet(`/api/mcp/vault-action-requests/${request_id}`));
131
- }
144
+ },
132
145
  );
133
146
 
134
147
  server.tool(
@@ -137,7 +150,7 @@ server.tool(
137
150
  vaultActionRequestSchema,
138
151
  async ({ request_id }) => {
139
152
  return jsonToolResult(() => apiPost(`/api/mcp/vault-action-requests/${request_id}/cancel`, {}));
140
- }
153
+ },
141
154
  );
142
155
 
143
156
  const transport = new StdioServerTransport();
@@ -190,7 +203,7 @@ async function apiFetch(path, options) {
190
203
  });
191
204
  } catch (error) {
192
205
  if (error?.name === "AbortError") {
193
- throw new Error(`AIPermission API request timed out after ${timeout}ms`);
206
+ throw new Error(`AIPermission API request timed out after ${timeout}ms`, { cause: error });
194
207
  }
195
208
  throw error;
196
209
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aipermission/mcp",
3
- "version": "0.2.37",
3
+ "version": "0.2.39",
4
4
  "mcpName": "io.github.aipermission/aipermission-mcp",
5
5
  "description": "Local-first MCP bridge for the aipermission gateway.",
6
6
  "license": "AGPL-3.0-only",
@@ -28,16 +28,34 @@
28
28
  ],
29
29
  "scripts": {
30
30
  "build": "node scripts/build.js",
31
+ "format": "prettier --write \"src/**/*.js\" \"test/**/*.js\" \"scripts/**/*.js\"",
32
+ "format:check": "prettier --check \"src/**/*.js\" \"test/**/*.js\" \"scripts/**/*.js\"",
33
+ "lint": "eslint src test scripts",
31
34
  "prepack": "npm run build",
32
- "test": "node --test test/*.test.js",
35
+ "test": "npm run build && node --test test/*.test.js",
33
36
  "start": "node dist/cli.js",
34
37
  "dev": "node src/cli.js"
35
38
  },
36
39
  "engines": {
37
40
  "node": ">=20"
38
41
  },
42
+ "devEngines": {
43
+ "runtime": {
44
+ "name": "node",
45
+ "version": ">=20.19.0",
46
+ "onFail": "error"
47
+ }
48
+ },
39
49
  "dependencies": {
40
50
  "@modelcontextprotocol/sdk": "1.30.0",
51
+ "smol-toml": "1.8.0",
52
+ "yaml": "2.9.0",
41
53
  "zod": "3.25.76"
54
+ },
55
+ "devDependencies": {
56
+ "@eslint/js": "^10.0.1",
57
+ "eslint": "^10.9.1",
58
+ "globals": "^17.11.0",
59
+ "prettier": "^3.9.6"
42
60
  }
43
61
  }
package/server.json CHANGED
@@ -3,12 +3,12 @@
3
3
  "name": "io.github.aipermission/aipermission-mcp",
4
4
  "title": "AIPermission",
5
5
  "description": "Local-first MCP bridge for the AIPermission gateway.",
6
- "version": "0.2.37",
6
+ "version": "0.2.39",
7
7
  "packages": [
8
8
  {
9
9
  "registryType": "npm",
10
10
  "identifier": "@aipermission/mcp",
11
- "version": "0.2.37",
11
+ "version": "0.2.39",
12
12
  "transport": {
13
13
  "type": "stdio"
14
14
  }