# MCP Unit Tests This directory contains unit tests for the Model Context Protocol (MCP) implementation, based on the 2024-11-05 specification. ## Building and Running Tests ### Building Tests ```bash # Create a build directory in the project root mkdir -p build && cd build # Configure the project cmake .. # Build the project and tests make ``` ### Running Tests ```bash # Run all tests make run_tests # Or directly run the test executable ./test/mcp_tests ``` ### Running Specific Tests To run specific tests, you can use Google Test's filtering capability: ```bash # Run all message-related tests ./test/mcp_tests --gtest_filter=McpMessageTest.* # Run all tool-related tests ./test/mcp_tests --gtest_filter=McpToolTest.* # Run all resource-related tests ./test/mcp_tests --gtest_filter=McpResourceTest.* # Run all client-related tests ./test/mcp_tests --gtest_filter=ClientTest.* # Run all server-related tests ./test/mcp_tests --gtest_filter=ServerTest.* ``` ## Test Dependencies Tests use the Google Test framework, which is automatically downloaded and configured during the build process. ## Notes - Some tests require network functionality, ensure that local ports (such as 8090, 8095) are not in use - Client and server tests will start actual servers and clients for interaction testing - Resource tests will create files in a temporary directory, which will be automatically cleaned up after testing