MCP-CLI Adapter
About
Use command line tools in a secure fashion as MCP tools.
Details
- Author
- inercia
- Categories
- Developer Tools, Community, Other
Jump to
Setup
Install MCP-CLI Adapter in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/inercia/mcp-cli-adapter
Follow the installation instructions in the repository README, then restart your MCP client.
Use command line tools in a secure fashion as MCP tools.
TheMCPShellis a tool that allows LLMs to safely executecommand-line toolsthrough theModel Context Protocol (MCP). It provides a secure bridge between LLMs and operating system commands.
- Flexible command execution: Run any shell commands as MCP tools, with parameter substitution through templates.
- Configuration-based tool definitions: Define tools in YAML with parameters, constraints, and output formatting.
- Security through constraints: Validate tool parameters using CEL expressions before execution, as well as optionalsanboxed environmentsfor running commands.
- Quick proptotyping of MCP tools: just add some shell code and use it as a MCP tool in your LLM.
- Simple integration: Works with any LLM client supporting the MCP protocol (ie, Cursor, VSCode, Witsy...)
Imagine you want Cursor (or some other MCP client) help you with your space problems in your hard disk.
-
Create a configuration file/my/example.yamldefining your tools:
mcp: description: | Tool for analyzing disk usage to help identify what's consuming space. run: shell: bash tools: - name: "disk_usage" description: "Check disk usage for a directory" params: directory: type: string description: "Directory to analyze" required: true max_depth: type: number description: "Maximum depth to analyze (1-3)" default: 2 constraints: - "directory.startsWith('/')" # Must be absolute path - "!directory.contains('..')" # Prevent directory traversal - "max_depth >= 1 && max_depth <= 3" # Limit recursion depth - "directory.matches('^[\\w\\s./\\-_]+$')" # Only allow safe path characters, prevent command injection run: command: | du -h --max-depth={{ .max_depth }} {{ .directory }} | sort -hr | head -20 output: prefix: | Disk Usage Analysis (Top 20 largest directories):
Take a look at theexamples directoryfor more sophisticated and useful examples. Maybe you prefer to let the LLM know about your Kubernetes cluster withkubectl? Or let it run someAWS CLIcommands?
Configure the MCP server in Cursor (or in any other LLM client with support for MCP)
For example, for Cursor, create.cursor/mcp.json:
{ // you need the "go" command available "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" ] } } }
You can also use relative paths and omit the.yamlextension:
{ "mcpServers": { "mcp-cli-examples": { "command": "go", "args": [ "run", "github.com/inercia/MCPShell@v0.1.8", "mcp", "--tools", "example", "--logfile", "/some/path/mcpshell/example.log" ] } } }
This will look forexample.yamlin the tools directory (~/.mcpshell/tools/by default).
See more details on how to configureCursororVisual Studio Code. Other LLMs with support for MCPs should be configured in a similar way.
Make sure your MCP client is refreshed (Cursor should recognize it automatically the firt time, but any change in the config file will require a refresh).
Ask your LLM some questions it should be able to answer with the new tool. For example:"I'm running out of space in my hard disk. Could you help me finding the problem?".
Take a look at all the command inthis document.
Configuration files use a YAML format definedhere. See thethis directoryfor some examples.
For deploying MCPShell in containers and Kubernetes, see theContainer Deployment Guide.
For AI agent functionality that connects LLMs directly to tools, see theDonproject. Don provides:
- Direct LLM connectivity without requiring a separate MCP client
- RAG (Retrieval-Augmented Generation) support
- Multi-agent architecture
- Uses MCPShell's tool configuration format
So you will probably thing"this AI has helped me finding all those big files. What if I create another tool for removing files?".Don't do that!.
- Limit the scope of these tools toread-only actions, do not give the LLM the power to change things.
- Useconstraintsto limit command execution to safe parameters
- Consider using asanboxed environmentfor running commands.
- Review all command templates for potential injection vulnerabilities
- Only expose tools that are safe for external use
- All of the above!
Please read theSecurity Considerationsdocument before using this software.
Contributions are welcome! Take a look at thedevelopment guide. Please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
A Model Context Protocol (MCP) server that enables AI assistants to integrate with Prometheus Alertmanager
A comprehensive MCP server for tooling interactions(40+) and resource accessibility(60+) plus many useful prompts to interact with Algorand Blockchain.
An MCP server that provides control over Android devices through ADB. Offers device screenshot capture, UI layout analysis, package management, and ADB command execution capabilities.
A Binary Ninja plugin, MCP server, and bridge that seamlessly integrates Binary Ninja with your favorite MCP client.
integration that connects BloodHound with AI through MCP, allowing security professionals to analyze Active Directory attack paths using natural language queries instead of Cypher.
A specialized MCP gateway for LLM enhancement prompts and jailbreaks with dynamic schema adaptation. Provides prompts for different LLMs using an enum-based approach.
Obtains latest dependency details for Clojure libraries.
A Model Context Protocol (MCP) server for CODESYS V3 programming environments.
Analyze large codebases and document collections using high-context models via OpenRouter, OpenAI, or Google AI -- very useful, e.g., with Claude Code
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





