master
h 29 lines 952 Bytes
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef NETDATA_MCP_AUTH_H
4 #define NETDATA_MCP_AUTH_H
5
6 #include "daemon/common.h"
7
8 #define NETDATA_MCP_DEV_PREVIEW_API_KEY 1
9
10 #ifdef NETDATA_MCP_DEV_PREVIEW_API_KEY
11
12 #define MCP_DEV_PREVIEW_API_KEY_FILENAME "mcp_dev_preview_api_key"
13 #define MCP_DEV_PREVIEW_API_KEY_LENGTH 36 // UUID format: 8-4-4-4-12 = 32 hex chars + 4 hyphens
14
15 // Initialize the MCP API key subsystem - creates key file if it doesn't exist
16 void mcp_api_key_initialize(void);
17
18 // Verify if the provided API key matches the stored one
19 // Returns true if valid and agent is claimed, false otherwise
20 // silent: if true, suppresses error logging (for speculative checks)
21 bool mcp_api_key_verify(const char *api_key, bool silent);
22
23 // Get the current API key (for display purposes)
24 // Returns a static buffer that should not be freed
25 const char *mcp_api_key_get(void);
26
27 #endif // NETDATA_MCP_DEV_PREVIEW_API_KEY
28
29 #endif // NETDATA_MCP_AUTH_H