cMCP 0.4.1
Model Context Protocol library in pure C11
Loading...
Searching...
No Matches
Data Structures | Functions
cmcp_transport.h File Reference

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)
 

Detailed Description

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:

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.

Function Documentation

◆ cmcp_transport_stdio_new()

cmcp_transport_t * cmcp_transport_stdio_new ( void  )

◆ cmcp_transport_stdio_new_fds()

cmcp_transport_t * cmcp_transport_stdio_new_fds ( int  read_fd,
int  write_fd 
)

◆ cmcp_transport_http_listen()

cmcp_transport_t * cmcp_transport_http_listen ( const char *  host,
unsigned short  port 
)

◆ cmcp_transport_http_connect()

cmcp_transport_t * cmcp_transport_http_connect ( const char *  url)