@aipermission/mcp 0.1.7 → 0.1.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/README.md CHANGED
@@ -54,6 +54,7 @@ The generated MCP config contains a bearer token. Keep it private. For project-l
54
54
  - `get_request`
55
55
  - `list_requests`
56
56
  - `read_console`
57
+ - `restart_console_session`
57
58
  - `send_message`
58
59
  - `list_file_transfers`
59
60
  - `get_file_transfer`
@@ -97,11 +98,11 @@ Supported clients:
97
98
  - `gemini`: `GEMINI.md`
98
99
  - `custom`: prints portable Markdown to stdout
99
100
 
100
- These instructions teach the agent how to poll `approval_pending` and `running` requests, read live console output, write short reasons, use explicit file transfer paths, and avoid printing secrets. The default installer uses the operator instruction bundled in the npm package; `--source` accepts local file paths only and rejects HTTP(S) sources.
101
+ These instructions teach the agent how to poll `approval_pending` and `running` requests, handle `stale` approvals by sending a fresh request, read live console output, write short reasons, use explicit file transfer paths, and avoid printing secrets. The default installer uses the operator instruction bundled in the npm package; `--source` accepts local file paths only and rejects HTTP(S) sources.
101
102
 
102
103
  ## Security Boundary
103
104
 
104
- This package talks to a local AIPermission gateway. `AIPERMISSION_API_URL` must point to `localhost`, `127.0.0.1`, or `[::1]`; remote URLs are rejected before the bearer token is sent. Do not expose the gateway on LAN or the public internet, and do not use it as a shared DevOps service. Tokens grant access only to the servers and execution rules configured in the gateway UI.
105
+ This package talks to a local AIPermission gateway. `AIPERMISSION_API_URL` must point to `localhost`, `127.0.0.1`, or `[::1]`; remote URLs are rejected before the bearer token is sent. Do not expose the gateway on LAN or the public internet, and do not use it as a shared DevOps service. Tokens grant access only to the servers and execution rules configured in the gateway UI. Token/server permissions may be temporary; expired grants are omitted from `list_servers` and no longer authorize command, console, or file-transfer tools.
105
106
 
106
107
  ## License
107
108
 
@@ -18,11 +18,14 @@ AIPermission is not a general DevOps control plane. Treat it as a temporary, sco
18
18
  Before executing commands:
19
19
 
20
20
  1. Call `list_servers()`.
21
- 2. Read each server's `name`, `id`, `execution_rule`, and `hints`.
21
+ 2. Read each server's `name`, `id`, `execution_rule`, optional `expires_at`,
22
+ and `hints`.
22
23
  3. Use the numeric `id` returned by the tool.
23
24
  4. Pick the narrowest server set that can answer the task.
24
25
 
25
26
  If no server is visible, say that the current token has no accessible servers.
27
+ If `expires_at` is present, treat access as temporary. Finish within that
28
+ maintenance window or ask the operator to extend access.
26
29
 
27
30
  ## Command Reasons
28
31
 
@@ -64,9 +67,11 @@ failed
64
67
  declined
65
68
  blocked
66
69
  error
70
+ stale
67
71
  ```
68
72
 
69
73
  If the request is `declined`, read `user_note` and follow the user's correction.
74
+ If the request is `stale`, the approval context changed before execution; send a fresh `exec` request with the current command and reason instead of trying to reuse the old approval.
70
75
 
71
76
  ## Running Flow
72
77
 
@@ -77,6 +82,13 @@ When `exec` or `get_request` returns `running`:
77
82
  3. Use `read_console(server_id)` between polls only when the token has `always_run` permission.
78
83
  4. Do not start another long-running command on the same server until the active request reaches a terminal status, unless the user explicitly asks.
79
84
 
85
+ If the request appears stuck for an unusually long time and `read_console`
86
+ shows no useful progress, ask the operator before recovery. When the operator
87
+ agrees, call `restart_console_session(server_id)`. This closes the
88
+ gateway-owned persistent console session and the next `exec` opens a fresh SSH
89
+ session. Treat any canceled request as inconclusive and re-run only the minimal
90
+ safe inspection needed.
91
+
80
92
  ## Message Flow
81
93
 
82
94
  Use `send_message(message, server_id?, session_id?)` for short operator-visible notes.
package/dist/server.js CHANGED
@@ -72,6 +72,19 @@ server.tool(
72
72
  }
73
73
  );
74
74
 
75
+ server.tool(
76
+ "restart_console_session",
77
+ "Restart the persistent console session for a server when it appears stuck. This closes the current gateway-owned console session and the next exec will open a fresh SSH session.",
78
+ {
79
+ server_id: z.number().int().positive().describe("Server id from list_servers."),
80
+ },
81
+ async ({ server_id }) => {
82
+ return jsonToolResult(() => apiPost("/api/mcp/console/restart", {
83
+ server_id,
84
+ }));
85
+ }
86
+ );
87
+
75
88
  server.tool(
76
89
  "get_request",
77
90
  "Read an aipermission command request by id. Use this after exec returns approval_pending or running.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aipermission/mcp",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "mcpName": "io.github.aipermission/aipermission-mcp",
5
5
  "description": "Local-first MCP bridge for the aipermission gateway.",
6
6
  "license": "MIT",
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.1.7",
6
+ "version": "0.1.9",
7
7
  "packages": [
8
8
  {
9
9
  "registryType": "npm",
10
10
  "identifier": "@aipermission/mcp",
11
- "version": "0.1.7",
11
+ "version": "0.1.9",
12
12
  "transport": {
13
13
  "type": "stdio"
14
14
  }