修复 Codex MCP type 配置并更新发布包
This commit is contained in:
@@ -105,7 +105,6 @@ function createAgentRuntime(deps) {
|
||||
? ccwebMcpServerArgs
|
||||
: [ccwebMcpServerArg];
|
||||
args.push(
|
||||
'-c', 'mcp_servers.ccweb.type="stdio"',
|
||||
'-c', `mcp_servers.ccweb.command=${tomlString(nodePath || 'node')}`,
|
||||
'-c', `mcp_servers.ccweb.args=${tomlStringArray(serverArgs)}`,
|
||||
'-c', `mcp_servers.ccweb.env_vars=${tomlStringArray(envVars)}`,
|
||||
@@ -119,7 +118,7 @@ function createAgentRuntime(deps) {
|
||||
const config = mcpServer?.config && typeof mcpServer.config === 'object' ? mcpServer.config : null;
|
||||
if (!server || !config) return;
|
||||
const prefix = `mcp_servers.${tomlKeySegment(server)}`;
|
||||
for (const key of ['type', 'command', 'args', 'env', 'env_vars', 'url', 'bearer_token_env_var', 'startup_timeout_sec', 'tool_timeout_sec']) {
|
||||
for (const key of ['command', 'args', 'env', 'env_vars', 'url', 'bearer_token_env_var', 'startup_timeout_sec', 'tool_timeout_sec']) {
|
||||
if (!Object.prototype.hasOwnProperty.call(config, key)) continue;
|
||||
args.push('-c', `${prefix}.${key}=${tomlValue(config[key])}`);
|
||||
}
|
||||
|
||||
16
lib/codex-mcp-config.js
Normal file
16
lib/codex-mcp-config.js
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 生成发送给 Codex 的 MCP server 配置副本。
|
||||
*
|
||||
* 内部配置仍保留 type 作为传输类型元数据,Codex 出站协议只省略
|
||||
* 服务器顶层 type;嵌套 env 等对象保持原样。
|
||||
*/
|
||||
function toCodexMcpServerConfig(config) {
|
||||
if (!config || typeof config !== 'object' || Array.isArray(config)) return config;
|
||||
const result = { ...config };
|
||||
delete result.type;
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = { toCodexMcpServerConfig };
|
||||
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const { toCodexMcpServerConfig } = require('./codex-mcp-config');
|
||||
|
||||
/**
|
||||
* Gitea Webhook 工作流与 Codex App 之间的薄适配层。
|
||||
*
|
||||
@@ -118,7 +120,7 @@ function buildGiteaThreadConfig(options = {}) {
|
||||
return {
|
||||
cwd,
|
||||
config: {
|
||||
'mcp_servers.gitea': gitea,
|
||||
'mcp_servers.gitea': toCodexMcpServerConfig(gitea),
|
||||
},
|
||||
// 便于调用方在需要时直接合并到 thread/start 参数;server.js 使用 config。
|
||||
mcpServer: gitea,
|
||||
|
||||
Reference in New Issue
Block a user