Skip to main content
Glama
cfdude

Super Shell MCP Server

get_platform_info

Retrieve current platform and shell details to enable secure cross-platform command execution with built-in security controls.

Instructions

Get information about the current platform and shell

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'get_platform_info' tool. It dynamically imports platform utilities, gathers platform, shell, and configuration information, and returns it as a formatted JSON response.
    private async handleGetPlatformInfo() {
      const { detectPlatform, getShellSuggestions, getCommonShellLocations } = await import('./utils/platform-utils.js');
      
      const platform = detectPlatform();
      const currentShell = this.commandService.getShell();
      const shellExecutionEnabled = this.commandService.isShellEnabled();
      const suggestedShells = getShellSuggestions()[platform];
      const commonLocations = getCommonShellLocations();
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              platform,
              currentShell,
              shellExecutionEnabled,
              suggestedShells,
              commonLocations,
              helpMessage: shellExecutionEnabled
                ? `Super Shell MCP is running on ${platform} using ${currentShell} with shell parsing enabled.`
                : `Super Shell MCP is running on ${platform} executing commands without shell parsing.`,
            }, null, 2),
          },
        ],
      };
    }
  • src/index.ts:142-148 (registration)
    Registers the 'get_platform_info' tool in the MCP server's tool list, including its name, description, and input schema (empty object).
      name: 'get_platform_info',
      description: 'Get information about the current platform and shell',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Defines the input schema for the 'get_platform_info' tool as an empty object (no parameters required).
    inputSchema: {
      type: 'object',
      properties: {},
    },
  • Utility function to detect the current platform (WINDOWS, MACOS, LINUX, or UNKNOWN) based on process.platform.
    export function detectPlatform(): PlatformType {
      const platform = process.platform;
      
      if (platform === 'win32') return PlatformType.WINDOWS;
      if (platform === 'darwin') return PlatformType.MACOS;
      if (platform === 'linux') return PlatformType.LINUX;
      
      return PlatformType.UNKNOWN;
    }
  • Utility function providing suggested shell executables for each supported platform.
    export function getShellSuggestions(): Record<PlatformType, string[]> {
      return {
        [PlatformType.WINDOWS]: ['cmd.exe', 'powershell.exe', 'pwsh.exe'],
        [PlatformType.MACOS]: ['/bin/zsh', '/bin/bash', '/bin/sh'],
        [PlatformType.LINUX]: ['/bin/bash', '/bin/sh', '/bin/zsh'],
        [PlatformType.UNKNOWN]: ['/bin/sh']
      };
    }
  • Utility function returning common file paths where shell executables are typically located on the current platform.
    export function getCommonShellLocations(): string[] {
      const platform = detectPlatform();
      
      switch (platform) {
        case PlatformType.WINDOWS:
          return [
            process.env.COMSPEC || 'C:\\Windows\\System32\\cmd.exe',
            'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe',
            'C:\\Program Files\\PowerShell\\7\\pwsh.exe'
          ];
        case PlatformType.MACOS:
          return ['/bin/zsh', '/bin/bash', '/bin/sh'];
        case PlatformType.LINUX:
          return ['/bin/bash', '/bin/sh', '/usr/bin/bash', '/usr/bin/zsh'];
        default:
          return ['/bin/sh'];
      }
    }

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