Skip to main content
Glama
cfdude

Mac Shell MCP Server

add_to_whitelist

Add macOS terminal commands to a security whitelist for controlled execution through Claude or Roo Code, specifying security levels to manage command permissions.

Instructions

Add a command to the whitelist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesThe command to whitelist
securityLevelYesSecurity level for the command
descriptionNoDescription of the command

Implementation Reference

  • The primary handler for the 'add_to_whitelist' MCP tool. Validates input parameters using Zod, maps the security level string to the CommandSecurityLevel enum, delegates to CommandService.addToWhitelist, and returns a formatted success response.
    private async handleAddToWhitelist(args: unknown) {
      const schema = z.object({
        command: z.string(),
        securityLevel: z.enum(['safe', 'requires_approval', 'forbidden']),
        description: z.string().optional(),
      });
    
      const { command, securityLevel, description } = schema.parse(args);
    
      // Map string security level to enum
      const securityLevelEnum =
        securityLevel === 'safe'
          ? CommandSecurityLevel.SAFE
          : securityLevel === 'requires_approval'
            ? CommandSecurityLevel.REQUIRES_APPROVAL
            : CommandSecurityLevel.FORBIDDEN;
    
      this.commandService.addToWhitelist({
        command,
        securityLevel: securityLevelEnum,
        description,
      });
    
      return {
        content: [
          {
            type: 'text',
            text: `Command '${command}' added to whitelist with security level '${securityLevel}'`,
          },
        ],
      };
    }
  • src/index.ts:120-141 (registration)
    The tool registration entry in the ListTools response, defining the tool name, description, and JSON input schema for validation.
      name: 'add_to_whitelist',
      description: 'Add a command to the whitelist',
      inputSchema: {
        type: 'object',
        properties: {
          command: {
            type: 'string',
            description: 'The command to whitelist',
          },
          securityLevel: {
            type: 'string',
            enum: ['safe', 'requires_approval', 'forbidden'],
            description: 'Security level for the command',
          },
          description: {
            type: 'string',
            description: 'Description of the command',
          },
        },
        required: ['command', 'securityLevel'],
      },
    },
  • TypeScript interface defining the structure of a whitelist entry, used as input to addToWhitelist.
    export interface CommandWhitelistEntry {
      /** The command path or name */
      command: string;
      /** Security level of the command */
      securityLevel: CommandSecurityLevel;
      /** Allowed arguments (string for exact match, RegExp for pattern match) */
      allowedArgs?: Array<string | RegExp>;
      /** Description of the command for documentation */
      description?: string;
    }
  • The core utility method in CommandService that stores the new whitelist entry in the internal Map.
    public addToWhitelist(entry: CommandWhitelistEntry): void {
      this.whitelist.set(entry.command, entry);
    }
  • Enum defining possible security levels for whitelisted commands, used throughout the implementation.
    export enum CommandSecurityLevel {
      /** Safe commands that can be executed without approval */
      SAFE = 'safe',
      /** Commands that require approval before execution */
      REQUIRES_APPROVAL = 'requires_approval',
      /** Commands that are explicitly forbidden */
      FORBIDDEN = 'forbidden',
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Add') but doesn't explain what happens upon invocation—e.g., whether it's a mutation, requires permissions, has side effects like notifications, or returns confirmation. This leaves significant gaps for a tool that modifies a security list.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste—it directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of modifying a security whitelist, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like mutation effects, error conditions, or return values, which are crucial for safe tool invocation in this context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters (command, securityLevel, description) with details like enum values for securityLevel. The description adds no additional meaning beyond the schema, resulting in the baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Add') and resource ('command to the whitelist'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'update_security_level' or 'remove_from_whitelist', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives like 'update_security_level' or 'approve_command'. The description lacks context about prerequisites, such as whether the command must be pending or already exist, leaving usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cfdude/mac-shell-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server