openclaw-mcp 1.1.0 → 1.2.0
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 +3 -2
- package/dist/index.js +33 -17
- package/docs/configuration.md +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ docker compose up -d
|
|
|
68
68
|
|
|
69
69
|
Then in Claude.ai add a custom MCP connector pointing to your server with `MCP_CLIENT_ID=openclaw` and your `MCP_CLIENT_SECRET`.
|
|
70
70
|
|
|
71
|
-
> **Tip:** Pin a specific version instead of `latest` for production: `ghcr.io/freema/openclaw-mcp:
|
|
71
|
+
> **Tip:** Pin a specific version instead of `latest` for production: `ghcr.io/freema/openclaw-mcp:1.1.0`
|
|
72
72
|
|
|
73
73
|
### Local (Claude Desktop)
|
|
74
74
|
|
|
@@ -86,7 +86,8 @@ Add to your Claude Desktop config:
|
|
|
86
86
|
"args": ["openclaw-mcp"],
|
|
87
87
|
"env": {
|
|
88
88
|
"OPENCLAW_URL": "http://127.0.0.1:18789",
|
|
89
|
-
"OPENCLAW_GATEWAY_TOKEN": "your-gateway-token"
|
|
89
|
+
"OPENCLAW_GATEWAY_TOKEN": "your-gateway-token",
|
|
90
|
+
"OPENCLAW_TIMEOUT_MS": "300000"
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
}
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,6 @@ var DEFAULT_OPENCLAW_URL = "http://127.0.0.1:18789";
|
|
|
10
10
|
var SERVER_ICON_SVG_BASE64 = "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiB2aWV3Qm94PSIwIDAgMTI4IDEyOCIgZmlsbD0ibm9uZSI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJiZyIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMTAwJS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|
|
11
11
|
|
|
12
12
|
// src/utils/logger.ts
|
|
13
|
-
var DEBUG = process.env.DEBUG === "true" || process.env.NODE_ENV === "development";
|
|
14
13
|
var SENSITIVE_PATTERNS = [
|
|
15
14
|
/Bearer\s+[A-Za-z0-9\-._~+/]+=*/gi,
|
|
16
15
|
/api[_-]?key["\s:=]+[A-Za-z0-9\-._~+/]{8,}/gi,
|
|
@@ -67,6 +66,10 @@ function parseArguments(version) {
|
|
|
67
66
|
type: "string",
|
|
68
67
|
description: "Host for SSE server",
|
|
69
68
|
default: process.env.HOST || "0.0.0.0"
|
|
69
|
+
}).option("timeout", {
|
|
70
|
+
type: "number",
|
|
71
|
+
description: "Request timeout in milliseconds",
|
|
72
|
+
default: parseInt(process.env.OPENCLAW_TIMEOUT_MS || "120000", 10)
|
|
70
73
|
}).option("auth", {
|
|
71
74
|
type: "boolean",
|
|
72
75
|
description: "Enable OAuth authentication (SSE mode)",
|
|
@@ -94,6 +97,7 @@ function parseArguments(version) {
|
|
|
94
97
|
transport: argv.transport,
|
|
95
98
|
port: argv.port,
|
|
96
99
|
host: argv.host,
|
|
100
|
+
timeout: argv.timeout,
|
|
97
101
|
authEnabled: argv.auth,
|
|
98
102
|
clientId: argv["client-id"],
|
|
99
103
|
clientSecret: argv["client-secret"],
|
|
@@ -125,7 +129,7 @@ var OpenClawApiError = class extends OpenClawError {
|
|
|
125
129
|
};
|
|
126
130
|
|
|
127
131
|
// src/openclaw/client.ts
|
|
128
|
-
var DEFAULT_TIMEOUT_MS =
|
|
132
|
+
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
129
133
|
var MAX_RESPONSE_SIZE_BYTES = 10 * 1024 * 1024;
|
|
130
134
|
var OpenClawClient = class {
|
|
131
135
|
baseUrl;
|
|
@@ -230,14 +234,23 @@ var OpenClawClient = class {
|
|
|
230
234
|
/**
|
|
231
235
|
* Send a chat message via the OpenAI-compatible /v1/chat/completions endpoint.
|
|
232
236
|
*/
|
|
233
|
-
async chat(message,
|
|
237
|
+
async chat(message, sessionId) {
|
|
238
|
+
const body = {
|
|
239
|
+
model: "claude-opus-4-5",
|
|
240
|
+
messages: [{ role: "user", content: message }],
|
|
241
|
+
max_tokens: 4096
|
|
242
|
+
};
|
|
243
|
+
if (sessionId) {
|
|
244
|
+
body.session_id = sessionId;
|
|
245
|
+
}
|
|
246
|
+
const headers = {};
|
|
247
|
+
if (sessionId) {
|
|
248
|
+
headers["x-openclaw-session-key"] = sessionId;
|
|
249
|
+
}
|
|
234
250
|
const completion = await this.request("/v1/chat/completions", {
|
|
235
251
|
method: "POST",
|
|
236
|
-
body: JSON.stringify(
|
|
237
|
-
|
|
238
|
-
messages: [{ role: "user", content: message }],
|
|
239
|
-
max_tokens: 4096
|
|
240
|
-
})
|
|
252
|
+
body: JSON.stringify(body),
|
|
253
|
+
headers
|
|
241
254
|
});
|
|
242
255
|
const content = completion.choices?.[0]?.message?.content ?? "";
|
|
243
256
|
return {
|
|
@@ -595,13 +608,9 @@ var processorClient = null;
|
|
|
595
608
|
async function processTask(task, client2) {
|
|
596
609
|
taskManager.updateStatus(task.id, "running");
|
|
597
610
|
try {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
taskManager.updateStatus(task.id, "completed", response.response);
|
|
602
|
-
} else {
|
|
603
|
-
taskManager.updateStatus(task.id, "failed", void 0, "Unknown task type");
|
|
604
|
-
}
|
|
611
|
+
const input = task.input;
|
|
612
|
+
const response = await client2.chat(input.message, input.session_id);
|
|
613
|
+
taskManager.updateStatus(task.id, "completed", response.response);
|
|
605
614
|
} catch (error) {
|
|
606
615
|
const errorMsg = error instanceof Error ? error.message : "Unknown error";
|
|
607
616
|
taskManager.updateStatus(task.id, "failed", void 0, errorMsg);
|
|
@@ -702,7 +711,13 @@ async function handleOpenclawTaskStatus(_client, input) {
|
|
|
702
711
|
}
|
|
703
712
|
return successResponse(JSON.stringify(response, null, 2));
|
|
704
713
|
}
|
|
705
|
-
var VALID_TASK_STATUSES = [
|
|
714
|
+
var VALID_TASK_STATUSES = [
|
|
715
|
+
"pending",
|
|
716
|
+
"running",
|
|
717
|
+
"completed",
|
|
718
|
+
"failed",
|
|
719
|
+
"cancelled"
|
|
720
|
+
];
|
|
706
721
|
async function handleOpenclawTaskList(_client, input) {
|
|
707
722
|
if (!validateInputIsObject(input)) {
|
|
708
723
|
return errorResponse("Invalid input: expected an object");
|
|
@@ -1266,7 +1281,7 @@ async function createSSEServer(config, deps2) {
|
|
|
1266
1281
|
|
|
1267
1282
|
// src/index.ts
|
|
1268
1283
|
var args = parseArguments(SERVER_VERSION);
|
|
1269
|
-
var client = new OpenClawClient(args.openclawUrl, args.gatewayToken);
|
|
1284
|
+
var client = new OpenClawClient(args.openclawUrl, args.gatewayToken, args.timeout);
|
|
1270
1285
|
var deps = {
|
|
1271
1286
|
client,
|
|
1272
1287
|
serverName: SERVER_NAME,
|
|
@@ -1277,6 +1292,7 @@ async function main() {
|
|
|
1277
1292
|
log(`OpenClaw URL: ${args.openclawUrl}`);
|
|
1278
1293
|
log(`Transport: ${args.transport}`);
|
|
1279
1294
|
log(`Gateway token: ${args.gatewayToken ? "configured" : "not set"}`);
|
|
1295
|
+
log(`Request timeout: ${args.timeout}ms`);
|
|
1280
1296
|
if (args.transport === "sse") {
|
|
1281
1297
|
const sseConfig = {
|
|
1282
1298
|
port: args.port,
|
package/docs/configuration.md
CHANGED
|
@@ -10,6 +10,7 @@ All configuration can be done via environment variables. Copy `.env.example` to
|
|
|
10
10
|
|----------|-------------|---------|
|
|
11
11
|
| `OPENCLAW_URL` | OpenClaw gateway URL | `http://127.0.0.1:18789` |
|
|
12
12
|
| `OPENCLAW_GATEWAY_TOKEN` | Bearer token for gateway authentication | (none) |
|
|
13
|
+
| `OPENCLAW_TIMEOUT_MS` | Request timeout in milliseconds | `120000` (2 min) |
|
|
13
14
|
|
|
14
15
|
### Server Settings (SSE transport)
|
|
15
16
|
|
package/package.json
CHANGED