|
cMCP 0.4.1
Model Context Protocol library in pure C11
|
Transport vtable + stdio/HTTP constructors. More...
#include <stddef.h>Go to the source code of this file.
Data Structures | |
| struct | cmcp_transport_t |
Functions | |
| cmcp_transport_t * | cmcp_transport_stdio_new (void) |
| cmcp_transport_t * | cmcp_transport_stdio_new_fds (int read_fd, int write_fd) |
| cmcp_transport_t * | cmcp_transport_http_listen (const char *host, unsigned short port) |
| cmcp_transport_t * | cmcp_transport_http_connect (const char *url) |
Transport vtable + stdio/HTTP constructors.
Plugin layer: a cmcp_transport_t is a (read, write, close, optional wake) vtable plus a void* context. cMCP ships three backends:
cmcp_transport_stdio_new / _new_fds): newline- delimited JSON over stdin/stdout (or any pre-opened fd pair).cmcp_transport_http_listen): Streamable HTTP hand-rolled on top of socket() / accept().cmcp_transport_http_connect): Streamable HTTP via libcurl with a background SSE reader thread.Servers and clients borrow a transport; the caller still closes it. The transport layer is intentionally message-agnostic, with one principled exception in the HTTP backend (which has to peek at the JSON-RPC body to distinguish requests-needing-a-response from notifications-getting-202-Accepted).
Definition in file cmcp_transport.h.
| cmcp_transport_t * cmcp_transport_stdio_new | ( | void | ) |
| cmcp_transport_t * cmcp_transport_stdio_new_fds | ( | int | read_fd, |
| int | write_fd | ||
| ) |
| cmcp_transport_t * cmcp_transport_http_listen | ( | const char * | host, |
| unsigned short | port | ||
| ) |
| cmcp_transport_t * cmcp_transport_http_connect | ( | const char * | url | ) |