mcp: "enabled": false is dropped at parse, so the server still starts

Đang mở Phù hợp với người mới
#61,589 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@HoneyPaptan đang làm issue này rồi.

Từ ngày 4/11/2026.

  • #61760 của @HoneyPaptan — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu bằng cách lần theo quá trình phân tích cấu hình máy chủ MCP và bước kiểm tra khi khởi động được mô tả trong báo cáo, sau đó kiểm tra schema cấu hình cho tùy chọn enabled đã được tài liệu hóa. Tái hiện bằng opencode --standalone debug config với bốn mục trong issue. Hoàn tất khi enabled: false được giữ nguyên hoặc được ánh xạ để máy chủ báo trạng thái đã tắt, còn các mục khác vẫn giữ hành vi được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

The docs list enabled as the way to turn a server off without deleting it ("You can also disable a server by setting enabled to false"), and both option tables carry enabled | Boolean | "Enable or disable the MCP server on startup". The key is dropped during config parsing, while startup gates on disabled, which the docs never mention. So "enabled": false is inert and the server connects.

// opencode.json
{
  "mcp": { "servers": {
    "a-enabled-only":  { "type": "remote", "url": "http://127.0.0.1:1/mcp", "enabled": false },
    "b-disabled-only": { "type": "remote", "url": "http://127.0.0.1:2/mcp", "disabled": true },
    "c-both":          { "type": "remote", "url": "http://127.0.0.1:3/mcp", "enabled": false, "disabled": true },
    "d-plain":         { "type": "remote", "url": "http://127.0.0.1:4/mcp" }
  } }
}

opencode --standalone debug config prints a-enabled-only with no enabled key at all, and keeps disabled: true on the other two.

Plugins

none

OpenCode version

2.2.5

Steps to reproduce
  1. Write the config above into opencode.json in an empty directory.
  2. opencode --standalone debug config — enabled is gone from a-enabled-only.
  3. opencode serve --hostname 127.0.0.1 --port 49399 with OPENCODE_PASSWORD set, then curl -u "opencode:$OPENCODE_PASSWORD" http://127.0.0.1:49399/api/mcp.
entry in config status from /api/mcp
"enabled": false failed — it tried to connect
"disabled": true disabled
both keys disabled
neither key failed — it tried to connect

Expected: enabled: false behaves like disabled: true.

The published config schema carries enabled with the description "Enable or disable the MCP server on startup", while the MCP layer's config classes declare disabled and its startup loop tests config.disabled. Nothing maps one to the other, so the documented key does nothing and the undocumented one is the only lever. Not a duplicate of #55419, which covers invalid entries being dropped.

Operating System

Ubuntu 24.04 (container)

Terminal

xterm-256color

Ngôn ngữ chính
TypeScript
Star
224k
Fork
30k
Merge trung bình
5 giờ 25 phút
Pull request đã merge (30 ngày)
494

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode

Tất cả issue của anomalyco/opencode

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.