Skip to content

Commit 8137957

Browse files
author
LittleCoinCoin
committed
docs(user): update tutorial on mcp host configuration
- Refresh content of the tutorial to match current to-be-released version 0.7.x - Refresh content of quicker `MCPHostConfiguration.md` - Add the tutorials to the mkdocs configuration
1 parent fb30d37 commit 8137957

File tree

8 files changed

+205
-437
lines changed

8 files changed

+205
-437
lines changed

docs/articles/users/MCPHostConfiguration.md

Lines changed: 18 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ For step-by-step guidance on MCP host configuration, see the comprehensive tutor
3030
- [Tutorial: Configuring Hatch Packages](tutorials/04-mcp-host-configuration/02-configuring-hatch-packages.md) - **Preferred deployment method** with automatic dependency resolution
3131
- [Tutorial: Configuring Arbitrary Servers](tutorials/04-mcp-host-configuration/03-configuring-arbitrary-servers.md) - Advanced method for non-Hatch servers
3232
- [Tutorial: Environment Synchronization](tutorials/04-mcp-host-configuration/04-environment-synchronization.md) - Cross-environment deployment workflows
33-
- [Tutorial: Advanced Synchronization](tutorials/04-mcp-host-configuration/05-advanced-synchronization.md) - Enterprise patterns and automation
3433

3534
## Basic Usage
3635

@@ -40,7 +39,7 @@ Add an MCP server to a specific host:
4039

4140
```bash
4241
# Configure a local MCP server
43-
hatch mcp configure weather-server \
42+
hatch mcp configure weather_server \
4443
--host claude-desktop \
4544
--command python \
4645
--args weather_server.py
@@ -49,7 +48,7 @@ hatch mcp configure weather-server \
4948
hatch mcp configure api-service \
5049
--host cursor \
5150
--url https://api.example.com/mcp \
52-
--header "Authorization: Bearer token"
51+
--header "Authorization=Bearer token"
5352
```
5453

5554
### List Configured Servers
@@ -64,7 +63,7 @@ hatch mcp list hosts
6463
hatch mcp list servers
6564

6665
# List servers from specific environment
67-
hatch mcp list servers --env production
66+
hatch mcp list servers --env-var production
6867
```
6968

7069
### Remove a Server
@@ -73,10 +72,10 @@ Remove an MCP server from a host:
7372

7473
```bash
7574
# Remove server from specific host
76-
hatch mcp remove server weather-server --host claude-desktop
75+
hatch mcp remove server weather_server --host claude-desktop
7776

7877
# Remove server from all hosts
79-
hatch mcp remove server weather-server --host all
78+
hatch mcp remove server weather_server --host all
8079

8180
# Remove entire host configuration
8281
hatch mcp remove host claude-desktop
@@ -86,7 +85,7 @@ hatch mcp remove host claude-desktop
8685

8786
**Important**: Each server must be configured as either local (using `--command`) or remote (using `--url`), but not both. These options are mutually exclusive:
8887

89-
- **Local servers**: Use `--command` and optionally `--args` and `--env`
88+
- **Local servers**: Use `--command` and optionally `--args` and `--env-var`
9089
- **Remote servers**: Use `--url` and optionally `--header`
9190

9291
Attempting to use both `--command` and `--url` will result in an error.
@@ -103,12 +102,12 @@ hatch mcp configure my-server \
103102
--args server.py
104103

105104
# Server with environment variables
106-
hatch mcp configure weather-server \
105+
hatch mcp configure weather_server \
107106
--host claude-desktop \
108107
--command python \
109108
--args weather_server.py \
110-
--env API_KEY=your-key \
111-
--env DEBUG=true
109+
--env-var API_KEY=your-key \
110+
--env-var DEBUG=true
112111

113112
# Server with absolute path (required for some hosts)
114113
hatch mcp configure secure-server \
@@ -131,8 +130,8 @@ hatch mcp configure api-server \
131130
hatch mcp configure authenticated-api \
132131
--host cursor \
133132
--url https://secure-api.example.com/mcp \
134-
--header "Authorization: Bearer your-token" \
135-
--header "Content-Type: application/json"
133+
--header "Authorization=Bearer your-token" \
134+
--header "Content-Type=application/json"
136135
```
137136

138137
## Multi-Host Configuration
@@ -143,14 +142,14 @@ Set up the same server on multiple host platforms:
143142

144143
```bash
145144
# Configure on multiple hosts at once
146-
hatch mcp configure weather-server \
145+
hatch mcp configure weather_server \
147146
--hosts claude-desktop,cursor,vscode \
148147
--command python \
149148
--args weather_server.py
150149

151150
# Configure on all available hosts
152-
hatch mcp configure weather-server \
153-
--all-hosts \
151+
hatch mcp configure weather_server \
152+
--hosts all \
154153
--command python \
155154
--args weather_server.py
156155
```
@@ -175,38 +174,6 @@ hatch mcp sync --from-env dev --to-host all --pattern ".*api.*"
175174
hatch mcp sync --from-env prod --to-host all --dry-run
176175
```
177176

178-
## Host-Specific Considerations
179-
180-
### Claude Family (Claude Desktop, Claude Code)
181-
182-
Claude hosts require absolute paths for local servers:
183-
184-
```bash
185-
# Correct - absolute path
186-
hatch mcp configure my-server \
187-
--host claude-desktop \
188-
--command /usr/local/bin/python \
189-
--args /path/to/server.py
190-
191-
# Incorrect - relative path (will be rejected)
192-
hatch mcp configure my-server \
193-
--host claude-desktop \
194-
--command python \
195-
--args ./server.py
196-
```
197-
198-
### VS Code
199-
200-
VS Code uses a nested configuration structure. Hatch handles this automatically, but be aware that manual edits to VS Code settings may affect MCP server configurations.
201-
202-
### Cursor and LM Studio
203-
204-
These hosts are more flexible with path requirements and generally accept both absolute and relative paths.
205-
206-
### Gemini
207-
208-
Gemini uses the official configuration path at `~/.gemini/settings.json`. Ensure you have Gemini properly installed and configured.
209-
210177
## Backup and Recovery
211178

212179
### Automatic Backups
@@ -224,14 +191,11 @@ hatch mcp configure my-server --host claude-desktop --command python --args serv
224191
### Manual Backup Management
225192

226193
```bash
227-
# Create manual backup of host configuration
228-
hatch mcp backup --host claude-desktop
229-
230194
# List available backups
231-
hatch mcp backup list --host claude-desktop
195+
hatch mcp backup list claude-desktop
232196

233-
# Restore from backup
234-
hatch mcp restore --host claude-desktop --backup 2025-09-21-10-30-00
197+
# Restore from backup file
198+
hatch mcp backup restore claude-desktop --backup-file <backup_file_name>
235199
```
236200

237201
### Backup Locations
@@ -469,7 +433,7 @@ Complete host configuration removal and management:
469433
hatch mcp remove host <host-name>
470434

471435
# Remove with environment specification
472-
hatch mcp remove server <server_name> --host <host> --env <environment>
436+
hatch mcp remove server <server_name> --host <host> --env-var <environment>
473437
```
474438

475439
### Safety and Backup Features

docs/articles/users/tutorials/04-mcp-host-configuration/01-host-platform-overview.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,16 +221,16 @@ hatch package add my_package --host claude-desktop --dry-run
221221
hatch mcp configure my_package --host cursor --dry-run
222222

223223
# Test in testing environment first
224-
hatch env use package-testing
224+
hatch env use package_testing
225225
hatch package add . --host claude-desktop # from within the package directory
226226
```
227227

228228
### Environment Isolation
229229

230230
```bash
231231
# Different environments maintain separate package versions
232-
hatch env create package-testing-v2
233-
hatch env create team-standard-2024q4
232+
hatch env create package_testing_v2
233+
hatch env create team_standard_2024q4
234234

235235
# Each environment can have different MCP package versions
236236
```

docs/articles/users/tutorials/04-mcp-host-configuration/02-configuring-hatch-packages.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,10 @@ hatch package add . --host claude-desktop
6969

7070
**Expected Output**:
7171
```
72-
Analyzing package dependencies...
73-
✓ Python dependencies: requests, numpy
74-
✓ System dependencies: curl
75-
✓ Hatch dependencies: none
76-
✓ Docker dependencies: none
77-
78-
Installing dependencies...
79-
✓ Python environment created
80-
✓ Python packages installed
81-
✓ System packages installed
82-
83-
Configuring MCP server...
84-
✓ Server configured: my-new-package
85-
✓ Host platform: claude-desktop
86-
✓ Configuration file updated
87-
88-
Package deployment completed successfully!
72+
Successfully added package: my_new_package
73+
Configuring MCP server for package 'my_new_package' on 1 host(s)...
74+
✓ Configured my_new_package (my_new_package) on claude-desktop
75+
MCP configuration completed: 1/1 hosts configured
8976
```
9077

9178
### Verify Deployment
@@ -145,8 +132,9 @@ hatch package sync weather-server,news-api --host all
145132

146133
```bash
147134
# Sync all packages in current environment to hosts
148-
hatch package sync --all --host claude-desktop,cursor
135+
hatch package sync --host claude-desktop,cursor
149136
```
137+
The `hatch package sync` command syncs all packages that are already installed in the current environment.
150138

151139
## Step 4: Validate Dependency Resolution
152140

@@ -249,15 +237,18 @@ hatch mcp remove server my-new-package --host claude-desktop
249237
# (Backups are created automatically)
250238
```
251239

252-
**Clean Environment Reset**:
240+
**Clean Environment Reset**
241+
253242
```bash
254243
# Remove all MCP configurations for host
255244
hatch mcp remove host claude-desktop
256245

257-
# Redeploy packages
258-
hatch package sync --all --host claude-desktop
246+
# Redeploy packages from the a hatch environment
247+
hatch mcp sync --from-env env_name --to-host claude-desktop
259248
```
260249

250+
**Note**: The `hatch mcp sync` command only syncs packages from one environment (or one host) at a time. If you want to re-sync other packages, you must run the command several times.
251+
261252
## Best Practices
262253

263254
### Package Development Workflow

docs/articles/users/tutorials/04-mcp-host-configuration/03-configuring-arbitrary-servers.md

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,14 @@ hatch mcp configure news-api \
7676

7777
**Expected Output**:
7878
```
79-
Configuring MCP server: weather-api
80-
✓ Host platform: claude-desktop
81-
✓ Command: python
82-
✓ Arguments: /path/to/weather_server.py
83-
✓ Environment variables: API_KEY, DEBUG
84-
✓ Configuration file updated
85-
✓ Backup created: ~/.hatch/mcp_backups/claude-desktop_20231201_143022.json
86-
87-
MCP server configured successfully!
79+
Server 'weather-api' created for host 'claude-desktop':
80+
name: UPDATED None --> 'weather-api'
81+
command: UPDATED None --> 'python'
82+
args: UPDATED None --> ['/path/to/weather_server.py']
83+
env: UPDATED None --> {'API_KEY': 'your_api_key', 'DEBUG': 'true'}
84+
85+
Configuring MCP server 'weather-api' on host 'claude-desktop'? [y/N]: y
86+
[SUCCESS] Successfully configured MCP server 'weather-api' on host 'claude-desktop'
8887
```
8988

9089
### Verify Local Configuration
@@ -122,34 +121,33 @@ Configure an MCP server hosted on a remote URL:
122121
```bash
123122
# Configure remote MCP server
124123
hatch mcp configure remote-api \
125-
--host claude-desktop \
124+
--host gemini \
126125
--url https://api.example.com/mcp \
127-
--headers Authorization=Bearer_your_token \
128-
--headers Content-Type=application/json
126+
--header "Authorization=Bearer_your_token" \
127+
--header "Content-Type=application/json"
129128
```
130129

131130
### Remote Server with Authentication
132131

133132
```bash
134133
# Configure with multiple headers for authentication
135134
hatch mcp configure secure-api \
136-
--host cursor \
135+
--host gemini \
137136
--url https://secure-api.example.com/mcp \
138-
--headers Authorization=Bearer_token \
139-
--headers X-API-Key=your_api_key \
140-
--headers User-Agent=HatchMCP/1.0
137+
--header "Authorization=Bearer_token" \
138+
--header "X-API-Key=your_api_key" \
139+
--header "User-Agent=HatchMCP/1.0"
141140
```
142141

143142
**Expected Output**:
144143
```
145-
Configuring MCP server: secure-api
146-
✓ Host platform: cursor
147-
✓ Server URL: https://secure-api.example.com/mcp
148-
✓ Headers: Authorization, X-API-Key, User-Agent
149-
✓ Configuration file updated
150-
✓ Backup created: ~/.hatch/mcp_backups/cursor_20231201_143045.json
151-
152-
Remote MCP server configured successfully!
144+
Server 'secure-api' created for host 'gemini':
145+
name: UPDATED None --> 'secure-api'
146+
url: UPDATED None --> 'https://secure-api.example.com/mcp'
147+
headers: UPDATED None --> {'Authorization': 'Bearer_token', 'X-API-Key': 'your_api_key', 'User-Agent': 'HatchMCP/1.0'}
148+
149+
Configuring MCP server 'secure-api' on host 'gemini'? [y/N]: y
150+
[SUCCESS] Successfully configured MCP server 'secure-api' on host 'gemini'
153151
```
154152

155153
### Verify Remote Configuration
@@ -220,7 +218,7 @@ hatch mcp configure data-processor \
220218

221219
```bash
222220
# Testing configuration
223-
hatch env use package-testing
221+
hatch env use package_testing
224222
hatch mcp configure test-server \
225223
--host claude-desktop \
226224
--command python \
@@ -229,7 +227,7 @@ hatch mcp configure test-server \
229227
--env LOG_LEVEL=debug
230228

231229
# Team standard configuration
232-
hatch env use team-standard-2024q4
230+
hatch env use team_standard_2024q4
233231
hatch mcp configure team-server \
234232
--host claude-desktop \
235233
--command python \

0 commit comments

Comments
 (0)