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

推荐订阅源

云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
V
Visual Studio Blog
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MongoDB | Blog
MongoDB | Blog
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Engineering at Meta
Engineering at Meta
L
LangChain Blog
Martin Fowler
Martin Fowler
GbyAI
GbyAI
博客园 - 司徒正美

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
refactor(agents): share bundle MCP config merging · openc...
steipete · 2026-04-26 · via Recent Commits to openclaw:main

@@ -0,0 +1,95 @@

1+

import fs from "node:fs/promises";

2+

import { describe, expect, it } from "vitest";

3+

import { prepareCliBundleMcpConfig } from "./bundle-mcp.js";

4+5+

describe("prepareCliBundleMcpConfig gemini", () => {

6+

it("writes Gemini system settings for bundle MCP servers", async () => {

7+

const prepared = await prepareCliBundleMcpConfig({

8+

enabled: true,

9+

mode: "gemini-system-settings",

10+

backend: {

11+

command: "gemini",

12+

args: ["--prompt", "{prompt}"],

13+

},

14+

workspaceDir: "/tmp/openclaw-bundle-mcp-gemini",

15+

config: { plugins: { enabled: false } },

16+

additionalConfig: {

17+

mcpServers: {

18+

openclaw: {

19+

type: "http",

20+

url: "http://127.0.0.1:23119/mcp",

21+

headers: {

22+

Authorization: "Bearer ${OPENCLAW_MCP_TOKEN}",

23+

},

24+

},

25+

},

26+

},

27+

env: {

28+

OPENCLAW_MCP_TOKEN: "loopback-token-123",

29+

},

30+

});

31+32+

expect(prepared.backend.args).toEqual(["--prompt", "{prompt}"]);

33+

expect(prepared.env?.OPENCLAW_MCP_TOKEN).toBe("loopback-token-123");

34+

expect(typeof prepared.env?.GEMINI_CLI_SYSTEM_SETTINGS_PATH).toBe("string");

35+

const raw = JSON.parse(

36+

await fs.readFile(prepared.env?.GEMINI_CLI_SYSTEM_SETTINGS_PATH as string, "utf-8"),

37+

) as {

38+

mcp?: { allowed?: string[] };

39+

mcpServers?: Record<string, { url?: string; headers?: Record<string, string> }>;

40+

};

41+

expect(raw.mcp?.allowed).toEqual(["openclaw"]);

42+

expect(raw.mcpServers?.openclaw?.url).toBe("http://127.0.0.1:23119/mcp");

43+

expect(raw.mcpServers?.openclaw?.headers?.Authorization).toBe("Bearer loopback-token-123");

44+45+

await prepared.cleanup?.();

46+

});

47+48+

it("translates user mcp.servers transport fields in Gemini system settings", async () => {

49+

const prepared = await prepareCliBundleMcpConfig({

50+

enabled: true,

51+

mode: "gemini-system-settings",

52+

backend: {

53+

command: "gemini",

54+

args: ["--prompt", "{prompt}"],

55+

},

56+

workspaceDir: "/tmp/openclaw-bundle-mcp-gemini",

57+

config: {

58+

plugins: { enabled: false },

59+

mcp: {

60+

servers: {

61+

context7: {

62+

transport: "streamable-http",

63+

url: "https://mcp.context7.com/mcp",

64+

headers: {

65+

Authorization: "Bearer ${CONTEXT7_API_KEY}",

66+

},

67+

},

68+

},

69+

},

70+

},

71+

env: {

72+

CONTEXT7_API_KEY: "ctx7-test",

73+

},

74+

});

75+76+

expect(prepared.env?.CONTEXT7_API_KEY).toBe("ctx7-test");

77+

expect(typeof prepared.env?.GEMINI_CLI_SYSTEM_SETTINGS_PATH).toBe("string");

78+

const raw = JSON.parse(

79+

await fs.readFile(prepared.env?.GEMINI_CLI_SYSTEM_SETTINGS_PATH as string, "utf-8"),

80+

) as {

81+

mcp?: { allowed?: string[] };

82+

mcpServers?: Record<

83+

string,

84+

{ type?: string; transport?: string; url?: string; headers?: Record<string, string> }

85+

>;

86+

};

87+

expect(raw.mcp?.allowed).toEqual(["context7"]);

88+

expect(raw.mcpServers?.context7?.type).toBe("http");

89+

expect(raw.mcpServers?.context7?.transport).toBeUndefined();

90+

expect(raw.mcpServers?.context7?.url).toBe("https://mcp.context7.com/mcp");

91+

expect(raw.mcpServers?.context7?.headers?.Authorization).toBe("Bearer ctx7-test");

92+93+

await prepared.cleanup?.();

94+

});

95+

});