claude-sdk-proxy 2.3.1 → 2.3.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/package.json +1 -1
- package/src/mcpTools.ts +0 -30
package/package.json
CHANGED
package/src/mcpTools.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { z } from "zod"
|
|
|
3
3
|
import { createPrivateKey, createPublicKey, sign, randomBytes } from "node:crypto"
|
|
4
4
|
import { readFileSync } from "node:fs"
|
|
5
5
|
import { homedir } from "node:os"
|
|
6
|
-
import { execSync } from "node:child_process"
|
|
7
6
|
|
|
8
7
|
// ── Gateway helpers ──────────────────────────────────────────────────────────
|
|
9
8
|
|
|
@@ -158,35 +157,6 @@ export function createMcpServer(state: McpServerState = { messageSent: false })
|
|
|
158
157
|
name: "opencode",
|
|
159
158
|
version: "1.0.0",
|
|
160
159
|
tools: [
|
|
161
|
-
// exec: fallback for callers whose system prompt references "exec" instead of
|
|
162
|
-
// Claude Code's built-in "Bash" tool. Maps to child_process.execSync.
|
|
163
|
-
tool(
|
|
164
|
-
"exec",
|
|
165
|
-
"Execute a shell command and return its output. Use this for running scripts, system commands, and file operations.",
|
|
166
|
-
{
|
|
167
|
-
command: z.string().describe("The shell command to execute"),
|
|
168
|
-
timeout: z.number().optional().describe("Timeout in milliseconds (default 120000)"),
|
|
169
|
-
},
|
|
170
|
-
async (args) => {
|
|
171
|
-
try {
|
|
172
|
-
const output = execSync(args.command, {
|
|
173
|
-
encoding: "utf-8",
|
|
174
|
-
timeout: args.timeout ?? 120_000,
|
|
175
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
176
|
-
cwd: "/tmp",
|
|
177
|
-
})
|
|
178
|
-
return { content: [{ type: "text", text: output || "(no output)" }] }
|
|
179
|
-
} catch (error: any) {
|
|
180
|
-
const stderr = error.stderr ? String(error.stderr) : ""
|
|
181
|
-
const stdout = error.stdout ? String(error.stdout) : ""
|
|
182
|
-
const msg = error.message ?? "Command failed"
|
|
183
|
-
return {
|
|
184
|
-
content: [{ type: "text", text: `Error: ${msg}\n${stderr}\n${stdout}`.trim() }],
|
|
185
|
-
isError: true
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
),
|
|
190
160
|
tool(
|
|
191
161
|
"message",
|
|
192
162
|
"Send a message or file to a chat. Provide `to` (chat ID from conversation_label, e.g. '-1001426819337'), and either `message` (text) or `filePath`/`path`/`media` (absolute path to a file). Write files to /tmp/ before sending.",
|