Merged
feat(mcp): mcp support macos #350
feat(mcp): mcp support macos #350
Merged
zhuyutong888Add on 29 days ago
zhuyutong888Collaborators
29 days ago

Paired: GitHub #146 ↔ GitCode !350

What type of PR is this?

/kind

Self-checklist:(请自检,在[ ]内打上x,我们将检视你的完成情况,否则会导致pr无法合入)

Linked Closing Issues:
https://gitcode.com/openJiuwen/agent-protocol/issues/33

Linked Closing Issues:

likedislike
Pull Request has been successfully merged by openJiuwen-bot.
(Thank you for zhuyutong888's contribution.)
Zzhuyutong888Collaborators
29 days ago Associated issue: [Feature] 增加 macOS 平台构建支持与 CI 覆盖,补齐跨平台能力短板
atomgit-bot
atomgit-bot
29 days ago Comments:

变更摘要

本 PR 为 MCP C++ SDK 增加 macOS 平台支持,核心思路是新增平台兼容层 platform_compat.h,将原先依赖 Linux 专有的线程 ID 获取、TCP keepalive 选项、线程命名及事件通知机制统一封装为跨平台接口。事件系统 EventSystem 改用抽象的通知通道 NotifyChannel(Linux 走 eventfd,macOS 走非阻塞 pipe 加软件计数器),并相应调整通知事件 ID 的记录与读取逻辑;构建、依赖安装与示例脚本也补充了 macOS 分支(sysctl、brew、dylib)。整体属于平台适配重构,不改变对外业务流程。

主要改动

  • 新增平台兼容层 platform_compat.h: 提供 GetThreadId、SetCurrentThreadName、SetKeepAliveIdle/Intvl/Cnt 及通知通道 NotifyChannel 的 CreateNotifyChannel/NotifyChannelNotify/NotifyChannelRead/CloseNotifyChannel 等跨平台封装,按 __linux__、__APPLE__ 分支给出不同实现。
  • 事件通知机制抽象化: EventSystem 移除 <sys/eventfd.h>、<fcntl.h> 的直接依赖,CreateNotifyEventId、NotifyEventId、ReadEventFd、RemoveEventInternal 及析构逻辑改为通过 notifyChannel 与平台封装完成创建、写入、读取和关闭,EventData 新增 notifyChannel 字段。
  • ServerManager 通知参数与重触发修正: NotifyEventArg 新增并初始化 eventId 字段,Start 中保存 eventId,HandleQueueNotification 由原先以 fd 调用 NotifyEventId 改为传入 notifyEventArg->eventId。
  • 日志与网络代码迁移到兼容层: mcp_log.h 用 McpGetCurrentThreadId() 替换 syscall(SYS_gettid),tcp_socket.cpp 的 keepalive 设置改用 Platform::SetKeepAliveIdle/Intvl/Cnt,thread_utils.h 的线程命名委托给 Platform::SetCurrentThreadName。
  • 构建与依赖脚本适配 macOS: ExampleCommon.cmake 改用 CMAKE_SHARED_LIBRARY_SUFFIX 并设置 BUILD_RPATH,build.sh 在无 nproc 时回退 sysctl -n hw.ncpu,install_deps.sh 增加 macOS/Homebrew 依赖检查与安装分支,run_auth_example.sh 按 uname 选择 dylib/so 扩展名。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
29 days ago Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
OopenJiuwen-botCollaborators
29 days ago Set YiyangShao,xinyu-jiuwen as approver
atomgit-bot
atomgit-bot
29 days ago Comments:

AtomGit AI 助手使用指南

在 PR 评论中使用命令即可触发。支持在普通评论和代码行评论中使用。

功能 命令 说明
代码审查 /ai review 检查代码质量、潜在问题、安全风险
PR 摘要 /ai summary 生成 PR 变更内容的结构化摘要
代码解释 /ai explain 解释代码变更的逻辑和意图
自由提问 @atomgit-bot <问题> 询问关于本 PR 的任何问题
帮助 /ai help 显示此帮助信息

免责声明

AI 助手可能存在误判,请结合自身判断。可以对评论点 👍 或 👎 帮助我们改进。

likedislike
Incorrect?
84 messages are collapsed here。 See more
maoqiming
maoqimingCollaborators
20 days ago Comments:

/lgtm
/approve

likedislike
OopenJiuwen-botCollaborators
20 days ago Added label: approvedlgtm-mingo007
openJiuwen-botCollaborators
20 days ago Comments:

Review Code Feedback

  • The label lgtm-mingo007, approved was added to this pull request. It means that mingo007 reviewed the code changes. 👋
Tips
  • If this pull request is not merged while all conditions are met, comment /check-pr to try again. 😄
likedislike
OopenJiuwen-botCollaborators
20 days ago Merged pull request
OopenJiuwen-botCollaborators
20 days ago Removed label: ci-successful