惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
月光博客
月光博客
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
T
The Blog of Author Tim Ferriss
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
U
Unit 42
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MyScale Blog
MyScale Blog
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
B
Blog
博客园_首页
G
Google Developers Blog
Recent Announcements
Recent Announcements
博客园 - 【当耐特】
P
Proofpoint News Feed
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
feat: expose OpenClaw tools to ACPX · openclaw/openclaw@c...
steipete · 2026-04-23 · via Recent Commits to openclaw:main

@@ -1,4 +1,5 @@

11

import fs from "node:fs";

2+

import { createRequire } from "node:module";

23

import path from "node:path";

34

import { fileURLToPath } from "node:url";

45

import { formatPluginConfigIssue } from "openclaw/plugin-sdk/extension-shared";

@@ -25,6 +26,8 @@ export {

2526

} from "./config-schema.js";

26272728

export const ACPX_PLUGIN_TOOLS_MCP_SERVER_NAME = "openclaw-plugin-tools";

29+

export const ACPX_OPENCLAW_TOOLS_MCP_SERVER_NAME = "openclaw-tools";

30+

const requireFromHere = createRequire(import.meta.url);

28312932

function isAcpxPluginRoot(dir: string): boolean {

3033

return (

@@ -140,6 +143,14 @@ function resolveOpenClawRoot(currentRoot: string): string {

140143

return path.resolve(currentRoot, "..");

141144

}

142145146+

function resolveTsxImportSpecifier(): string {

147+

try {

148+

return requireFromHere.resolve("tsx");

149+

} catch {

150+

return "tsx";

151+

}

152+

}

153+143154

export function resolvePluginToolsMcpServerConfig(

144155

moduleUrl: string = import.meta.url,

145156

): McpServerConfig {

@@ -155,25 +166,56 @@ export function resolvePluginToolsMcpServerConfig(

155166

const sourceEntry = path.join(openClawRoot, "src", "mcp", "plugin-tools-serve.ts");

156167

return {

157168

command: process.execPath,

158-

args: ["--import", "tsx", sourceEntry],

169+

args: ["--import", resolveTsxImportSpecifier(), sourceEntry],

170+

};

171+

}

172+173+

export function resolveOpenClawToolsMcpServerConfig(

174+

moduleUrl: string = import.meta.url,

175+

): McpServerConfig {

176+

const pluginRoot = resolveAcpxPluginRoot(moduleUrl);

177+

const openClawRoot = resolveOpenClawRoot(pluginRoot);

178+

const distEntry = path.join(openClawRoot, "dist", "mcp", "openclaw-tools-serve.js");

179+

if (fs.existsSync(distEntry)) {

180+

return {

181+

command: process.execPath,

182+

args: [distEntry],

183+

};

184+

}

185+

const sourceEntry = path.join(openClawRoot, "src", "mcp", "openclaw-tools-serve.ts");

186+

return {

187+

command: process.execPath,

188+

args: ["--import", resolveTsxImportSpecifier(), sourceEntry],

159189

};

160190

}

161191162192

function resolveConfiguredMcpServers(params: {

163193

mcpServers?: Record<string, McpServerConfig>;

164194

pluginToolsMcpBridge: boolean;

195+

openClawToolsMcpBridge: boolean;

165196

moduleUrl?: string;

166197

}): Record<string, McpServerConfig> {

167198

const resolved = { ...params.mcpServers };

168-

if (!params.pluginToolsMcpBridge) {

169-

return resolved;

170-

}

171-

if (resolved[ACPX_PLUGIN_TOOLS_MCP_SERVER_NAME]) {

199+

if (params.pluginToolsMcpBridge && resolved[ACPX_PLUGIN_TOOLS_MCP_SERVER_NAME]) {

172200

throw new Error(

173201

`mcpServers.${ACPX_PLUGIN_TOOLS_MCP_SERVER_NAME} is reserved when pluginToolsMcpBridge=true`,

174202

);

175203

}

176-

resolved[ACPX_PLUGIN_TOOLS_MCP_SERVER_NAME] = resolvePluginToolsMcpServerConfig(params.moduleUrl);

204+

if (params.openClawToolsMcpBridge && resolved[ACPX_OPENCLAW_TOOLS_MCP_SERVER_NAME]) {

205+

throw new Error(

206+

`mcpServers.${ACPX_OPENCLAW_TOOLS_MCP_SERVER_NAME} is reserved when openClawToolsMcpBridge=true`,

207+

);

208+

}

209+

if (params.pluginToolsMcpBridge) {

210+

resolved[ACPX_PLUGIN_TOOLS_MCP_SERVER_NAME] = resolvePluginToolsMcpServerConfig(

211+

params.moduleUrl,

212+

);

213+

}

214+

if (params.openClawToolsMcpBridge) {

215+

resolved[ACPX_OPENCLAW_TOOLS_MCP_SERVER_NAME] = resolveOpenClawToolsMcpServerConfig(

216+

params.moduleUrl,

217+

);

218+

}

177219

return resolved;

178220

}

179221

@@ -204,9 +246,11 @@ export function resolveAcpxPluginConfig(params: {

204246

const cwd = path.resolve(normalized.cwd?.trim() || fallbackCwd);

205247

const stateDir = path.resolve(normalized.stateDir?.trim() || path.join(workspaceDir, "state"));

206248

const pluginToolsMcpBridge = normalized.pluginToolsMcpBridge === true;

249+

const openClawToolsMcpBridge = normalized.openClawToolsMcpBridge === true;

207250

const mcpServers = resolveConfiguredMcpServers({

208251

mcpServers: normalized.mcpServers,

209252

pluginToolsMcpBridge,

253+

openClawToolsMcpBridge,

210254

moduleUrl: params.moduleUrl,

211255

});

212256

const agents = Object.fromEntries(

@@ -224,6 +268,7 @@ export function resolveAcpxPluginConfig(params: {

224268

nonInteractivePermissions:

225269

normalized.nonInteractivePermissions ?? DEFAULT_NON_INTERACTIVE_POLICY,

226270

pluginToolsMcpBridge,

271+

openClawToolsMcpBridge,

227272

strictWindowsCmdWrapper:

228273

normalized.strictWindowsCmdWrapper ?? DEFAULT_STRICT_WINDOWS_CMD_WRAPPER,

229274

timeoutSeconds: normalized.timeoutSeconds ?? DEFAULT_ACPX_TIMEOUT_SECONDS,