MCP ExplorerExplorer

Cli Mcp

@mlaugharnon a year ago
8 MIT
FreeCommunity
AI Systems
#mcp#model-context-protocol
expose clis over model context protocol

Overview

What is Cli Mcp

cli-mcp is a server that exposes command-line interfaces (CLIs) over the Model Context Protocol (MCP), allowing for interaction with various CLI resources through a custom URI scheme.

Use cases

Use cases for cli-mcp include managing CLI tools in a development setup, providing a user-friendly interface for executing commands, and facilitating debugging of CLI applications through the MCP Inspector.

How to use

To use cli-mcp, install it by configuring the command in the appropriate JSON file for your operating system. You must explicitly ‘add’ a command before it can be executed. Debugging can be done using the MCP Inspector.

Key features

Key features include a custom cli:// URI scheme for accessing notes, a command to add and manage CLI resources, and commands to retrieve help and run existing commands.

Where to use

cli-mcp can be used in software development environments where command-line tools need to be managed and accessed programmatically, particularly in applications that require interaction with multiple CLI resources.

Content

cli MCP server

cli bridge

image

Pretty much a remix of the demo notes app.

Components

Resources

The server implements a simple system for working with arbitrary clis with:

  • Custom cli:// URI scheme for accessing individual notes
  • Each cli resource has a name, help menu subtree, and text/plain mimetype

Tools

The server implements one tool:

  • add (cmd): Recursively parses cli help menu subtrees and stores definition
    • Takes “cmd”
    • Updates server state and notifies clients of resource changes
  • help (cmd): Return subtrees definition
  • run (cmd, cmd_args | None): Run a known command

Quickstart

Install

Claude Desktop

Note: I had to use /opt/homebrew/bin/uv instead of just uv in the command field in this json:

On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json

On Windows: %APPDATA%/Claude/claude_desktop_config.json

{"mcpServers": {
  "cli": {
    "command": "uv",
    "args": [
      "run",
      "--directory",
      "\<path to repo folder\>",
      "cli"
    ]}
  }
}

By design, you have to explicitly ‘add’ a command before it can be run.

Debugging

Since MCP servers run over stdio, debugging can be challenging. For the best debugging
experience, we strongly recommend using the MCP Inspector.

You can launch the MCP Inspector via npm with this command:

npx @modelcontextprotocol/inspector uv --directory <path to repo> run cli

Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers