upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/main/mcp_handler.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-17 05:27:06 +0530
committerYour Name <you@example.com>2026-05-17 05:27:06 +0530
commitfdf662f8f1a1a3b38fe4d251982fffab8e9bf664 (patch)
tree2413bdc936b757adf4849a522b7df2a5c8eb0aec /main/mcp_handler.h
parentedd125d0e3fe5fe7c0edf30c429723f3b0120c68 (diff)
Phase 7: MCP handler (25 tests), NIP-04 encrypt/decrypt (15 tests), CVM server skeleton
- mcp_handler.c/h: 4 tools (get_config, set_config, get_balance, wallet_send) - nip04.c/h: AES-256-CBC + ECDH with 0x02 compressed pubkey prefix - Fixed IV copy bug: mbedTLS AES-CBC modifies IV in-place - Base64 encode/decode for ciphertext transport - PKCS7 padding - cvm_server.c/h: Nostr DM listener with FreeRTOS task - config: cvm_enabled, cvm_relays fields - 156 total tests passing across 10 test binaries
Diffstat (limited to 'main/mcp_handler.h')
-rw-r--r--main/mcp_handler.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/main/mcp_handler.h b/main/mcp_handler.h
new file mode 100644
index 0000000..e42b5ee
--- /dev/null
+++ b/main/mcp_handler.h
@@ -0,0 +1,36 @@
1#ifndef MCP_HANDLER_H
2#define MCP_HANDLER_H
3
4#include <stdint.h>
5#include <stdbool.h>
6
7typedef enum {
8 MCP_TOOL_GET_CONFIG = 0,
9 MCP_TOOL_SET_CONFIG = 1,
10 MCP_TOOL_GET_BALANCE = 2,
11 MCP_TOOL_WALLET_SEND = 3,
12 MCP_TOOL_UNKNOWN = 99
13} mcp_tool_t;
14
15typedef struct {
16 mcp_tool_t tool;
17 char method[64];
18 char params_json[1024];
19} mcp_request_t;
20
21typedef struct {
22 bool success;
23 char result_json[2048];
24 char error[256];
25} mcp_response_t;
26
27mcp_tool_t mcp_parse_tool(const char *method);
28
29mcp_response_t mcp_handle_get_config(void);
30mcp_response_t mcp_handle_set_config(const char *params_json);
31mcp_response_t mcp_handle_get_balance(void);
32mcp_response_t mcp_handle_wallet_send(const char *params_json);
33
34mcp_response_t mcp_dispatch(const mcp_request_t *req);
35
36#endif