-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathllm.txt
More file actions
988 lines (637 loc) · 24 KB
/
Copy pathllm.txt
File metadata and controls
988 lines (637 loc) · 24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
# MCPM (Model Context Protocol Manager) - AI Agent Guide
Generated: 2025-09-18 03:08:35 UTC
Version: 2.8.1
## Overview
MCPM is a command-line tool for managing Model Context Protocol (MCP) servers. This guide is specifically designed for AI agents to understand how to interact with MCPM programmatically.
## Key Concepts
- **Servers**: MCP servers that provide tools, resources, and prompts to AI assistants
- **Profiles**: Named groups of servers that can be run together
- **Clients**: Applications that connect to MCP servers (Claude Desktop, Cursor, etc.)
## Environment Variables for AI Agents
```bash
# Force non-interactive mode (no prompts)
export MCPM_NON_INTERACTIVE=true
# Skip all confirmations
export MCPM_FORCE=true
# Output in JSON format (where supported)
export MCPM_JSON_OUTPUT=true
# Server-specific environment variables
export MCPM_SERVER_MYSERVER_API_KEY=secret
export MCPM_ARG_API_KEY=secret # Generic for all servers
```
## Command Reference
## mcpm client
Manage MCP client configurations (Claude Desktop, Cursor, Windsurf, etc.).
MCP clients are applications that can connect to MCP servers. This command helps you
view installed clients, edit their configurations to enable/disable MCPM servers,
and import existing server configurations into MCPM's global configuration.
Supported clients: Claude Desktop, Cursor, Windsurf, Continue, Zed, and more.
Examples:
mcpm client ls # List all supported MCP clients and their status
mcpm client edit cursor # Interactive server selection for Cursor
mcpm client edit claude-desktop # Interactive server selection for Claude Desktop
mcpm client edit cursor -e # Open Cursor config in external editor
mcpm client import cursor # Import server configurations from Cursor
### mcpm client ls
List all supported MCP clients and their enabled MCPM servers.
**Parameters:**
- `--verbose`, `-v`: Show detailed server information (flag)
**Examples:**
```bash
# Basic usage
mcpm client ls <arguments>
```
### mcpm client edit
Enable/disable MCPM-managed servers in the specified client configuration.
Interactive by default, or use CLI parameters for automation.
Use -e to open config in external editor. Use --add/--remove for incremental changes.
CLIENT_NAME is the name of the MCP client to configure (e.g., cursor, claude-desktop, windsurf).
**Parameters:**
- `client_name` (REQUIRED):
- `-e`, `--external`: Open config file in external editor instead of interactive mode (flag)
- `-f`, `--file`: Specify a custom path to the client's config file.
- `--add-server`: Comma-separated list of server names to add
- `--remove-server`: Comma-separated list of server names to remove
- `--set-servers`: Comma-separated list of server names to set (replaces all)
- `--add-profile`: Comma-separated list of profile names to add
- `--remove-profile`: Comma-separated list of profile names to remove
- `--set-profiles`: Comma-separated list of profile names to set (replaces all)
- `--force`: Skip confirmation prompts (flag)
**Examples:**
```bash
# Add server to client
mcpm client edit cursor --add-server sqlite
# Add profile to client
mcpm client edit cursor --add-profile web-dev
# Set all servers for client
mcpm client edit claude-desktop --set-servers "sqlite,filesystem"
# Remove profile from client
mcpm client edit cursor --remove-profile old-profile
```
### mcpm client import
Import and manage MCP server configurations from a client.
This command imports server configurations from a supported MCP client,
shows non-MCPM servers as a selection list, and offers to create profiles
and replace client config with MCPM managed servers.
CLIENT_NAME is the name of the MCP client to import from (e.g., cursor, claude-desktop, windsurf).
**Parameters:**
- `client_name` (REQUIRED):
**Examples:**
```bash
# Basic usage
mcpm client import <arguments>
```
## mcpm config
Manage MCPM configuration.
Commands for managing MCPM configuration and cache.
**Parameters:**
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm config <arguments>
```
### mcpm config set
Set MCPM configuration.
Interactive by default, or use CLI parameters for automation.
Use --key and --value to set configuration non-interactively.
Examples:
mcpm config set # Interactive mode
mcpm config set --key node_executable --value npx # Non-interactive mode
**Parameters:**
- `--key`: Configuration key to set
- `--value`: Configuration value to set
- `--force`: Skip confirmation prompts (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm config set <arguments>
```
### mcpm config ls
List all MCPM configuration settings.
Example:
mcpm config ls
**Parameters:**
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm config ls <arguments>
```
### mcpm config unset
Remove a configuration setting.
Example:
mcpm config unset node_executable
**Parameters:**
- `name` (REQUIRED):
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm config unset <arguments>
```
### mcpm config clear-cache
Clear the local repository cache.
Removes the cached server information, forcing a fresh download on next search.
Examples:
mcpm config clear-cache # Clear the local repository cache
**Parameters:**
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm config clear-cache <arguments>
```
## mcpm doctor
Check system health and installed server status.
Performs comprehensive diagnostics of MCPM installation, configuration,
and installed servers.
Examples:
mcpm doctor # Run complete system health check
**Parameters:**
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm doctor <arguments>
```
## mcpm edit
Edit a server configuration.
Interactive by default, or use CLI parameters for automation.
Use -e to open config in external editor, -N to create new server.
**Parameters:**
- `server_name` (OPTIONAL):
- `-N`, `--new`: Create a new server configuration (flag)
- `-e`, `--editor`: Open global config in external editor (flag)
- `--name`: Update server name
- `--command`: Update command (for stdio servers)
- `--args`: Update command arguments (space-separated)
- `--env`: Update environment variables (KEY1=value1,KEY2=value2)
- `--url`: Update server URL (for remote servers)
- `--headers`: Update HTTP headers (KEY1=value1,KEY2=value2)
- `--force`: Skip confirmation prompts (flag)
**Examples:**
```bash
# Update server name
mcpm edit myserver --name "new-name"
# Update command and arguments
mcpm edit myserver --command "python -m updated_server" --args "--port 8080"
# Update environment variables
mcpm edit myserver --env "API_KEY=new-secret,DEBUG=true"
```
## mcpm info
Display detailed information about a specific MCP server.
Provides comprehensive details about a single MCP server, including installation instructions,
dependencies, environment variables, and examples.
Examples:
mcpm info github # Show details for the GitHub server
mcpm info pinecone # Show details for the Pinecone server
**Parameters:**
- `server_name` (REQUIRED):
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm info <arguments>
```
## mcpm inspect
Launch MCP Inspector to test and debug a server from global configuration.
If SERVER_NAME is provided, finds the specified server in the global configuration
and launches the MCP Inspector with the correct configuration to connect to and test the server.
If no SERVER_NAME is provided, launches the raw MCP Inspector for manual configuration.
Examples:
mcpm inspect # Launch raw inspector (manual setup)
mcpm inspect mcp-server-browse # Inspect the browse server
mcpm inspect filesystem # Inspect filesystem server
mcpm inspect time # Inspect the time server
**Parameters:**
- `server_name` (OPTIONAL):
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm inspect <arguments>
```
## mcpm install
Install an MCP server to the global configuration.
Installs servers to the global MCPM configuration where they can be
used across all MCP clients and organized into profiles.
Examples:
mcpm install time
mcpm install everything --force
mcpm install youtube --alias yt
**Parameters:**
- `server_name` (REQUIRED):
- `--force`: Force reinstall if server is already installed (flag)
- `--alias`: Alias for the server
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Install a server
mcpm install sqlite
# Install with environment variables
ANTHROPIC_API_KEY=sk-ant-... mcpm install claude
# Force installation
mcpm install filesystem --force
```
## mcpm list
List all installed MCP servers from global configuration.
Examples:
mcpm ls # List server names and profiles
mcpm ls -v # List servers with detailed configuration
mcpm profile ls # List profiles and their included servers
**Parameters:**
- `--verbose`, `-v`: Show detailed server configuration (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm list <arguments>
```
## mcpm migrate
Migrate v1 configuration to v2.
This command helps you migrate from MCPM v1 to v2, converting your
profiles, servers, and configuration to the new simplified format.
Examples:
mcpm migrate # Check for v1 config and migrate if found
mcpm migrate --force # Force migration check
**Parameters:**
- `--force`: Force migration even if v1 config not detected (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm migrate <arguments>
```
## mcpm new
Create a new server configuration.
Interactive by default, or use CLI parameters for automation.
Set MCPM_NON_INTERACTIVE=true to disable prompts.
**Parameters:**
- `server_name` (OPTIONAL):
- `--type`: Server type
- `--command`: Command to execute (required for stdio servers)
- `--args`: Command arguments (space-separated)
- `--env`: Environment variables (KEY1=value1,KEY2=value2)
- `--url`: Server URL (required for remote servers)
- `--headers`: HTTP headers (KEY1=value1,KEY2=value2)
- `--force`: Skip confirmation prompts (flag)
**Examples:**
```bash
# Create a stdio server
mcpm new myserver --type stdio --command "python -m myserver"
# Create a remote server
mcpm new apiserver --type remote --url "https://api.example.com"
# Create server with environment variables
mcpm new myserver --type stdio --command "python server.py" --env "API_KEY=secret,PORT=8080"
```
## mcpm profile
Manage MCPM profiles - collections of servers for different workflows.
Profiles are named groups of MCP servers that work together for specific tasks or
projects. They allow you to organize servers by purpose (e.g., 'web-dev', 'data-analysis')
and run multiple related servers simultaneously through FastMCP proxy aggregation.
Examples: 'frontend' profile with browser + github servers, 'research' with filesystem + web tools.
**Parameters:**
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm profile <arguments>
```
### mcpm profile ls
List all MCPM profiles.
**Parameters:**
- `--verbose`, `-v`: Show detailed server information (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm profile ls <arguments>
```
### mcpm profile create
Create a new MCPM profile.
**Parameters:**
- `profile` (REQUIRED):
- `--force`: Force add even if profile already exists (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm profile create <arguments>
```
### mcpm profile edit
Edit a profile's name and server selection.
Interactive by default, or use CLI parameters for automation.
Use --add-server/--remove-server for incremental changes.
**Parameters:**
- `profile_name` (REQUIRED):
- `--name`: New profile name
- `--servers`: Comma-separated list of server names to include (replaces all)
- `--add-server`: Comma-separated list of server names to add
- `--remove-server`: Comma-separated list of server names to remove
- `--set-servers`: Comma-separated list of server names to set (alias for --servers)
- `--force`: Skip confirmation prompts (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Add server to profile
mcpm profile edit web-dev --add-server sqlite
# Remove server from profile
mcpm profile edit web-dev --remove-server old-server
# Set profile servers (replaces all)
mcpm profile edit web-dev --set-servers "sqlite,filesystem,git"
# Rename profile
mcpm profile edit old-name --name new-name
```
### mcpm profile inspect
Launch MCP Inspector to test and debug servers in a profile.
Creates a FastMCP proxy that aggregates servers and launches the Inspector.
Use --port, --http, --sse to customize transport options.
**Parameters:**
- `profile_name` (REQUIRED):
- `--server`: Inspect only specific servers (comma-separated)
- `--port`: Port for the FastMCP proxy server
- `--host`: Host for the FastMCP proxy server
- `--http`: Use HTTP transport instead of stdio (flag)
- `--sse`: Use SSE transport instead of stdio (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm profile inspect <arguments>
```
### mcpm profile share
Create a secure public tunnel to all servers in a profile.
This command runs all servers in a profile and creates a shared tunnel
to make them accessible remotely. Each server gets its own endpoint.
Examples:
mcpm profile share web-dev # Share all servers in web-dev profile
mcpm profile share ai --port 5000 # Share ai profile on specific port
**Parameters:**
- `profile_name` (REQUIRED):
- `--port`: Port for the SSE server (random if not specified)
- `--address`: Remote address for tunnel, use share.mcpm.sh if not specified
- `--http`: Use HTTP instead of HTTPS. NOT recommended to use on public networks. (flag)
- `--no-auth`: Disable authentication for the shared profile. (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm profile share <arguments>
```
### mcpm profile rm
Remove a profile.
Deletes the specified profile and all its server associations.
The servers themselves remain in the global configuration.
Examples:
\b
mcpm profile rm old-profile # Remove with confirmation
mcpm profile rm old-profile --force # Remove without confirmation
**Parameters:**
- `profile_name` (REQUIRED):
- `--force`, `-f`: Force removal without confirmation (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm profile rm <arguments>
```
### mcpm profile run
Execute all servers in a profile over stdio, HTTP, or SSE.
Uses FastMCP proxy to aggregate servers into a unified MCP interface
with proper capability namespacing. By default runs over stdio.
Examples:
mcpm profile run web-dev # Run over stdio (default)
mcpm profile run --http web-dev # Run over HTTP on 127.0.0.1:6276
mcpm profile run --sse web-dev # Run over SSE on 127.0.0.1:6276
mcpm profile run --http --port 9000 ai # Run over HTTP on 127.0.0.1:9000
mcpm profile run --sse --port 9000 ai # Run over SSE on 127.0.0.1:9000
mcpm profile run --http --host 0.0.0.0 web-dev # Run over HTTP on 0.0.0.0:6276
Debug logging: Set MCPM_DEBUG=1 for verbose output
**Parameters:**
- `profile_name` (REQUIRED):
- `--http`: Run profile over HTTP instead of stdio (flag)
- `--sse`: Run profile over SSE instead of stdio (flag)
- `--port`: Port for HTTP / SSE mode (default: 6276) (default: 6276)
- `--host`: Host address for HTTP / SSE mode (default: 127.0.0.1) (default: 127.0.0.1)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Run all servers in a profile
mcpm profile run web-dev
# Run profile with custom port
mcpm profile run web-dev --port 8080 --http
```
## mcpm run
Execute an installed MCP server in stdio (default), HTTP, or SSE mode.
By default, servers run over **stdio** for direct client communication.
**Examples:**
STDIO Mode (default):
mcpm run server-name
HTTP Mode:
mcpm run --http server-name
mcpm run --http --port 9000 server-name
mcpm run --http --host 0.0.0.0 server-name
SSE Mode:
mcpm run --sse server-name
mcpm run --sse --port 9000 server-name
mcpm run --sse --host 0.0.0.0 server-name
Client Config Example:
{"command": ["mcpm", "run", "mcp-server-browse"]}
**Tips:**
• Port defaults to **6276**, auto-finds if busy
• Host defaults to **127.0.0.1**
• Use `mcpm ls` to see installed servers
**Parameters:**
- `server_name` (REQUIRED):
- `--http`: Run server in HTTP mode (mutually exclusive with --sse) (flag)
- `--sse`: Run server in SSE mode (mutually exclusive with --http) (flag)
- `--port`: Port for HTTP/SSE mode (default: 6276, auto-finds available) (default: 6276)
- `--host`: Host for HTTP/SSE mode (use 0.0.0.0 for all interfaces) (default: 127.0.0.1)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Run a server
mcpm run sqlite
# Run with HTTP transport
mcpm run myserver --http --port 8080
```
## mcpm search
Search available MCP servers.
Searches the MCP registry for available servers. Without arguments, lists all available servers.
By default, only shows server names. Use --table for more details.
Examples:
mcpm search # List all available servers (names only)
mcpm search github # Search for github server
mcpm search --table # Show results in a table with descriptions
**Parameters:**
- `query` (OPTIONAL):
- `--table`: Display results in table format with descriptions (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm search <arguments>
```
## mcpm share
Share a server from global configuration through a tunnel.
This command finds an installed server in the global configuration,
uses FastMCP proxy to expose it as an HTTP server, then creates a tunnel
to make it accessible remotely.
SERVER_NAME is the name of an installed server from your global configuration.
Examples:
mcpm share time # Share the time server
mcpm share mcp-server-browse # Share the browse server
mcpm share filesystem --port 5000 # Share filesystem server on specific port
mcpm share sqlite --retry 3 # Share with auto-retry on errors
**Parameters:**
- `server_name` (REQUIRED):
- `--port`: Port for the SSE server (random if not specified)
- `--address`: Remote address for tunnel, use share.mcpm.sh if not specified
- `--http`: Use HTTP instead of HTTPS. NOT recommended to use on public networks. (flag)
- `--timeout`: Timeout in seconds to wait for server requests before considering the server inactive (default: 30)
- `--retry`: Number of times to automatically retry on error (default: 0) (default: 0)
- `--no-auth`: Disable authentication for the shared server. (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm share <arguments>
```
## mcpm uninstall
Remove an installed MCP server from global configuration.
Removes servers from the global MCPM configuration and clears
any profile tags associated with the server.
Examples:
mcpm uninstall filesystem
mcpm uninstall filesystem --force
**Parameters:**
- `server_name` (REQUIRED):
- `--force`, `-f`: Force removal without confirmation (flag)
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm uninstall <arguments>
```
## mcpm usage
Display comprehensive analytics and usage data.
Shows detailed usage statistics including run counts, session data,
performance metrics, and activity patterns for servers and profiles.
Data is stored in SQLite for efficient querying and analysis.
Examples:
mcpm usage # Show all usage for last 30 days
mcpm usage --days 7 # Show usage for last 7 days
mcpm usage --server browse # Show usage for specific server
mcpm usage --profile web-dev # Show usage for specific profile
**Parameters:**
- `--days`, `-d`: Show usage for last N days (default: 30)
- `--server`, `-s`: Show usage for specific server
- `--profile`, `-p`: Show usage for specific profile
- `-h`, `--help`: Show this message and exit. (flag)
**Examples:**
```bash
# Basic usage
mcpm usage <arguments>
```
## Best Practices for AI Agents
### 1. Always Use Non-Interactive Mode
```bash
export MCPM_NON_INTERACTIVE=true
export MCPM_FORCE=true
```
### 2. Error Handling
- Check exit codes: 0 = success, 1 = error, 2 = validation error
- Parse error messages from stderr
- Implement retry logic for transient failures
### 3. Server Management Workflow
```bash
# 1. Search for available servers
mcpm search sqlite
# 2. Get server information
mcpm info sqlite
# 3. Install server
mcpm install sqlite --force
# 4. Create custom server if needed
mcpm new custom-db --type stdio --command "python db_server.py" --force
# 5. Run server
mcpm run sqlite
```
### 4. Profile Management Workflow
```bash
# 1. Create profile
mcpm profile create web-stack --force
# 2. Add servers to profile
mcpm profile edit web-stack --add-server sqlite,filesystem
# 3. Run all servers in profile
mcpm profile run web-stack
```
### 5. Client Configuration Workflow
```bash
# 1. List available clients
mcpm client ls
# 2. Configure client with servers
mcpm client edit cursor --add-server sqlite --add-profile web-stack
# 3. Import existing client configuration
mcpm client import cursor --all
```
## Common Patterns
### Batch Operations
```bash
# Add multiple servers at once
mcpm profile edit myprofile --add-server "server1,server2,server3"
# Remove multiple servers
mcpm client edit cursor --remove-server "old1,old2"
```
### Using Environment Variables for Secrets
```bash
# Set API keys via environment
export ANTHROPIC_API_KEY=sk-ant-...
export OPENAI_API_KEY=sk-...
# Install servers that will use these keys
mcpm install claude --force
mcpm install openai --force
```
### Automation-Friendly Commands
```bash
# List all servers in machine-readable format
mcpm ls --json
# Get detailed server information
mcpm info myserver --json
# Check system health
mcpm doctor
```
## Exit Codes
- `0`: Success
- `1`: General error
- `2`: Validation error (invalid parameters)
- `130`: Interrupted by user (Ctrl+C)
## Notes for AI Implementation
1. **Always specify all required parameters** - Never rely on interactive prompts
2. **Use --force flag** to skip confirmations in automation
3. **Parse JSON output** when available for structured data
4. **Set environment variables** before running commands that need secrets
5. **Check server compatibility** with `mcpm info` before installation
6. **Use profiles** for managing groups of related servers
7. **Validate operations** succeeded by checking exit codes and output
## Troubleshooting
- If a command hangs, ensure `MCPM_NON_INTERACTIVE=true` is set
- For permission errors, check file system permissions on config directories
- For server failures, check logs with `mcpm run <server> --verbose`
- Use `mcpm doctor` to diagnose system issues