Skip to content

CLI reference


pycli-mcp

Run an MCP server using a list of import paths to commands or callable objects that return a command:

pycli-mcp pkg1.cli:foo pkg2.cli:bar

Filtering is supported. For example, if you have a CLI named foo and you only want to expose the subcommands bar and baz, excluding the baz subcommands sub2 and sub3, you can do:

pycli-mcp pkg.cli:foo -i "bar|baz" -e "baz (sub2|sub3)"

Usage:

pycli-mcp [OPTIONS] [SPECS]...

Options:

Name Type Description Default
--aggregate, -a choice (root | group | none) The level of aggregation to use, with less improving type information at the expense of more tools (default: root). Multiple specs make the format: spec=aggregation None
--name, -n text The expected name of the executable, overriding the default (name of the callback). Multiple specs make the format: spec=name None
--include, -i text The regular expression filter to include subcommands. Multiple specs make the format: spec=regex None
--exclude, -e text The regular expression filter to exclude subcommands. Multiple specs make the format: spec=regex None
--strict-types boolean Error on unknown types False
--debug boolean Enable debug mode False
--host text The host used to run the server (default: 127.0.0.1) None
--port integer The port used to run the server (default: 8000) None
--log-level text The log level used to run the server (default: info) None
--log-config text The path to a file passed to the logging.config.fileConfig function None
--option, -o Arbitrary server options (multiple allowed) e.g. -o key1 value1 -o key2 value2 None
-h, --help boolean Show this message and exit. False