Skip to main content
Glama
StrawHatAI

Claude Desktop Commander MCP

by StrawHatAI

block_command

Prevent specific terminal commands from executing by adding them to a blacklist for controlled command management.

Instructions

Add a command to the blacklist. Once blocked, the command cannot be executed until unblocked.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes

Implementation Reference

  • Core implementation of the block_command tool. Adds the command to the blockedCommands Set (after normalizing to lowercase), saves to config file, returns true if newly blocked.
    async blockCommand(command: string): Promise<boolean> {
      command = command.toLowerCase().trim();
      if (this.blockedCommands.has(command)) {
        return false;
      }
      this.blockedCommands.add(command);
      await this.saveBlockedCommands();
      return true;
    }
  • MCP server handler for block_command tool call. Parses input args and invokes commandManager.blockCommand.
    case "block_command": {
      const parsed = BlockCommandArgsSchema.parse(args);
      const blockResult = await commandManager.blockCommand(parsed.command);
      return {
        content: [{ type: "text", text: blockResult }],
      };
    }
  • src/server.ts:102-107 (registration)
    Registers the block_command tool in the MCP server's tool list with description and input schema.
    {
      name: "block_command",
      description:
        "Add a command to the blacklist. Once blocked, the command cannot be executed until unblocked.",
      inputSchema: zodToJsonSchema(BlockCommandArgsSchema),
    },
  • Zod schema for validating block_command input: requires a 'command' string.
    export const BlockCommandArgsSchema = z.object({
      command: z.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/StrawHatAI/claude-dev-tools'

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