MCP: bloquear escritura de records por accessList del usuario

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jordan Diaz
2026-04-06 21:52:13 +00:00
parent 5bfcee6918
commit 38ac9cecdc
4 changed files with 59 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import { handleToolError, validateRequired, handleApiResponse } from "../helpers
import { AcaiHttpClient } from "../helpers/acaiHttpClient.js";
import { table } from "console";
import { withAuthParams } from "../helpers/authSchema.js";
import { canAccessTable } from "../helpers/accessControl.js";
export function registerCreateOrUpdateRecordTool(server) {
server.tool(
@@ -26,6 +27,12 @@ export function registerCreateOrUpdateRecordTool(server) {
const validationError = validateRequired({ tableName, fields }, ['tableName', 'fields'], 'create_or_update_record');
if (validationError) return validationError;
// Check table access
const accessCheck = canAccessTable(tableName);
if (!accessCheck.allowed) {
return { content: [{ type: "text", text: JSON.stringify({ success: false, error: accessCheck.error }) }], isError: true };
}
// if fields is string, try to parse as JSON
if (typeof fields === 'string') {
try {