Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
mcp_authorization.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
25#pragma once
26
29
30#include <mutex>
31#include <string>
32#include <unordered_map>
33#include <vector>
34
35namespace entropic {
36
42public:
50 void register_identity(const std::string& identity_name);
51
58 bool is_enforced(const std::string& identity_name) const;
59
69 entropic_error_t grant(const std::string& identity_name,
70 const std::string& pattern,
71 MCPAccessLevel level);
72
81 entropic_error_t revoke(const std::string& identity_name,
82 const std::string& pattern);
83
92 bool check_access(const std::string& identity_name,
93 const std::string& tool_name,
94 MCPAccessLevel required_level) const;
95
107 entropic_error_t grant_from(const std::string& granter_name,
108 const std::string& grantee_name,
109 const std::string& pattern,
110 MCPAccessLevel level);
111
118 std::vector<MCPKey> list_keys(
119 const std::string& identity_name) const;
120
126 std::string serialize_all() const;
127
134 bool deserialize_all(const std::string& json);
135
141 void unregister_identity(const std::string& identity_name);
142
143private:
145 std::unordered_map<std::string, MCPKeySet> key_sets_;
146
148 mutable std::mutex auth_mutex_;
149};
150
151} // namespace entropic
Per-identity MCP authorization with runtime grant/revoke.
entropic_error_t grant(const std::string &identity_name, const std::string &pattern, MCPAccessLevel level)
Grant a tool key to an identity.
void register_identity(const std::string &identity_name)
Register an empty key set for an identity.
void unregister_identity(const std::string &identity_name)
Remove an identity's key set (disables enforcement).
bool deserialize_all(const std::string &json)
Deserialize all identity key sets from JSON.
bool is_enforced(const std::string &identity_name) const
Check if an identity has authorization enforcement enabled.
entropic_error_t revoke(const std::string &identity_name, const std::string &pattern)
Revoke a tool key from an identity.
std::string serialize_all() const
Serialize all identity key sets to JSON.
std::vector< MCPKey > list_keys(const std::string &identity_name) const
List all keys for an identity.
entropic_error_t grant_from(const std::string &granter_name, const std::string &grantee_name, const std::string &pattern, MCPAccessLevel level)
One identity grants a key to another identity.
bool check_access(const std::string &identity_name, const std::string &tool_name, MCPAccessLevel required_level) const
Check if a tool call is authorized for an identity.
Error types for cross-.so error reporting.
entropic_error_t
Error codes returned by all C API functions.
Definition error.h:35
Per-identity set of authorized MCP tool keys.
Activate model on GPU (WARM → ACTIVE).
MCPAccessLevel
MCP tool access level for per-identity authorization.
Definition config.h:38