Skip to main content

Autogenerated MCP Server & UI for all of your Click commands.

Project description

Auto Generated MCP Server & UI For All of Your Python Scripts

For example, when in a repo containing the following files:

$ tree
.
...
├── scripts
│   ├── hello_world_script.py    # <-- Script containing a @click.command()   ├── options_test.py          # <-- Script containing a @click.command()   ├── not_a_click_cmd.py
│   └── test       └── sup.py               # <-- Script containing a @click.command()
...

...and run the following commands:

$ source .venv/bin/activate
$ pip install click-clack  # Or wtv pip/uv command you use to setup your virtualenv.
$ click-clack

        Running ClickClack.py           URL: http://localhost:2718

...you'll get a minimalist UI that looks like this: Scripts UI

...simply enter any values, and click Run Command!: Run Command

Auto Generated MCP Server

If you'd like to make your click commands accessible to MCP Clients such as Claude Desktop, simply add the following config to claude_desktop_config.json (see https://modelcontextprotocol.io/quickstart/user for more info):

{
    "mcpServers": {
        "click_clack": {
            "command": "uv",
            "args": [
                "run",
                "--directory",
                "/path/to/directory/with/your/click/commands"
                "--",
                "click-clack",
                "--mcp",
                "--module-path",
                "/path/to/directory/with/your/click/commands"
            ]
        }
    }
}

Note that for this to work as documented above, you'll need to install uv globally first and the /path/to/directory/with/your/click/commands directory must be a valid uv project (i.e. you ran uv init there and uv added the dependencies your commands need).

For example, in Claude Desktop once properly configured you'll be able to see the available tools provided by the click-clack MCP server. Claude Desktop Example

Note on MCP Tool Outputs!

Click commands don't generally return values, so instead when running your commands as an MCP tool, Click Clack will capture all stdout/stderr output that your command emits, and redirect that to the MCP client as your tool's reponse. So, instead of returning your final tool response, use print(response) instead.

How It Works

This project crawls all .py files at and below the directory where the click-clack command is run. It then automatically traverses the Python AST looking for the @click.command() decorator, and imports the decorated commands and generates a minimalist UI for them.

Support for click and asyncclick

Whether you're writing basic click commands, or using asyncclick to write async commands, click-clack seamlessly supports your command by auto-detecting the command type.

UI Generation via Marimo

Marimo fundamentally underpins this package by providing an extremely simple framework for generating interactive UIs in pure python.

MCP Server Generation via FastMCP

MCP Server generation is entirely based on FastMCP, which does almost all of the heavy lifting. Click Clack just performs auto-discovery and does a bit of clever wrapping of your Click commands to be able to pass them off to FastMCP as tools.

Command Parameter Discovery

The UI will generate an input for each command parameter, and will forward the data from the input to the command.

Supported Command Parameter Types

Currently this project only supports automatically discovering the following command parameter types:

  • str
  • int
  • float
  • bool (including is_flag=True)
  • click.Choice
  • click.File (via a file browser UI element: TODO - support stdout via click's magic "-" file arg support)
  • click.Path
  • click.DateTime
  • click.IntRange
  • click.FloatRange
  • ...literally everything else is a TODO...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

click_clack-0.2.1.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

click_clack-0.2.1-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file click_clack-0.2.1.tar.gz.

File metadata

  • Download URL: click_clack-0.2.1.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for click_clack-0.2.1.tar.gz
Algorithm Hash digest
SHA256 44ab4aa3bd4e0c0af27dc02378846d6bdabae56e9c719389b7c3dbb3217c92d1
MD5 3c126a4b345261fb93339527ae627418
BLAKE2b-256 fce43dcfff3f1244941c5034812b8594e32b65f20e8aa415f97dec342ff98846

See more details on using hashes here.

Provenance

The following attestation bundles were made for click_clack-0.2.1.tar.gz:

Publisher: release.yml on JasonSteving99/click-clack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file click_clack-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: click_clack-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for click_clack-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d49faa9270d38449f39e9ee4e44725a4facdadfe2c595f46929df8164c4f87e4
MD5 d9ea0d38db5685fb11c7f74cb2d0bb7b
BLAKE2b-256 f4f9aa78180dfbaec7cb3e6e217ca266315882b1fdb7919c328ab0b36cda30c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for click_clack-0.2.1-py3-none-any.whl:

Publisher: release.yml on JasonSteving99/click-clack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page