Skip to main content
Glama
gunjanjp

Linux Bash MCP Server

by gunjanjp

get_system_info

Retrieve detailed system information for WSL2 Linux environments by executing commands through a Linux Bash MCP Server, facilitating efficient system diagnostics and management.

Instructions

Get system information about the WSL2 Linux environment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'get_system_info' tool. It runs a series of Linux commands (uname -a, /etc/os-release, df -h, free -h, etc.) inside the WSL distribution to collect system information and returns it as a structured JSON response.
    async getSystemInfo() { if (!this.wslDistribution) { throw new Error("WSL distribution not configured"); } try { const commands = [ { cmd: "uname -a", desc: "System information" }, { cmd: "cat /etc/os-release", desc: "OS release information" }, { cmd: "whoami", desc: "Current user" }, { cmd: "pwd", desc: "Current directory" }, { cmd: "df -h", desc: "Disk usage" }, { cmd: "free -h", desc: "Memory usage" }, { cmd: "uptime", desc: "System uptime" }, { cmd: "cat /proc/version", desc: "Kernel version" } ]; const results = {}; for (const { cmd, desc } of commands) { try { const wslCommand = `wsl -d ${this.wslDistribution} -- ${cmd}`; const { stdout } = await execAsync(wslCommand); results[desc] = { command: cmd, output: stdout.trim() }; } catch (error) { results[desc] = { command: cmd, error: error.message }; } } return { content: [ { type: "text", text: JSON.stringify({ success: true, wslDistribution: this.wslDistribution, systemInfo: results, timestamp: new Date().toISOString() }, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify({ success: false, wslDistribution: this.wslDistribution, error: error.message, timestamp: new Date().toISOString() }, null, 2), }, ], }; } }
  • src/index.js:256-263 (registration)
    The tool registration entry returned by ListToolsRequestSchema handler, specifying the name, description, and input schema (empty object, no parameters required).
    { name: "get_system_info", description: "Get system information about the WSL2 Linux environment", inputSchema: { type: "object", properties: {}, }, },
  • The dispatch case in the CallToolRequestSchema handler that routes calls to the getSystemInfo() method.
    case "get_system_info": return await this.getSystemInfo();

Other Tools

Related 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/gunjanjp/linuxshell-mcp'

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