INNER CODE UNIT · JavaScript
applyServerPolicy
bvisible/mcp-ssh-manager · src/index.js:275
async function applyServerPolicy(serverName, toolName, args, command) {
const serverConfig = await getServerConfig(serverName);
const policy = evaluatePolicy(serverConfig, toolName, command);
if (!policy.allowed) {
auditLog(serverConfig, toolName, args, policy);
return {
content: [
{
type: 'text',
text: formatJSONResponse({
server: serverName,
tool: toolName,
success: false,
error: `Policy denied: ${policy.reason}`,
code: -2,
}),
},
],