just-bash-mcp 2.9.1 → 2.9.2

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
@@ -180,7 +180,8 @@ Get current working directory or environment variables.
180
180
 
181
181
  Compatible with the Vercel Sandbox API:
182
182
 
183
- - `bash_sandbox_run` - Run a command in the sandbox
183
+ - `bash_sandbox_run` - Run a command in the sandbox (optionally include structured output/logs)
184
+ - `bash_sandbox_domain` - Get the sandbox domain/identifier
184
185
  - `bash_sandbox_write_files` - Write multiple files at once
185
186
  - `bash_sandbox_read_file` - Read a file (supports base64 encoding)
186
187
  - `bash_sandbox_mkdir` - Create a directory
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "just-bash-mcp",
3
- "version": "2.9.1",
3
+ "version": "2.9.2",
4
4
  "description": "MCP server providing a sandboxed bash environment using just-bash",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -60,14 +60,14 @@
60
60
  },
61
61
  "packageManager": "bun@1.3.8",
62
62
  "dependencies": {
63
- "@modelcontextprotocol/sdk": "^1.26.0",
63
+ "@modelcontextprotocol/sdk": "^1.27.0",
64
64
  "just-bash": "^2.10.2",
65
65
  "zod": "^4.3.6"
66
66
  },
67
67
  "devDependencies": {
68
- "@types/node": "^25.2.3",
68
+ "@types/node": "^25.3.0",
69
69
  "oxfmt": "^0.28.0",
70
- "oxlint": "^1.48.0",
70
+ "oxlint": "^1.50.0",
71
71
  "oxlint-tsgolint": "^0.11.5"
72
72
  }
73
73
  }
package/src/index.ts CHANGED
File without changes
@@ -15,6 +15,7 @@ import {
15
15
  RedirectNotAllowedError,
16
16
  SecurityViolationError,
17
17
  TooManyRedirectsError,
18
+ type OutputMessage,
18
19
  } from "just-bash";
19
20
  import { z } from "zod/v4";
20
21
  import { config } from "../config/index.ts";
@@ -61,16 +62,28 @@ export function registerSandboxTools(server: McpServer): void {
61
62
  command: z.string().describe("The command to execute"),
62
63
  cwd: z.string().optional().describe("Working directory for the command"),
63
64
  env: z.record(z.string(), z.string()).optional().describe("Environment variables to set"),
65
+ includeOutput: z
66
+ .boolean()
67
+ .optional()
68
+ .describe("Include structured output messages from SandboxCommand.output()"),
69
+ includeLogs: z
70
+ .boolean()
71
+ .optional()
72
+ .describe("Include execution logs from SandboxCommand.logs()"),
64
73
  },
65
74
  },
66
75
  async ({
67
76
  command,
68
77
  cwd,
69
78
  env,
79
+ includeOutput = false,
80
+ includeLogs = false,
70
81
  }: {
71
82
  command: string;
72
83
  cwd?: string;
73
84
  env?: Record<string, string>;
85
+ includeOutput?: boolean;
86
+ includeLogs?: boolean;
74
87
  }) => {
75
88
  try {
76
89
  const sandbox = await getPersistentSandbox();
@@ -79,20 +92,55 @@ export function registerSandboxTools(server: McpServer): void {
79
92
  const stdout = await cmd.stdout();
80
93
  const stderr = await cmd.stderr();
81
94
 
82
- return createJsonResponse(
83
- {
84
- stdout: truncateOutput(stdout, config.MAX_OUTPUT_LENGTH, "stdout"),
85
- stderr: truncateOutput(stderr, config.MAX_OUTPUT_LENGTH, "stderr"),
86
- exitCode: result.exitCode,
87
- },
88
- result.exitCode !== 0,
89
- );
95
+ const response: {
96
+ stdout: string;
97
+ stderr: string;
98
+ exitCode: number;
99
+ output?: string;
100
+ logs?: OutputMessage[];
101
+ } = {
102
+ stdout: truncateOutput(stdout, config.MAX_OUTPUT_LENGTH, "stdout"),
103
+ stderr: truncateOutput(stderr, config.MAX_OUTPUT_LENGTH, "stderr"),
104
+ exitCode: result.exitCode,
105
+ };
106
+
107
+ if (includeOutput) {
108
+ response.output = truncateOutput(await cmd.output(), config.MAX_OUTPUT_LENGTH, "stdout");
109
+ }
110
+ if (includeLogs) {
111
+ const logs: OutputMessage[] = [];
112
+ for await (const message of cmd.logs()) {
113
+ logs.push(message);
114
+ }
115
+ response.logs = logs;
116
+ }
117
+
118
+ return createJsonResponse(response, result.exitCode !== 0);
90
119
  } catch (error) {
91
120
  return classifyError(error, "Sandbox error");
92
121
  }
93
122
  },
94
123
  );
95
124
 
125
+ // ========================================================================
126
+ // bash_sandbox_domain - Get sandbox domain
127
+ // ========================================================================
128
+ server.registerTool(
129
+ "bash_sandbox_domain",
130
+ {
131
+ description: "Get the current sandbox domain/identifier.",
132
+ inputSchema: {},
133
+ },
134
+ async () => {
135
+ try {
136
+ const sandbox = await getPersistentSandbox();
137
+ return createJsonResponse({ domain: sandbox.domain });
138
+ } catch (error) {
139
+ return classifyError(error, "Domain error");
140
+ }
141
+ },
142
+ );
143
+
96
144
  // ========================================================================
97
145
  // bash_sandbox_write_files - Write multiple files
98
146
  // ========================================================================