-
Notifications
You must be signed in to change notification settings - Fork 2
Fix/mcp client fixes with cross-compile for macOS, Linux and Windows #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replaced std::string_view with std::string in trimView/trimString lambda and tryDecodeArgumentsString. Removed unused string_view and variant includes for C++14 compatibility.
Added missing #include <string> to mcp_c_raii.h and #include "mcp/json/json_serialization.h" to mcp_client.cc.
…ization (#142) Moved ListToolsResult definition before ResponseResult variant to allow it as a variant type. Added serialization and deserialization support for ListToolsResult in json_serialization.cc.
Added #include <unistd.h> for Linux/Unix and changed environ reference to ::environ to avoid namespace issues.
Added missing #include <cstdio> to mcp_c_memory_impl.cc.
Added socklen_t typedef for Windows in address.h since Winsock doesn't define it. Added winsock2.h and ws2tcpip.h includes to address_impl.h to avoid header conflicts on Windows.
Added platform-specific SOCKET_ERROR_AGAIN, SOCKET_ERROR_INPROGRESS, SOCKET_ERROR_WOULDBLOCK, SOCKET_ERROR_CONNREFUSED, SOCKET_ERROR_CONNRESET, SOCKET_ERROR_NOTCONN, and getLastSocketError() to io_handle.h. Removed duplicate definitions from io_socket_handle_impl.cc, socket_interface_impl.cc, and tcp_server_listener_impl.cc.
Added SO_ERROR check in onWriteReady() to verify connection actually succeeded for non-blocking connect. Used normalized SOCKET_ERROR_* constants in doConnect() for cross-platform error handling. Added debug logging for connection state transitions.
Added winsock2.h and ws2tcpip.h includes at top of mcp_c_bridge.h to avoid header conflicts. Added #ifndef _WIN32 guard around Unix domain socket handling since Windows doesn't support them.
Added Windows-specific includes (io.h, windows.h) and implementation for stdin reading using GetStdHandle, WaitForSingleObject, and ReadFile. Wrapped Unix poll/fcntl code in #ifndef _WIN32 guards.
Added Windows socket initialization (WSAStartup) to event_loop_example. Added Windows includes to tcp_ssl_http_example. Wrapped SIGPIPE signal handler in #ifndef _WIN32 guard in stdio_echo examples since SIGPIPE doesn't exist on Windows. Simplified connection wait in mcp_example_client.
Changed tests/CMakeLists.txt to use ${NGHTTP2_LIBRARIES} variable
instead of hardcoded "nghttp2" for cross-platform compatibility.
Added Windows build section to README.md with Cygwin/MinGW-w64 prerequisites and build commands.
❌ Code Formatting Check FailedSome files in this PR are not properly formatted according to the project's clang-format rules. To fix this issue: make formatThen commit and push the changes. |
caleb2h
approved these changes
Dec 31, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.