mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-15 10:14:51 +00:00
fix(mcp): unified grant revocation with per-agent tool group isolation
- Add GrantChecker interface with cache + event-bus invalidation for revalidating MCP tool grants at execution time (not just dispatch) - Move toolGroups from package-level global to per-Registry field; Clone() gives each agent Loop isolated tool groups, eliminating cross-agent race condition - BridgeTool.Execute rechecks grant validity before executing MCP methods; uses serverID field for cache key - Wire MCPGrantChecker through ResolverDeps to MCP Manager and LoopConfig - Add integration test for grant revocation scenarios - Update policy functions to accept *Registry parameter
This commit is contained in:
1 parent
8618ed94b2
commit
8b8da3a3dd
20 files changed
+1128
-150
No files matched your search
@@ -127,8 +127,10 @@ func wireExtras(
|
||||
|
||||
// 5. Shared MCP connection pool (eliminates duplicate connections across agents)
|
||||
var mcpPool *mcpbridge.Pool
|
||||
var mcpGrantChecker mcpbridge.GrantChecker
|
||||
if stores.MCP != nil {
|
||||
mcpPool = mcpbridge.NewPool(mcpbridge.DefaultPoolConfig())
|
||||
mcpGrantChecker = mcpbridge.NewStoreGrantChecker(stores.MCP, msgBus)
|
||||
}
|
||||
|
||||
// 6. Set up agent resolver: lazy-creates Loops from DB
|
||||
@@ -221,6 +223,7 @@ func wireExtras(
|
||||
BuiltinToolStore: stores.BuiltinTools,
|
||||
MCPStore: stores.MCP,
|
||||
MCPPool: mcpPool,
|
||||
MCPGrantChecker: mcpGrantChecker,
|
||||
ConfigPermStore: stores.ConfigPermissions,
|
||||
MediaStore: mediaStore,
|
||||
ModelPricing: appCfg.Telemetry.ModelPricing,
|
||||
|
||||
Reference in new issue
Block a user