Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mcp_server.h File Reference

Model Context Protocol (MCP) Server API. More...

#include <zephyr/kernel.h>
#include <errno.h>

Go to the source code of this file.

Data Structures

 Tool metadata structure. More...
struct  mcp_tool_record
 Tool definition structure. More...
struct  mcp_tool_message
 Message sent from a tool (response/notification). More...

Typedefs

typedef void * mcp_server_ctx_t
 Server context handle.
typedef int(* mcp_tool_callback_t) (enum mcp_tool_event_type event, const char *arguments, const char *execution_token)
 Tool callback function.

Enumerations

enum  mcp_tool_msg_type { MCP_USR_TOOL_RESPONSE , MCP_USR_TOOL_NOTIFICATION , MCP_USR_TOOL_CANCEL_ACK , MCP_USR_TOOL_PING }
 MCP Tool message type. More...
enum  mcp_tool_event_type { MCP_TOOL_CALL_REQUEST , MCP_TOOL_CANCEL_REQUEST }
 MCP Tool event type. More...

Functions

mcp_server_ctx_t mcp_server_init (void)
 Initialize the MCP Server.
int mcp_server_start (mcp_server_ctx_t server_ctx)
 Start the MCP Server.
int mcp_server_submit_tool_message (mcp_server_ctx_t server_ctx, const struct mcp_tool_message *user_msg, const char *execution_token)
 Submit a message from a tool (response/notification).
int mcp_server_add_tool (mcp_server_ctx_t server_ctx, const struct mcp_tool_record *tool_record)
 Add a tool to the server.
int mcp_server_remove_tool (mcp_server_ctx_t server_ctx, const char *tool_name)
 Remove a tool from the server.
int mcp_server_is_execution_canceled (mcp_server_ctx_t server_ctx, const char *execution_token, bool *is_canceled)
 Helper for checking the execution state of a tool.

Detailed Description

Model Context Protocol (MCP) Server API.