mocode-ai 1.3.6 → 1.3.7

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.
@@ -113,7 +113,7 @@ const zhCN = {
113
113
  'composer.hint': 'Enter 换行 · Ctrl+S 回填 · Esc 取消 · Ctrl+Z 撤销 · Ctrl+C/X/V 复制/剪切/粘贴 · Ctrl+A 全选 · Shift+方向键 选择',
114
114
  'history.hint': '输入过滤 · ↑↓ 选择 · Enter 填入输入框 · Ctrl+Enter 直接发送 · Esc 取消',
115
115
  'history.empty': '(无匹配的历史输入)',
116
- 'welcome.ideNotice': '在电脑原生终端运行 mocode 可获得比IDE集成终端更佳的操作体验',
116
+ 'welcome.ideNotice': ' 在电脑原生终端运行 mocode 可获得比IDE集成终端更佳的操作体验',
117
117
  'welcome.gettingStarted': '快速上手',
118
118
  'welcome.start1': '直接输入消息,按 Enter 发送;Shift+Tab 切换 auto / plan 模式',
119
119
  'welcome.start2': '输入 / 打开命令菜单;输入 /help 查看全部命令',
@@ -60,7 +60,16 @@ function parseServer(name, raw, source, warnings) {
60
60
  }
61
61
  const transport = normalizeTransport(raw.transport ?? raw.type, raw);
62
62
  const requestTimeoutMs = positiveNumber(raw.requestTimeoutMs ?? raw.timeoutMs);
63
- const common = { name, transport, disabled: raw.disabled === true, ...(requestTimeoutMs ? { requestTimeoutMs } : {}) };
63
+ const includeTools = stringArray(raw.includeTools);
64
+ const excludeTools = stringArray(raw.excludeTools);
65
+ const common = {
66
+ name,
67
+ transport,
68
+ disabled: raw.disabled === true,
69
+ ...(requestTimeoutMs ? { requestTimeoutMs } : {}),
70
+ ...(includeTools ? { includeTools } : {}),
71
+ ...(excludeTools ? { excludeTools } : {}),
72
+ };
64
73
  if (transport === 'stdio') {
65
74
  if (typeof raw.command !== 'string' || !raw.command.trim()) {
66
75
  warnings.push(`${source}.${name} (stdio) 缺少 command`);
package/dist/mcp/index.js CHANGED
@@ -29,6 +29,8 @@ export function getMcpTools() {
29
29
  for (const client of clients.values()) {
30
30
  const serverPart = sanitizeName(client.name);
31
31
  for (const remote of client.cachedTools) {
32
+ if (!shouldRegisterTool(client.spec, remote.name))
33
+ continue;
32
34
  const localName = `mcp__${serverPart}__${sanitizeName(remote.name)}`;
33
35
  if (usedNames.has(localName)) {
34
36
  startupWarnings.push(`MCP ${client.name} 的工具 ${remote.name} 名称冲突,已忽略`);
@@ -67,6 +69,11 @@ export async function closeAllMcp() {
67
69
  await Promise.allSettled(active.map((client) => client.close()));
68
70
  }
69
71
  export function getMcpWarnings() { return [...startupWarnings]; }
72
+ function shouldRegisterTool(spec, remoteName) {
73
+ if (spec.excludeTools?.includes(remoteName))
74
+ return false;
75
+ return !spec.includeTools || spec.includeTools.includes(remoteName);
76
+ }
70
77
  function sanitizeName(name) {
71
78
  return name.replace(/[^A-Za-z0-9_-]+/g, '_').replace(/^_+|_+$/g, '') || 'tool';
72
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocode-ai",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "description": "终端编码 agent:LLM + tool-call 循环 + 流式输出(含思考)+ 16 个工具,接任意 OpenAI 兼容后端。",
5
5
  "type": "module",
6
6
  "bin": {