@@ -4,6 +4,7 @@ This document is a compact reference of all Hatch CLI commands and options imple
44
55## Table of Contents
66
7+ ```
78- [Global options](#global-options)
89- [Commands](#commands)
910 - [hatch create](#hatch-create)
@@ -17,12 +18,27 @@ This document is a compact reference of all Hatch CLI commands and options imple
1718 - [hatch env python](#hatch-env-python-advanced-python-environment-subcommands)
1819 - [hatch env python init](#hatch-env-python-init)
1920 - [hatch env python info](#hatch-env-python-info)
21+ - [hatch env python add-hatch-mcp](#hatch-env-python-add-hatch-mcp)
2022 - [hatch env python remove](#hatch-env-python-remove)
2123 - [hatch env python shell](#hatch-env-python-shell)
2224 - [hatch package](#hatch-package-package-management)
2325 - [hatch package add](#hatch-package-add)
2426 - [hatch package remove](#hatch-package-remove)
2527 - [hatch package list](#hatch-package-list)
28+ - [hatch package sync](#hatch-package-sync)
29+ - [hatch mcp](#hatch-mcp)
30+ - [hatch mcp configure](#hatch-mcp-configure)
31+ - [hatch mcp sync](#hatch-mcp-sync)
32+ - [hatch mcp remove server](#hatch-mcp-remove-server)
33+ - [hatch mcp remove host](#hatch-mcp-remove-host)
34+ - [hatch mcp list hosts](#hatch-mcp-list-hosts)
35+ - [hatch mcp list servers](#hatch-mcp-list-servers)
36+ - [hatch mcp discover hosts](#hatch-mcp-discover-hosts)
37+ - [hatch mcp discover servers](#hatch-mcp-discover-servers)
38+ - [hatch mcp backup list](#hatch-mcp-backup-list)
39+ - [hatch mcp backup restore](#hatch-mcp-backup-restore)
40+ - [hatch mcp backup clean](#hatch-mcp-backup-clean)
41+ ```
2642
2743## Global options
2844
@@ -105,7 +121,7 @@ Syntax:
105121| ` --python-version ` | string | Python version to create (e.g., ` 3.11 ` ) | none (manager default) |
106122| ` --no-python ` | flag | Do not create a Python environment (skip conda/mamba) | false |
107123| ` --no-hatch-mcp-server ` | flag | Do not install ` hatch_mcp_server ` wrapper | false |
108- | ` --hatch_mcp_server_tag ` | string | Git tag/branch for wrapper install (e.g., ` dev ` , ` v0.1.0 ` ) | none |
124+ | ` --hatch-mcp-server-tag ` | string | Git tag/branch for wrapper installation (e.g., ` dev ` , ` v0.1.0 ` ) | none |
109125
110126#### ` hatch env remove `
111127
@@ -223,7 +239,7 @@ Syntax:
223239
224240### ` hatch package ` (package management)
225241
226- Top-level syntax: ` hatch package <add|remove|list> ... `
242+ Top-level syntax: ` hatch package <add|remove|list|sync > ... `
227243
228244#### ` hatch package add `
229245
@@ -241,9 +257,28 @@ Syntax:
241257| ` --force-download ` , ` -f ` | flag | Force fetching even if cached | false |
242258| ` --refresh-registry ` , ` -r ` | flag | Refresh registry metadata before resolving | false |
243259| ` --auto-approve ` | flag | Automatically approve dependency installation prompts | false |
260+ | ` --host ` | string | Comma-separated list of MCP host platforms to configure (e.g., claude-desktop,cursor) | none |
244261
245262** Note:** Dependency installation prompts are also automatically approved in non-TTY environments (such as CI/CD pipelines) or when the ` HATCH_AUTO_APPROVE ` environment variable is set. See [ Environment Variables] ( #environment-variables ) for details.
246263
264+ ** MCP Host Integration:** When adding a package, if the ` --host ` flag is specified, Hatch will automatically configure the package's MCP servers on the specified hosts. This includes analyzing package dependencies and configuring all related MCP servers.
265+
266+ ** MCP Host Integration Examples:**
267+
268+ ``` bash
269+ # Add package and automatically configure MCP servers on specific hosts
270+ hatch package add ./my_package --host claude-desktop,cursor
271+
272+ # Add package for all available hosts
273+ hatch package add ./my_package --host all
274+
275+ # Skip host configuration (no MCP servers configured)
276+ hatch package add ./my_package
277+
278+ # Add with other flags and MCP configuration
279+ hatch package add registry_package --version 1.0.0 --env dev-env --host gemini --auto-approve
280+ ```
281+
247282Examples:
248283
249284` hatch package add ./my_package `
@@ -289,17 +324,24 @@ Syntax:
289324| ---:| ---| ---| ---|
290325| ` package_name ` | string (positional) | Name of package whose MCP servers to sync | n/a |
291326| ` --host ` | string | Comma-separated list of host platforms or 'all' | n/a |
292- | ` --env ` , ` -e ` | string | Environment name (defaults to current) | current environment |
327+ | ` --env ` , ` -e ` | string | Target Hatch environment name (defaults to current) | current environment |
293328| ` --dry-run ` | flag | Preview changes without execution | false |
294329| ` --auto-approve ` | flag | Skip confirmation prompts | false |
295- | ` --no-backup ` | flag | Disable default backup behavior | false |
330+ | ` --no-backup ` | flag | Disable default backup behavior of the MCP host's config file | false |
296331
297332Examples:
298333
299334` hatch package sync my-package --host claude-desktop `
300335
301336` hatch package sync weather-server --host claude-desktop,cursor --dry-run `
302337
338+ # Multi-package synchronization examples
339+ # Sync main package AND all its dependencies:
340+ hatch package sync my-package --host all
341+
342+ # Sync without creating backups
343+ hatch package sync my-package --host claude-desktop --no-backup
344+
303345---
304346
305347## Environment Variables
@@ -340,23 +382,36 @@ HATCH_AUTO_APPROVE=yes hatch package add production_package
340382
341383## MCP Host Configuration Commands
342384
343- ### ` hatch mcp configure `
385+ ### ` hatch mcp `
386+
387+ Commands subset to manage non-hatch package MCP servers.
388+ Top level syntax: ` <hatch mcp configure|sync|remove|list|discover|backup> ... `
389+
390+ #### ` hatch mcp configure `
344391
345392Configure an MCP server on a specific host platform.
346393
347394Syntax:
348395
349- ` hatch mcp configure <server-name> --host <host> (--command CMD | --url URL) [--args ARGS] [--env ENV] [--header HEADER] [--dry-run] [--auto-approve] [--no-backup] `
396+ ` hatch mcp configure <server-name> --host <host> (--command CMD | --url URL) [--args ARGS] [--env-var ENV] [--header HEADER] [--dry-run] [--auto-approve] [--no-backup] `
350397
351398| Argument / Flag | Type | Description | Default |
352399| ---:| ---| ---| ---|
353400| ` server-name ` | string (positional) | Name of the MCP server to configure | n/a |
354401| ` --host ` | string | Target host platform (claude-desktop, cursor, etc.) | n/a |
355402| ` --command ` | string | Command to execute for local servers (mutually exclusive with --url) | none |
356403| ` --url ` | string | URL for remote MCP servers (mutually exclusive with --command) | none |
357- | ` --args ` | multiple | Arguments for MCP server command (only with --command) | none |
358- | ` --env ` | string | Environment variables format: KEY=VALUE (can be used multiple times) | none |
404+ | ` --http-url ` | string | HTTP streaming endpoint URL (Gemini only) | none |
405+ | ` --args ` | string | Arguments for MCP server command (only with --command) | none |
406+ | ` --env-var ` | string | Environment variables format: KEY=VALUE (can be used multiple times) | none |
359407| ` --header ` | string | HTTP headers format: KEY=VALUE (only with --url) | none |
408+ | ` --timeout ` | int | Request timeout in milliseconds (Gemini) | none |
409+ | ` --trust ` | flag | Bypass tool call confirmations (Gemini) | false |
410+ | ` --cwd ` | string | Working directory for stdio transport (Gemini) | none |
411+ | ` --include-tools ` | multiple | Tool allowlist - only these tools will be available (Gemini) | none |
412+ | ` --exclude-tools ` | multiple | Tool blocklist - these tools will be excluded (Gemini) | none |
413+ | ` --env-file ` | string | Path to environment file (Cursor, VS Code, LM Studio) | none |
414+ | ` --input ` | multiple | Input variable definitions format: type,id,description[ ,password=true] (VS Code) | none |
360415| ` --dry-run ` | flag | Preview configuration without applying changes | false |
361416| ` --auto-approve ` | flag | Skip confirmation prompts | false |
362417| ` --no-backup ` | flag | Skip backup creation before configuration | false |
@@ -403,6 +458,37 @@ Configure MCP server 'api-server' on host 'claude-desktop'? [y/N]: y
403458[SUCCESS] Successfully configured MCP server ' api-server' on host ' claude-desktop'
404459```
405460
461+ ** Example - Advanced Gemini Configuration** :
462+
463+ ``` bash
464+ $ hatch mcp configure my-server --host gemini --command python --args server.py --timeout 30000 --trust --include-tools weather,calculator
465+
466+ Server ' my-server' created for host ' gemini' :
467+ name: UPDATED None --> ' my-server'
468+ command: UPDATED None --> ' python'
469+ args: UPDATED None --> [' server.py' ]
470+ timeout: UPDATED None --> 30000
471+ trust: UPDATED None --> True
472+ include_tools: UPDATED None --> [' weather' , ' calculator' ]
473+
474+ Configure MCP server ' my-server' on host ' gemini' ? [y/N]: y
475+ [SUCCESS] Successfully configured MCP server ' my-server' on host ' gemini'
476+ ```
477+
478+ ** Example - Remote Server Configuration** :
479+
480+ ``` bash
481+ $ hatch mcp configure api-server --host vscode --url https://api.example.com --header Auth=token
482+
483+ Server ' api-server' created for host ' vscode' :
484+ name: UPDATED None --> ' api-server'
485+ url: UPDATED None --> ' https://api.example.com'
486+ headers: UPDATED None --> {' Auth' : ' token' }
487+
488+ Configure MCP server ' api-server' on host ' vscode' ? [y/N]: y
489+ [SUCCESS] Successfully configured MCP server ' api-server' on host ' vscode'
490+ ```
491+
406492** Example - Dry Run Mode** :
407493
408494``` bash
@@ -433,7 +519,7 @@ Different MCP hosts support different configuration fields. The conversion repor
433519
434520When configuring a server with fields not supported by the target host, those fields are marked as UNSUPPORTED in the report and automatically excluded from the configuration.
435521
436- ### ` hatch mcp sync `
522+ #### ` hatch mcp sync `
437523
438524Synchronize MCP configurations across environments and hosts.
439525
@@ -452,7 +538,7 @@ Syntax:
452538| ` --auto-approve ` | flag | Skip confirmation prompts | false |
453539| ` --no-backup ` | flag | Skip backup creation before synchronization | false |
454540
455- ### ` hatch mcp remove server `
541+ #### ` hatch mcp remove server `
456542
457543Remove an MCP server from one or more hosts.
458544
@@ -468,7 +554,7 @@ Syntax:
468554| ` --auto-approve ` | flag | Skip confirmation prompts | false |
469555| ` --no-backup ` | flag | Skip backup creation before removal | false |
470556
471- ### ` hatch mcp remove host `
557+ #### ` hatch mcp remove host `
472558
473559Remove complete host configuration (all MCP servers from the specified host).
474560
@@ -483,7 +569,7 @@ Syntax:
483569| ` --auto-approve ` | flag | Skip confirmation prompts | false |
484570| ` --no-backup ` | flag | Skip backup creation before removal | false |
485571
486- ### ` hatch mcp list hosts `
572+ #### ` hatch mcp list hosts `
487573
488574List MCP hosts configured in the current environment.
489575
@@ -527,7 +613,7 @@ Available MCP Host Platforms:
527613✗ lmstudio Not Found /Users/user/.lmstudio/config.json
528614```
529615
530- ### ` hatch mcp list servers `
616+ #### ` hatch mcp list servers `
531617
532618List MCP servers from environment with host configuration tracking information.
533619
@@ -558,7 +644,7 @@ news-aggregator news-toolkit 2.1.0 python news.py
558644 claude-desktop: /Users/user/.claude/config.json (last synced: 2025-09-24T10:00:00)
559645```
560646
561- ### ` hatch mcp discover hosts `
647+ #### ` hatch mcp discover hosts `
562648
563649Discover available MCP host platforms on the system.
564650
@@ -580,7 +666,7 @@ Available MCP host platforms:
580666 Config path: ~/.vscode/config.json
581667```
582668
583- ### ` hatch mcp discover servers `
669+ #### ` hatch mcp discover servers `
584670
585671Discover MCP servers in Hatch environments.
586672
@@ -592,7 +678,7 @@ Syntax:
592678| ---:| ---| ---| ---|
593679| ` --env ` | string | Specific environment to discover servers in | current environment |
594680
595- ### ` hatch mcp backup list `
681+ #### ` hatch mcp backup list `
596682
597683List available configuration backups.
598684
@@ -605,7 +691,7 @@ Syntax:
605691| ` --host ` | string | Filter backups by host | all hosts |
606692| ` --detailed ` | flag | Show detailed backup information | false |
607693
608- ### ` hatch mcp backup restore `
694+ #### ` hatch mcp backup restore `
609695
610696Restore host configuration from backup.
611697
@@ -619,7 +705,7 @@ Syntax:
619705| ` --dry-run ` | flag | Preview restore without executing changes | false |
620706| ` --auto-approve ` | flag | Skip confirmation prompts | false |
621707
622- ### ` hatch mcp backup clean `
708+ #### ` hatch mcp backup clean `
623709
624710Clean old backup files.
625711
0 commit comments