Skip to main content
Glama
cfdude

Super Shell MCP Server

add_to_whitelist

Add shell commands to a security whitelist with designated safety levels to control execution permissions across Windows, macOS, and Linux systems.

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 function for the 'add_to_whitelist' tool. It validates the input arguments using Zod, converts the security level string to the appropriate enum value, calls the CommandService's addToWhitelist method, and returns a success response.
    private async handleAddToWhitelist(args: any) {
      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}'`,
          },
        ],
      };
    }
  • The input schema definition for the 'add_to_whitelist' tool, registered in the ListTools handler. Defines the expected parameters, types, descriptions, and required fields for MCP tool invocation.
    {
      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'],
      },
    },
  • src/index.ts:289-290 (registration)
    The switch case in the CallToolRequestSchema handler that registers and routes calls to the 'add_to_whitelist' handler function.
    case 'add_to_whitelist':
      return await this.handleAddToWhitelist(args);
  • The supporting method in CommandService that adds a command entry to the internal whitelist Map.
    public addToWhitelist(entry: CommandWhitelistEntry): void {
      this.whitelist.set(entry.command, entry);
    }
  • TypeScript interface defining the structure of a CommandWhitelistEntry used by the addToWhitelist method.
    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;
    }

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/super-shell-mcp'

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