systemprompt-cli 0.21.1

Unified CLI for systemprompt.io AI governance: agent orchestration, MCP governance, analytics, profiles, cloud deploy, and self-hosted operations.
Documentation
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
<div align="center">

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://systemprompt.io/files/images/logo.svg">
  <source media="(prefers-color-scheme: light)" srcset="https://systemprompt.io/files/images/logo-dark.svg">
  <img src="https://systemprompt.io/files/images/logo.svg" alt="systemprompt.io" width="180">
</picture>

### Production infrastructure for AI agents

[**Website**](https://systemprompt.io) · [**Documentation**](https://systemprompt.io/documentation/) · [**Guides**](https://systemprompt.io/guides) · [**Core**](https://github.com/systempromptio/systemprompt-core) · [**CLI Reference**](https://github.com/systempromptio/systemprompt-core/tree/main/crates/entry/cli) · [**Discord**](https://discord.gg/wkAbSuPWpr)

</div>

---


# MCP CLI Commands

Every MCP tool call goes through one audited path you own. These commands list, inspect, validate, and invoke the Model Context Protocol servers configured on your instance. All of them run non-interactively for automation.

---

## Prerequisites

```bash
export SYSTEMPROMPT_PROFILE=~/.systemprompt/profiles/local/profile.yaml
cd /var/www/html/systemprompt-core
cargo build --package systemprompt-cli

alias sp="./target/debug/systemprompt --non-interactive"
```

---

## Command Reference

| Command | Description | Artifact Type | Requires Services |
|---------|-------------|---------------|-------------------|
| `plugins mcp list` | List configured MCP servers | `Table` | No |
| `plugins mcp status` | Show MCP server runtime status | `Table` | Yes |
| `plugins mcp validate [name]` | Validate MCP server configurations | `Card` | Yes |
| `plugins mcp validate --all` | Validate all configured servers | `Card` | Yes |
| `plugins mcp logs [name]` | Tail logs for an MCP server | `Text` | No |
| `plugins mcp list-packages` | List discovered MCP packages from the registry | `List` | Yes |
| `plugins mcp tools` | List tools exposed by enabled MCP servers | `Table` | Yes |
| `plugins mcp call <server> <tool>` | Invoke a tool on an MCP server | `Card` | Yes |

---

## Core Commands

### mcp list

List configured MCP servers from the services configuration, filterable by enabled or disabled state.

```bash
sp plugins mcp list
sp --json plugins mcp list
sp plugins mcp list --enabled
sp plugins mcp list --disabled
```

**Flags:**
| Flag | Description |
|------|-------------|
| `--enabled` | Show only enabled servers |
| `--disabled` | Show only disabled servers |

**Output Structure:**
```json
{
  "servers": [
    {
      "name": "filesystem",
      "display_name": "filesystem",
      "server_type": "internal",
      "port": 9001,
      "enabled": true,
      "status": "ready",
      "binary_debug": "/path/to/target/debug/mcp-filesystem",
      "binary_release": "/path/to/target/release/mcp-filesystem"
    }
  ]
}
```

**Status Values:**
- `ready` - Both debug and release binaries exist
- `debug-only` - Only debug binary exists
- `release-only` - Only release binary exists
- `not-built` - No binaries exist
- `disabled` - Server is disabled in configuration
- `remote` - External server, enabled
- `disabled` - External server, disabled

**Artifact Type:** `Table`
**Columns:** `name`, `server_type`, `port`, `enabled`, `status`, `endpoint`, `binary_debug`, `binary_release`

---

### mcp status

Report health and running state of configured MCP servers via the orchestrator.

```bash
sp plugins mcp status
sp --json plugins mcp status
sp plugins mcp status --detailed
sp plugins mcp status --server content-manager
```

**Flags:**
| Flag | Default | Description |
|------|---------|-------------|
| `--detailed`, `-d` | `false` | Show detailed output including binary paths |
| `--server` | All | Filter to a specific server by name |

**Output Structure:**
```json
{
  "servers": [
    {
      "name": "filesystem",
      "server_type": "internal",
      "port": 9001,
      "enabled": true,
      "running": true,
      "health": "healthy",
      "pid": 12345,
      "binary": "mcp-filesystem",
      "release_binary": "exists",
      "debug_binary": "exists"
    }
  ],
  "summary": {
    "total": 3,
    "enabled": 2,
    "running": 2
  }
}
```

**Artifact Type:** `Table`
**Columns:** `name`, `server_type`, `port`, `enabled`, `running`, `health`, `pid`, `endpoint`, `release_binary`, `debug_binary`

---

### mcp validate

Validate connectivity to one or all configured MCP servers with an authenticated handshake. Returns tools count, latency, and server info.

```bash
sp plugins mcp validate <server-name>
sp --json plugins mcp validate filesystem
sp plugins mcp validate database --timeout 30
sp plugins mcp validate --all
sp plugins mcp validate --all --timeout 5
```

**Arguments:**
| Argument | Required | Description |
|----------|----------|-------------|
| `<server>` | Yes* | MCP server name (*not required with `--all`, or in non-interactive mode where all servers are validated) |

**Flags:**
| Flag | Default | Description |
|------|---------|-------------|
| `--service <name>` | None | Alias for the positional MCP server name (conflicts with the positional) |
| `--all` | `false` | Validate all configured servers |
| `--timeout` | `10` | Connection timeout in seconds |

**Validation Checks:**
- Service is running (checked via database)
- Connection can be established
- MCP protocol handshake succeeds
- Tools are registered
- Latency measurement

**Output Structure (Single Server):**
```json
{
  "results": [
    {
      "server": "filesystem",
      "valid": true,
      "health_status": "healthy",
      "validation_type": "mcp_validated",
      "tools_count": 5,
      "latency_ms": 15,
      "server_info": {
        "name": "filesystem",
        "version": "1.0.0",
        "protocol_version": "2024-11-05"
      },
      "issues": [],
      "message": "MCP validated with 5 tools"
    }
  ],
  "summary": {
    "total": 1,
    "valid": 1,
    "invalid": 0,
    "healthy": 1,
    "unhealthy": 0
  }
}
```

**Health Status Values:**
- `healthy` - Connected and responsive
- `auth_required` - Port responding but OAuth needed
- `unhealthy` - Connection failed or timed out
- `stopped` - Service not running
- `not_found` - Server not in configuration

**Validation Type Values:**
- `mcp_validated` - Full MCP handshake succeeded
- `not_running` - Service is not running
- `timeout` - Connection timed out
- `connection_error` - Failed to connect
- `config_error` - Server not in configuration
- `database_error` - Failed to read service status

**Artifact Type:** `Card`

---

### mcp logs

Tail logs for an MCP server, read from the database by default and falling back to disk files.

```bash
sp plugins mcp logs <server-name>
sp plugins mcp logs filesystem
sp plugins mcp logs filesystem --lines 100
sp plugins mcp logs filesystem --follow
sp plugins mcp logs filesystem --level error
sp plugins mcp logs filesystem --disk
sp plugins mcp logs --logs-dir /custom/path
```

**Arguments:**
| Argument | Required | Description |
|----------|----------|-------------|
| `<server>` | No | MCP server name (shows all MCP logs if not specified) |

**Flags:**
| Flag | Default | Description |
|------|---------|-------------|
| `--lines`, `-n`, `--tail` | `50` | Number of lines to show |
| `--follow`, `-f` | `false` | Follow log output continuously (disk only) |
| `--disk` | `false` | Force reading from disk files instead of database |
| `--logs-dir` | Profile path | Custom logs directory path |
| `--level` | All | Filter by log level: `debug`, `info`, `warn`, `error` |

**Log Level Filtering:**
- `debug` - Show all log levels
- `info` - Show INFO, WARN, ERROR (exclude DEBUG)
- `warn` - Show WARN and ERROR only
- `error` - Show ERROR only

**Output Structure:**
```json
{
  "service": "filesystem",
  "source": "database",
  "logs": [
    "2024-01-15 10:30:00 INFO [mcp-filesystem] Server started on port 9001",
    "2024-01-15 10:30:01 INFO [mcp-filesystem] Registered 5 tools"
  ],
  "log_files": []
}
```

**Artifact Type:** `Text`

---

### mcp list-packages

List discovered MCP package names from the registry, for use in build commands.

```bash
sp plugins mcp list-packages
sp --json plugins mcp list-packages
sp plugins mcp list-packages --raw
```

**Flags:**
| Flag | Description |
|------|-------------|
| `--raw` | Output as a space-separated string in the `raw_packages` field |

**Output Structure:**
```json
{
  "packages": [
    "mcp-filesystem",
    "mcp-database",
    "mcp-search"
  ]
}
```

**Output Structure (with --raw):**
```json
{
  "packages": [
    "mcp-filesystem",
    "mcp-database"
  ],
  "raw_packages": "mcp-filesystem mcp-database"
}
```

**Artifact Type:** `List` (or `CopyPasteText` with `--raw`)

---

### mcp tools

List tools advertised by running MCP servers, optionally with full schemas.

```bash
sp plugins mcp tools
sp --json plugins mcp tools
sp plugins mcp tools --server filesystem
sp plugins mcp tools --detailed
sp plugins mcp tools --schema
sp plugins mcp tools --timeout 60
```

**Flags:**
| Flag | Default | Description |
|------|---------|-------------|
| `--server`, `-s` | All running | Filter to a specific MCP server |
| `--detailed` | `false` | Show full input/output schemas in JSON output |
| `--schema` | `false` | Display parameter schemas in a readable format |
| `--timeout` | `30` | Timeout in seconds |

**Output Structure:**
```json
{
  "tools": [
    {
      "name": "read_file",
      "server": "filesystem",
      "description": "Read the contents of a file",
      "parameters_count": 1
    }
  ],
  "summary": {
    "total_tools": 5,
    "servers_queried": 1
  }
}
```

**Artifact Type:** `Table`
**Columns:** `name`, `server`, `description`, `parameters_count`

---

### mcp call

Invoke a named tool on a running MCP server with JSON arguments and render the result.

```bash
sp plugins mcp call <server> <tool>
sp plugins mcp call systemprompt systemprompt --args '{"command":"core skills list"}'
sp plugins mcp call filesystem read_file -a '{"path":"/etc/hosts"}'
sp plugins mcp call database query --args '{"sql":"SELECT 1"}' --timeout 60
```

**Arguments:**
| Argument | Required | Description |
|----------|----------|-------------|
| `<server>` | Yes (non-interactive) | MCP server name |
| `<tool>` | Yes (non-interactive) | Tool name to execute |

**Flags:**
| Flag | Default | Description |
|------|---------|-------------|
| `--args`, `-a` | None | Tool arguments as a JSON string |
| `--timeout` | `30` | Timeout in seconds |

**Output Structure:**
```json
{
  "server": "filesystem",
  "tool": "read_file",
  "success": true,
  "content": [
    {
      "kind": "text",
      "text": "file contents here"
    }
  ],
  "execution_time_ms": 42
}
```

**Artifact Type:** `Card`

---

## Complete MCP Management Flow Example

This flow demonstrates MCP server management:

```bash
# Phase 1: List configured servers
sp --json plugins mcp list

# Phase 2: Check build status
sp --json plugins mcp list-packages
sp build mcp --release

# Phase 3: Check running status
sp --json plugins mcp status
sp --json plugins mcp status --server filesystem

# Phase 4: Validate a specific server with timeout
sp --json plugins mcp validate filesystem --timeout 30

# Phase 5: Validate all servers
sp --json plugins mcp validate --all

# Phase 6: Inspect the tools a server exposes
sp --json plugins mcp tools --server filesystem

# Phase 7: Invoke a tool
sp --json plugins mcp call filesystem read_file -a '{"path":"/etc/hosts"}'

# Phase 8: Check logs with level filtering
sp plugins mcp logs filesystem --lines 20 --level error

# Phase 9: Follow logs in real-time
sp plugins mcp logs filesystem --follow
```

---

## MCP Server Configuration

MCP servers are configured in the services configuration:

```yaml
# services.yaml
mcp_servers:
  filesystem:
    enabled: true
    port: 9001
    command: "./target/debug/mcp-filesystem"
    binary: "mcp-filesystem"
    transport: stdio
    args: []
    env: {}
    oauth:
      required: false

  database:
    enabled: true
    port: 9002
    command: "./target/debug/mcp-database"
    binary: "mcp-database"
    transport: stdio
    args: []
    env:
      DATABASE_URL: "${DATABASE_URL}"
    oauth:
      required: true
```

---

## Troubleshooting MCP Servers

### Server Not Starting

```bash
# Check whether the binary exists
sp --json plugins mcp status --server filesystem
# Look for a null debug/release binary or a not-built status

# Build the server
sp build mcp --server filesystem

# Re-check status
sp --json plugins mcp status --server filesystem
```

### Connection Issues

```bash
# Validate connection with an extended timeout
sp plugins mcp validate filesystem --timeout 30

# Check the validation type in the response
sp --json plugins mcp validate filesystem | jq '.results[0].validation_type'

# Check logs for errors
sp plugins mcp logs filesystem --level error --lines 100
```

### Tool Registration Issues

```bash
# Validate and check the tools count
sp --json plugins mcp validate filesystem | jq '.results[0].tools_count'

# List the tools directly
sp --json plugins mcp tools --server filesystem | jq '.tools[].name'
```

### Batch Validation

```bash
# Validate all servers at once
sp --json plugins mcp validate --all

# Check the summary
sp --json plugins mcp validate --all | jq '.summary'

# Find unhealthy servers
sp --json plugins mcp validate --all | jq '.results[] | select(.health_status != "healthy")'
```

---

## Error Handling

### Server Not Found

```bash
sp plugins mcp validate nonexistent
# Error: MCP server 'nonexistent' not found

sp plugins mcp call nonexistent sometool
# Error: MCP server 'nonexistent' not found in configuration
```

### Service Not Running

```bash
sp plugins mcp validate filesystem
# Returns: health_status: "stopped", validation_type: "not_running"

sp plugins mcp call filesystem read_file
# Error: MCP server 'filesystem' is not running
```

### Connection Timeout

```bash
sp plugins mcp validate filesystem --timeout 5
# Returns: health_status: "unhealthy", validation_type: "timeout"
```

### Non-Interactive Mode

```bash
# validate with no server name validates all configured servers
sp --non-interactive plugins mcp validate

# call requires an explicit server and tool
sp --non-interactive plugins mcp call filesystem read_file -a '{"path":"/etc/hosts"}'
```

---

## JSON Output

All commands support the `--json` flag for structured output:

```bash
# Verify JSON is valid
sp --json plugins mcp list | jq .

# Extract specific fields
sp --json plugins mcp list | jq '.servers[].name'
sp --json plugins mcp status | jq '.servers[] | select(.running == true)'
sp --json plugins mcp validate --all | jq '.results[] | select(.valid == false)'
sp --json plugins mcp list-packages | jq '.packages[]'
sp --json plugins mcp tools | jq '.tools[] | {name, server}'

# Check summaries
sp --json plugins mcp status | jq '.summary'
sp --json plugins mcp validate --all | jq '.summary'

# Get the raw package list for shell scripts
sp --json plugins mcp list-packages --raw | jq -r '.raw_packages'
```

---

## Integration with Services

MCP servers are started automatically with services:

```bash
# Start all services including MCP
sp infra services start

# Start only MCP servers
sp infra services start --mcp

# Stop MCP servers
sp infra services stop --mcp
```

---

<div align="center">

**[systemprompt.io](https://systemprompt.io)** · **[Documentation](https://systemprompt.io/documentation/)** · **[Guides](https://systemprompt.io/guides)** · **[Live Demo](https://systemprompt.io/features/demo)** · **[Template](https://github.com/systempromptio/systemprompt-template)** · **[Discord](https://discord.gg/wkAbSuPWpr)**

<sub>CLI reference · Own how your organization uses AI.</sub>

</div>