fix(mcp): http 传输支持跳过 TLS 证书校验(自签证书)
MCP server 走 HTTPS 且用自签证书时,客户端 TLS 校验失败,报 "tls: failed to verify certificate" 无法连接。 mcp_servers 增加 insecure 开关(默认 false),置 true 时远程 MCP 客户端使用 InsecureSkipVerify 的 transport。stdio 传输不受影响。 - mcphttp.New 增加 insecure 参数 - db: MCPServer.Insecure 字段 + schema 加列(补 ALTER 兼容旧库) - create_mcp/update_mcp 工具与前端 http 配置项增加勾选框 Closes #108
This commit is contained in:
1 parent
cde3ce9b25
commit
25b82f2544
8 files changed
+42
-12
No files matched your search
@@ -31,6 +31,7 @@ type FormState = {
|
||||
args: string;
|
||||
url: string;
|
||||
env: string;
|
||||
insecure: boolean;
|
||||
};
|
||||
const emptyForm: FormState = {
|
||||
name: "",
|
||||
@@ -39,6 +40,7 @@ const emptyForm: FormState = {
|
||||
args: "",
|
||||
url: "",
|
||||
env: "",
|
||||
insecure: false,
|
||||
};
|
||||
|
||||
export default function MCPPage() {
|
||||
@@ -111,6 +113,7 @@ export default function MCPPage() {
|
||||
args: (s.args ?? []).join(" "),
|
||||
url: s.url ?? "",
|
||||
env: envToText(s.env),
|
||||
insecure: s.insecure ?? false,
|
||||
});
|
||||
setTab("config");
|
||||
setOpen(true);
|
||||
@@ -151,12 +154,14 @@ export default function MCPPage() {
|
||||
command: "",
|
||||
args: [] as string[],
|
||||
env: parseEnv(form.env), // 远程模式下 env 即请求头
|
||||
insecure: form.insecure,
|
||||
}
|
||||
: {
|
||||
transport: "stdio" as const,
|
||||
command: form.command.trim(),
|
||||
args: form.args.trim() ? form.args.trim().split(/\s+/) : [],
|
||||
env: parseEnv(form.env),
|
||||
insecure: false,
|
||||
};
|
||||
await api.saveMcpServer({
|
||||
...(editing ? { id: editing.id } : {}),
|
||||
@@ -284,6 +289,13 @@ export default function MCPPage() {
|
||||
value={form.url}
|
||||
onChange={(e) => setF({ url: e.target.value })}
|
||||
/>
|
||||
<label className="flex items-center gap-2 text-sm">
|
||||
<Checkbox
|
||||
checked={form.insecure}
|
||||
onCheckedChange={(v) => setF({ insecure: v === true })}
|
||||
/>
|
||||
跳过 TLS 证书校验(自签证书)
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
<div className="grid gap-2">
|
||||
|
||||
@@ -1070,6 +1070,7 @@ export interface MCPServer {
|
||||
env: Record<string, string>;
|
||||
url?: string;
|
||||
enabled: boolean;
|
||||
insecure?: boolean; // http: skip TLS cert verification (self-signed servers)
|
||||
tools?: string[]; // mcp_tools_cache (names only, for the count)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user