|
Entropic 2.3.8
Local-first agentic inference engine
|
Per-identity set of authorized MCP tool keys. More...
#include <entropic/mcp/mcp_key_set.h>
Public Member Functions | |
| void | grant (const std::string &pattern, MCPAccessLevel level) |
| Grant a tool key with an access level. | |
| bool | revoke (const std::string &pattern) |
| Revoke a tool key entirely. | |
| bool | has_access (const std::string &tool_name, MCPAccessLevel required) const |
| Check if a specific tool is authorized at the required level. | |
| std::vector< MCPKey > | list () const |
| List all granted keys. | |
| size_t | size () const |
| Number of granted keys. | |
| void | clear () |
| Remove all granted keys. | |
| std::string | serialize () const |
| Serialize key set to JSON string. | |
| bool | deserialize (const std::string &json) |
| Deserialize key set from JSON string. | |
Per-identity set of authorized MCP tool keys.
Manages a map of tool patterns to access levels. Pattern matching uses three-tier resolution (exact → server wildcard → full wildcard) with O(1) lookup per tier.
Definition at line 44 of file mcp_key_set.h.
| void entropic::MCPKeySet::clear | ( | ) |
| bool entropic::MCPKeySet::deserialize | ( | const std::string & | json | ) |
Deserialize key set from JSON string.
| json | JSON array string (same format as serialize output). |
Replaces all current keys with the deserialized set. Invalid entries are logged as WARNING and skipped.
| json | JSON array string. |
Definition at line 128 of file mcp_key_set.cpp.
| void entropic::MCPKeySet::grant | ( | const std::string & | pattern, |
| MCPAccessLevel | level | ||
| ) |
Grant a tool key with an access level.
| pattern | Tool pattern string. |
| level | Access level to grant. |
If the pattern already exists, the level is updated (not additive). Granting READ to a pattern that had WRITE downgrades it.
| pattern | Tool pattern string. |
| level | Access level to grant. |
Definition at line 24 of file mcp_key_set.cpp.
| bool entropic::MCPKeySet::has_access | ( | const std::string & | tool_name, |
| MCPAccessLevel | required | ||
| ) | const |
Check if a specific tool is authorized at the required level.
| tool_name | Fully-qualified tool name (e.g., "filesystem.read_file"). |
| required | Minimum access level needed. |
Resolution order (most specific wins):
Access level comparison: granted >= required means authorized.
| tool_name | Fully-qualified tool name. |
| required | Minimum access level needed. |
Definition at line 58 of file mcp_key_set.cpp.
| std::vector< MCPKey > entropic::MCPKeySet::list | ( | ) | const |
List all granted keys.
Definition at line 72 of file mcp_key_set.cpp.
| bool entropic::MCPKeySet::revoke | ( | const std::string & | pattern | ) |
Revoke a tool key entirely.
| pattern | Tool pattern string to revoke. |
| pattern | Tool pattern string to revoke. |
Definition at line 39 of file mcp_key_set.cpp.
| std::string entropic::MCPKeySet::serialize | ( | ) | const |
Serialize key set to JSON string.
Definition at line 109 of file mcp_key_set.cpp.
| size_t entropic::MCPKeySet::size | ( | ) | const |
Number of granted keys.
Definition at line 88 of file mcp_key_set.cpp.