MCP-CLI Adapter is an MCP server that allows large language models to safely execute local command-line tools through the Model Context Protocol. Built primarily for developers and system administrators, this adapter creates a controlled bridge between AI clients and host operating system commands. Users define external CLI utilities using straightforward YAML configuration files where parameters, commands, output formats, and execution shells like Bash can be declared. To prevent command injection and unauthorized actions, the server supports input validation via Common Expression Language expressions and isolated runner environments. Through these declarative definitions, developers can rapidly expose utilities such as disk analyzers, Kubernetes kubectl queries, or cloud management scripts without developing dedicated MCP software. The tool communicates over standard input and output with compatible environments like Cursor and Visual Studio Code, ensuring models only run bounded commands configured with explicit constraints and read-oriented flags.
Category: Cloud & Infrastructure
Tags: automation, cli, shell, terminal
/my/example.yaml) declaring your tools, parameters, CEL constraints, and shell commands. 3. Add the server entry to your MCP client configuration (such as .cursor/mcp.json): json { "mcpServers": { "mcp-cli-examples": { "command": "go", "args": [ "run", "github.com/inercia/MCPShell@v0.1.8", "mcp", "--tools", "/my/example.yaml", "--logfile", "/some/path/mcpshell/example.log" ] } } } 4. Alternatively, place the YAML file in ~/.mcpshell/tools/ and pass the filename without an extension to --tools. 5. Refresh or restart your MCP client to register the newly exposed command-line tools.Part of MCP Servers
You can run MCP-CLI Adapter directly using Go without manual compilation. Add a configuration entry in your client settings that invokes go run with github.com/inercia/MCPShell@v0.1.8, specifying the mcp sub-command and passing the path to your YAML tool configuration file with the tools flag.
MCP-CLI Adapter turns standard terminal utilities into Model Context Protocol tools. It parses YAML files defining commands, applies parameter substitution templates, enforces parameter validation using Common Expression Language constraints, and returns sanitized shell output back to connected language models.
MCP-CLI Adapter works with any Model Context Protocol compatible client that supports standard process execution. Documented clients include Cursor, Visual Studio Code, and Witsy, as well as AI agent frameworks that implement the MCP standard.
MCP-CLI Adapter allows administrators to declare Common Expression Language validation rules for all tool arguments. These constraints check parameters before execution, ensuring values conform to strict regular expressions, absolute directory path rules, and safe bounds before shell substitution occurs.
Yes, MCP-CLI Adapter is open source software. The project is distributed under the MIT License, and the source code, issue tracker, and contribution guides are hosted publicly on GitHub.