Skip to main content
Glama
gunjanjp

Linux Bash MCP Server

by gunjanjp

get_system_info

Retrieve system details from WSL2 Linux environments to monitor performance, check configurations, and troubleshoot issues through the Linux Bash MCP Server.

Instructions

Get system information about the WSL2 Linux environment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for 'get_system_info' that executes a series of Linux system commands via WSL (uname, os-release, df, free, uptime, etc.) and returns a structured JSON response with the results.
    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), }, ], }; } }
  • The input schema for the get_system_info tool, which requires no parameters (empty properties).
    inputSchema: { type: "object", properties: {}, },
  • src/index.js:256-263 (registration)
    Registration of the 'get_system_info' tool in the ListTools response, including name, description, and schema.
    { name: "get_system_info", description: "Get system information about the WSL2 Linux environment", inputSchema: { type: "object", properties: {}, }, },
  • src/index.js:290-291 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes 'get_system_info' calls to the getSystemInfo method.
    case "get_system_info": return await this.getSystemInfo();

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