1. Conduid
  2. Developer Tools
  3. Click MCP
MCP server · Developer Tools

Click MCP

Turn click CLIs into MCP servers with one line of code

Unclaimed MIT last commit 7 months ago devtools
58Fair

Scored 2 days ago · breakdown

About Click MCP

Click MCP is an MCP server published by crowecawcaw in the Developer Tools category: turn click CLIs into MCP servers with one line of code. It has been installed 0 times through Conduid.

The repository has 11 stars and 1 forks, with the last commit 7 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues (0) before depending on it in production.

Install

Install
npx click-mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

Ask AI about Click MCP

Powered by Claude · Grounded in docs

I know everything about Click MCP. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ·README presentNot checked yet.
  • ·License declaredNot checked yet.
  • ·Tests presentNot checked yet.
  • ·Dependencies pinnedNot checked yet.
  • ·No dynamic code executionNot checked yet.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

Releases

v0.6.1Version 0.6.1 · 20 May 2026What's Changed Add Python 3.14 support Full Changelog**: https://github.com/crowecawcaw/click-mcp/compare/v0.6.0...v0.6.1
v0.6.0v0.6.0 · 12 Jan 2026Release v0.6.0 Fixed MCP tool input schemas to comply with JSON Schema draft 2020-12 specification.
v0.5.0v0.5.0 · 15 Aug 2025Supports passing context in hierarchical commands
v0.4.1v0.4.1 · 6 May 2025Ensure tool names only use allowed characters
v0.4.0v0.4.0 · 4 May 2025Support positional arguments

README

click-mcp

PyPI version

A Python library that extends Click applications with Model Context Protocol (MCP) support, allowing AI agents to interact with CLI tools.

Overview

click-mcp provides a simple decorator that converts Click commands into MCP tools. This enables AI agents to discover and interact with your CLI applications programmatically.

The Model Context Protocol (MCP) is an open standard for AI agents to interact with tools and applications in a structured way.

Key Features

  • Simple @click_mcp decorator syntax
  • Automatic conversion of Click commands to MCP tools
  • Support for nested command groups
  • Support for positional arguments
  • Stdio-based MCP server for easy integration

Installation

pip install click-mcp

Basic Usage

import click
from click_mcp import click_mcp

@click_mcp(server_name="my-cli-app")
@click.group()
def cli():
    """Sample CLI application."""
    pass

@cli.command()
@click.option('--name', required=True, help='Name to greet')
def greet(name):
    """Greet someone."""
    click.echo(f"Hello, {name}!")

if __name__ == '__main__':
    cli()

When you run the MCP server, Click commands are converted into MCP tools:

  • Command greet becomes MCP tool greet
  • Nested commands use dot notation (e.g., users.create)

To invoke a command via MCP, send a request like:

{
  "type": "invoke",
  "tool": "greet",
  "parameters": {
    "name": "World"
  }
}

To start the MCP server:

$ python my_app.py mcp

Advanced Usage

Customizing the MCP Command Name

By default, click-mcp adds an mcp command to your CLI application. You can customize this name using the command_name parameter:

@click_mcp(command_name="start-mcp")
@click.group()
def cli():
    """Sample CLI application with custom MCP command name."""
    pass

With this configuration, you would start the MCP server using:

$ python my_app.py start-mcp

This can be useful when:

  • The name "mcp" conflicts with an existing command
  • You want a more descriptive command name
  • You're integrating with a specific AI agent that expects a certain command name

Customizing the MCP Server Name

You can also customize the name of the MCP server that's reported to clients:

@click_mcp(server_name="my-custom-tool")
@click.group()
def cli():
    """Sample CLI application with custom server name."""
    pass

This can be useful when:

  • You want to provide a more descriptive name for your tool
  • You're integrating with systems that use the server name for identification
  • You want to distinguish between different MCP-enabled applications

Working with Nested Command Groups

click-mcp supports nested command groups. When you have a complex CLI structure with subcommands, all commands are exposed as MCP tools:

@click_mcp
@click.group()
def cli():
    """Main CLI application."""
    pass

@cli.group()
def users():
    """User management commands."""
    pass

@users.command()
@click.option('--username', required=True)
def create(username):
    """Create a new user."""
    click.echo(f"Creating user: {username}")

@users.command()
@click.argument('username')
def delete(username):
    """Delete a user."""
    click.echo(f"Deleting user: {username}")

When exposed as MCP tools, the nested commands will be available with their full path using dot notation (e.g., "users.create" and "users.delete").

Working with Positional Arguments

Click supports positional arguments using @click.argument(). When these are converted to MCP tools, they are represented as named parameters in the schema:

@cli.command()
@click.argument('source')
@click.argument('destination')
@click.option('--overwrite', is_flag=True, help='Overwrite destination if it exists')
def copy(source, destination, overwrite):
    """Copy a file from source to destination."""
    click.echo(f"Copying {source} to {destination}")

This command is converted to an MCP tool with the following schema:

{
  "type": "object",
  "properties": {
    "source": {
      "description": "",
      "schema": { "type": "string" },
      "required": true
    },
    "destination": {
      "description": "",
      "schema": { "type": "string" },
      "required": true
    },
    "overwrite": {
      "description": "Overwrite destination if it exists",
      "schema": { "type": "boolean" }
    }
  },
  "required": ["source", "destination"]
}

The positional nature of arguments is handled internally by click-mcp. When invoking the command, you can use named parameters:

{
  "type": "invoke",
  "tool": "copy",
  "parameters": {
    "source": "file.txt",
    "destination": "/tmp/file.txt",
    "overwrite": true
  }
}

The MCP server will correctly convert these to positional arguments when executing the Click command:

copy file.txt /tmp/file.txt --overwrite

Handling Command Errors

When a Click command raises an exception, click-mcp captures the error and returns it as part of the MCP response. This allows AI agents to handle errors gracefully:

@cli.command()
@click.option('--filename', required=True)
def process(filename):
    """Process a file."""
    try:
        with open(filename, 'r') as f:
            content = f.read()
        click.echo(f"Processed file: {filename}")
    except FileNotFoundError:
        raise click.UsageError(f"File not found: {filename}")

If the file doesn't exist, the AI agent will receive an error message that it can present to the user or use to take corrective action.

Development

Setup

Clone the repository and install Hatch:

git clone https://github.com/aws/click-mcp.git
cd click-mcp
pip install hatch

Testing

Run tests with Hatch:

# Run all tests
hatch run test

# Run tests with coverage
hatch run cov

Code Formatting

Format code with Black:

# Format code
hatch run format

# Check formatting
hatch run check-format

Linting

Run linting checks with Ruff:

hatch run lint

Type Checking

Run type checking with MyPy:

hatch run typecheck

Run All Checks

Run all checks (formatting, linting, type checking, and tests):

hatch run check-all

Building

Build the package:

hatch run build

Documentation

Generate documentation:

hatch run docs

Related Resources

License

MIT

README mirrored from the source repository 2 days ago. The original is authoritative.

Questions

About Click MCP

How do I install Click MCP?

Run npx click-mcp, then add the server to your MCP client's configuration. Conduid has recorded 0 installs, so the command is known to work with current clients.

Is Click MCP safe to use with an AI agent?

Its trust score is 58 out of 100 (fair). It passes 0 of 1 static security checks; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Click MCP still maintained?

Yes — the latest release is v0.6.1 (20 May 2026), and the last commit was 7 months ago. The repository has 11 stars and 0 open issues.