INNER CODE UNIT · JavaScript

getServerConfig

bvisible/mcp-ssh-manager · src/index.js:267

async function getServerConfig(serverName) {
  if (!serverName) return null;
  const servers = await loadServerConfig();
  return servers[String(serverName).toLowerCase()] || null;
}

// Apply policy + audit a denial in one shot. Returns null when allowed; returns
// an MCP error response object when denied (handler should `return` it directly).
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({

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…