Skip to content

CLI Usage

Gunpal Jain edited this page Apr 9, 2025 · 2 revisions

QuickMCP CLI Documentation

The QuickMCP CLI provides a command-line interface for generating, configuring, and serving MCP servers. This document details the commands, options, and usage patterns for the CLI tool.

Installation

dotnet tool install -g QuickMCP.CLI

Command Structure

The QuickMCP CLI has the following command structure:

quickmcp [OPTIONS] <COMMAND>

Global Commands

Help

Display help information about available commands.

quickmcp --help

Version

Display the version of QuickMCP CLI.

quickmcp --version

Serve Command

The serve command starts an MCP server based on an API specification or configuration file.

Serve from API Specification URL

quickmcp serve --spec-url https://petstore.swagger.io/v2/swagger.json

Serve from API Specification File

quickmcp serve --spec-path ./swagger/petstore.json

Serve from Configuration File

quickmcp serve --config-path ./config/mcp_server_config.json

Serve Options

Option Alias Description Default
--help -h Prints help information -
--config-path -c The path to the configuration file -
--config-env-var -e The environment variable name pointing to the configuration file -
--spec-url -s The URL of the OpenAPI or Google Discovery specification -
--spec-path -p The Path of the OpenAPI or Google Discovery specification -
--server-id -i The ID of the server to use -
--api-base-url -a Base URL for the API -
--logging -l Enable verbose console logging false

Examples

# Serve with a configuration file
quickmcp serve -c mcp_server_config.json

Build Command

The build command generates configuration files for MCP servers.

Build Configuration

quickmcp build config --spec-url https://petstore.swagger.io/v2/swagger.json --output-path ./config

Build Specification

quickmcp build spec -d url_to_documentation

Build Config Options

Option Alias Description Default
--help -h Prints help information -
--api-type -t API Specification type OpenAPI (openapi) or Google discovery (discovery) -
--spec-url -s The URL of the OpenAPI or Google Discovery specification -
--spec-path -p The Path of the OpenAPI or Google Discovery specification -
--server-name -n The name of the server to use -
--api-base-url -a Base URL for the API -
--auth - The type of authentication to use -
--exclude-paths -x Exclude api paths from the generated client -
--only-for-paths -f Only generate api paths for the specified paths -
--output-path -o Output directory path for the generated client -
--ai-metadata -m Generate AI metadata for the methods and parameters false
--ai-api-key -k Google Gemini API Key for the metadata generation -
--skip-auth-config - Skip the authentication configuration at the end of build false

Examples

# Build with a specific API type
quickmcp build config --api-type openapi --spec-url https://petstore.swagger.io/v2/swagger.json

# Build with path filtering
quickmcp build config --spec-url https://petstore.swagger.io/v2/swagger.json --exclude-paths "/admin/*"

# Build with authentication
quickmcp build config --spec-url https://petstore.swagger.io/v2/swagger.json --auth apiKey

# Build specification from documentation
quickmcp build spec -d url_to_documentation

List Command

The list command shows available configuration options.

List Authentication Options

quickmcp list auth

List Available Servers

quickmcp list server

List Options

Option Alias Description Default
--help -h Prints help information -

Add Command

The add command adds new configuration options.

Add Server

quickmcp add server /path/to/config.json -n MyServer

Add Server Options

Option Alias Description Default
--help -h Prints help information -
--name -n Name of the server -

Arguments

Argument Description
configuration file Path to the configuration file

Delete Command

The delete command removes configuration options.

Delete Server

quickmcp delete server MyServer

Delete Server Options

Option Alias Description Default
--help -h Prints help information -

Arguments

Argument Description
server name Server name or ID

Authentication Types

The CLI supports the following authentication types:

API Key Authentication (apiKey)

API Key Authentication adds the API key to the header or query.

Required settings:

  • apiKey: The API Key used for authentication
  • paramName: The name of the parameter (default is X-API-Key) - Optional
  • location: The location where the API key will be added (header or query) - Optional

Basic Authentication (basicAuth)

Basic Authentication adds a Base64 encoded username and password to the Authorization header.

Required settings:

  • username: The username for authentication
  • password: The password for authentication

Bearer Token Authentication (bearerToken)

Bearer Token Authentication adds the token to the Authorization header.

Required settings:

  • token: The bearer token for authentication

Custom Header Authentication (customHeader)

Custom Header Authentication adds a specified header with a value to the request.

Required settings:

  • headerName: The name of the header
  • headerValue: The value of the header

OAuth 2.0 Client Credentials (oAuth)

OAuth 2.0 Client Credentials Authentication using token endpoint.

Required settings:

  • tokenUrl: The URL used to retrieve an access token
  • clientId: The client ID for authentication
  • clientSecret: The client secret for authentication
  • scope: Optional access scope, defaults to 'client_credentials' - Optional

Environment Variables

The CLI supports environment variables for configuration:

Environment Variable Description
QUICKMCP_CONFIG_PATH Path to the configuration file (can be specified with --config-env-var)

Configuration Files

The configuration files generated by the build config command are JSON files with server settings.

Examples

Serve a Pet Store API

quickmcp serve --spec-url https://petstore.swagger.io/v2/swagger.json

Generate Configuration for a Weather API

quickmcp build config --spec-url https://api.weather.gov/openapi.json --output-path ./weather-config

Add a Server Configuration

quickmcp add server /path/to/config.json -n WeatherAPI

Delete a Stored Server

quickmcp delete server WeatherAPI

Troubleshooting

Common Issues

  1. API Specification not found: Verify the URL or file path is correct and accessible.
  2. Authentication failures: Check that your authentication details are correct.

Verbose Logging

Enable verbose logging to diagnose issues:

quickmcp serve --spec-url https://petstore.swagger.io/v2/swagger.json --logging

Getting Help

For additional help:

quickmcp --help
quickmcp serve --help
quickmcp build --help
quickmcp list --help
quickmcp add --help
quickmcp delete --help