Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
mcp_key_set.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
24#pragma once
25
27
28#include <mutex>
29#include <string>
30#include <unordered_map>
31#include <vector>
32
33namespace entropic {
34
44class MCPKeySet {
45public:
55 void grant(const std::string& pattern, MCPAccessLevel level);
56
63 bool revoke(const std::string& pattern);
64
80 bool has_access(const std::string& tool_name,
81 MCPAccessLevel required) const;
82
88 std::vector<MCPKey> list() const;
89
95 size_t size() const;
96
101 void clear();
102
108 std::string serialize() const;
109
119 bool deserialize(const std::string& json);
120
121private:
123 std::unordered_map<std::string, MCPAccessLevel> keys_;
124
126 mutable std::mutex key_mutex_;
127
135 static std::string server_wildcard(const std::string& tool_name);
136
144 MCPAccessLevel find_best_match(const std::string& tool_name) const;
145};
146
147} // namespace entropic
Per-identity set of authorized MCP tool keys.
Definition mcp_key_set.h:44
bool has_access(const std::string &tool_name, MCPAccessLevel required) const
Check if a specific tool is authorized at the required level.
void clear()
Remove all granted keys.
bool revoke(const std::string &pattern)
Revoke a tool key entirely.
bool deserialize(const std::string &json)
Deserialize key set from JSON string.
std::string serialize() const
Serialize key set to JSON string.
std::vector< MCPKey > list() const
List all granted keys.
size_t size() const
Number of granted keys.
void grant(const std::string &pattern, MCPAccessLevel level)
Grant a tool key with an access level.
Configuration structs with defaults.
Activate model on GPU (WARM → ACTIVE).
MCPAccessLevel
MCP tool access level for per-identity authorization.
Definition config.h:38