cMCP/test.c

17 lines
687 B
C

#include <stdio.h>
#include <string.h>
#include "http.h"
int main()
{
HTTP_Headers h = http_new_headers();
http_add_header(&h, "User-Agent", "libmcp:0.1.0");
http_add_header(&h, "Accept", "application/json, text/event-stream");
http_add_header(&h, "Content-Type", "application/json");
char *body = "{\"jsonrpc\": \"2.0\",\"id\": 1,\"method\": \"initialize\",\"params\": {\"protocolVersion\": \"2025-03-26\",\"capabilities\": {\"roots\": {\"listChanged\": true},\"sampling\": {}},\"clientInfo\": {\"name\": \"ExampleClient\",\"version\": \"1.0.0\"}}}";
size_t body_size = strlen(body);
http_request("http://localhost:8080/mcp", "POST", body, body_size, &h);
return 0;
}