Skip to content

Commit b04272f

Browse files
Update mcp_filesystem demo
V2.37
1 parent 876dd79 commit b04272f

4 files changed

Lines changed: 67 additions & 1 deletion

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,24 @@ Example entry points you may want to run afterwards:
231231
.\build\mcp_filesystem_demo.exe
232232
```
233233

234+
Linux/macOS equivalents:
235+
236+
```bash
237+
./build/func_registry_demo
238+
./build/json_invoke_demo
239+
./build/json_stateful_demo
240+
./build/json_tracing_demo
241+
./build/trace_recorder_demo
242+
./build/task_scheduler_demo
243+
./build/mcp_filesystem_demo
244+
```
245+
246+
Cross-platform smoke test for the MCP filesystem demo:
247+
248+
```bash
249+
pwsh -File ./examples/mcp_filesystem/mcp_filesystem_smoke.ps1
250+
```
251+
234252
The initial configure step downloads `nlohmann/json` into `build/_deps/` through `FetchContent`. The HTTP gateway demo downloads `cpp-httplib` only when `LLM_INVOKE_CPP_BUILD_MCP_HTTP_DEMO` is enabled.
235253

236254
GitHub Actions runs a Windows and Linux matrix for pushes and pull requests, covering configure/build/test plus smoke runs for the main non-server demos. The default CI path disables the HTTP gateway demo so the primary pipeline does not depend on downloading `cpp-httplib` during configure.

examples/mcp_filesystem/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,31 @@ From the repository root:
2424
.\build\mcp_filesystem_demo.exe
2525
```
2626

27+
Linux/macOS:
28+
29+
```bash
30+
./build/mcp_filesystem_demo
31+
```
32+
2733
Quick smoke test (recommended):
2834

35+
```powershell
36+
pwsh -File .\examples\mcp_filesystem\mcp_filesystem_smoke.ps1
37+
```
38+
39+
On Windows, prefer `pwsh` (PowerShell 7+) for the same command surface as Linux/macOS.
40+
If `pwsh` is not installed, this script also runs with Windows PowerShell 5.1:
41+
2942
```powershell
3043
powershell -ExecutionPolicy Bypass -File .\examples\mcp_filesystem\mcp_filesystem_smoke.ps1
3144
```
3245

46+
Linux/macOS:
47+
48+
```bash
49+
pwsh -File ./examples/mcp_filesystem/mcp_filesystem_smoke.ps1
50+
```
51+
3352
This script launches the demo, performs MCP initialize and tools/list, and prints PASS/FAIL.
3453

3554
When startup succeeds, the server writes this readiness line to stderr:

examples/mcp_filesystem/mcp_filesystem_smoke.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
param(
2-
[string]$ExePath = ".\build\mcp_filesystem_demo.exe"
2+
[string]$ExePath
33
)
44

55
Set-StrictMode -Version Latest
66
$ErrorActionPreference = "Stop"
77

8+
if ([string]::IsNullOrWhiteSpace($ExePath)) {
9+
# Windows PowerShell 5.1 does not define $IsWindows/$IsLinux/$IsMacOS.
10+
$isWindowsPlatform = $true
11+
$isWindowsVar = Get-Variable -Name IsWindows -ErrorAction SilentlyContinue
12+
if ($null -ne $isWindowsVar) {
13+
$isWindowsPlatform = [bool]$isWindowsVar.Value
14+
}
15+
$exeName = if ($isWindowsPlatform) { "mcp_filesystem_demo.exe" } else { "mcp_filesystem_demo" }
16+
$ExePath = Join-Path (Join-Path "." "build") $exeName
17+
}
18+
819
# ── display helpers ───────────────────────────────────────────────────────────
920

1021
function Write-Header([string]$Title) {

examples/mcp_http/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,24 @@ cmake --build build --target mcp_http_gateway_demo mcp_filesystem_demo
1919
.\build\mcp_http_gateway_demo.exe --host 127.0.0.1 --port 18084 --backend-executable .\build\mcp_filesystem_demo.exe
2020
```
2121

22+
Linux/macOS:
23+
24+
```bash
25+
./build/mcp_http_gateway_demo --host 127.0.0.1 --port 18084 --backend-executable ./build/mcp_filesystem_demo
26+
```
27+
2228
## Run The Python Client
2329

2430
```powershell
2531
python .\examples\mcp_http\mcp_http_client_demo.py --base-url http://127.0.0.1:18084
2632
```
2733

34+
Linux/macOS:
35+
36+
```bash
37+
python3 ./examples/mcp_http/mcp_http_client_demo.py --base-url http://127.0.0.1:18084
38+
```
39+
2840
The client will:
2941

3042
1. POST `initialize` to `/mcp`
@@ -42,6 +54,12 @@ Set `DEEPSEEK_API_KEY` in your environment first, then run:
4254
python .\examples\mcp_http\run_deepseek_mcp_http_chat.py --base-url http://127.0.0.1:18084 --prompt "List the files in the examples directory and tell me what you find."
4355
```
4456

57+
Linux/macOS:
58+
59+
```bash
60+
python3 ./examples/mcp_http/run_deepseek_mcp_http_chat.py --base-url http://127.0.0.1:18084 --prompt "List the files in the examples directory and tell me what you find."
61+
```
62+
4563
## Notes
4664

4765
- This path is MCP over HTTP, not stdio.

0 commit comments

Comments
 (0)