MCP SDK Design¶
Finding the SDK¶
If you have installed the MBASE SDK, you can find the library
using CMake find_package
function with components specification.
In order to find the library using cmake, write the following:
find_package(mbase.libs REQUIRED COMPONENTS mcp)
Specify the include path and link the libraries:
target_include_directories(<your_target> PUBLIC mbase-mcp)
target_link_libraries(<your_target> PRIVATE mbase-mcp)
File Hierarchy¶
All header files are prefixed with mbase/mcp
in the MCP SDK. Below are the MCP SDK headers:
Note
All headers include mcp_common.h
by default.
File |
Remarks |
Used By |
Includes |
---|---|---|---|
mcp_client_arguments.h |
Contains the STDIO and HTTP init object which are used to initialize the respective clients.It also contains the feature argument typedefs for calling features with arguments. |
Client |
|
mcp_client_base.h |
Contains the fundamental |
Client |
|
mcp_client_callbacks.h |
Client feature callback signatures are defined in this file. |
Client |
|
mcp_client_server_http.h |
Contains the |
Client |
|
mcp_client_server_stdio.h |
Contains the |
Client |
|
mcp_common.h |
Contains error code macros, includes frequently used data structures such as unordered_map, vector etc. |
Client/Server |
|
mcp_notifications.h |
Defines notification objects |
Client/Server |
|
mcp_packet_parsing.h |
MCP parsing procedures. They can be used to build and parse an MCP packet. |
Client/Server |
|
mcp_server_arguments.h |
Defines |
Server |
|
mcp_server_base.h |
Contains the fundamental |
Server |
|
mcp_server_client_http_streamable.h |
Defines the |
Server |
|
mcp_server_client_state.h |
Defines the |
Server |
|
mcp_server_client_stdio.h |
Defines the |
Server |
|
mcp_server_descriptions.h |
Contains the description objects such as |
Client/Server |
|
mcp_server_features.h |
Contains the feature objects and feature callback signatures. |
Server |
|
mcp_server_http_streamable.h |
Contains both the |
Server |
|
mcp_server_responses.h |
Defines the feature response objects and expose them as variant object such as |
Client/Server |
|
mcp_server_stdio.h |
Contains the |
Server |
|
mcp_server_to_client_requests.h |
Defines callbacks signatures and request objects for server to client roots/sampling requests. The objects defined under this file is used by both client and the server. |
Client/Server |
Object Hierarchy¶

Error Codes¶
Given error codes are declared under the mcp_common.h
file:
Macro |
Code |
---|---|
MBASE_MCP_SUCCESS |
0 |
MBASE_MCP_PARSE_ERROR |
-32700 |
MBASE_MCP_INVALID_REQUEST |
-32600 |
MBASE_MCP_METHOD_NOT_FOUND |
-32601 |
MBASE_MCP_INVALID_PARAMS |
-32602 |
MBASE_MCP_INTERNAL_ERROR |
-32603 |
MBASE_MCP_TIMEOUT |
-32001 |
MBASE_MCP_RESOURCE_NOT_FOUND |
-32002 |
Macros¶
Given macros are declared under the mcp_common.h
file:
Macro |
Value |
Description |
---|---|---|
MBASE_MCP_TIMEOUT_DEFAULT |
10 |
Default request timeout in seconds. Applies to both client and server. |
MBASE_MCP_STDIO_BUFFER_LENGTH |
65536 |
Default STDIO read/write buffer length. Applies to both client and server. |