Skip to content

Commit 2925f22

Browse files
authored
Linux-mcp-server quickstart for showcasing stdio server (#5)
* feat(doc) linux-mcp-server quickstart for showcasing stdio server Signed-off-by: Matthias Wessendorf <[email protected]> * Renaming folders, giving them numbers Signed-off-by: Matthias Wessendorf <[email protected]> --------- Signed-off-by: Matthias Wessendorf <[email protected]>
1 parent 72b9fe4 commit 2925f22

26 files changed

Lines changed: 373 additions & 2 deletions
File renamed without changes.

getting-started/evals/gevals-demo-server-test-out.json renamed to 01-getting-started/evals/gevals-demo-server-test-out.json

File renamed without changes.

getting-started/evals/mcpchecker-demo-server-test-out.json renamed to 01-getting-started/evals/mcpchecker-demo-server-test-out.json

File renamed without changes.

02-linux-mcp-server/README.md

Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
# Linux MCP Server Quickstart
2+
3+
> **Test your local system diagnostics MCP server with MCPChecker**
4+
5+
This quickstart demonstrates how to test a **stdio-based MCP server** that runs diagnostics on your local Linux system. Unlike HTTP-based servers, stdio servers communicate over standard input/output.
6+
7+
## What You'll Learn
8+
9+
- How to configure MCPChecker to test stdio/local MCP servers
10+
- How to write evals for system diagnostic tools
11+
- How natural language tasks test tool discoverability
12+
- Best practices for testing read-only diagnostic tools
13+
14+
## Why MCPChecker?
15+
16+
The Linux MCP Server provides many diagnostic tools. MCPChecker helps you verify that:
17+
18+
- **Tool names are discoverable** - Can agents find the right tool from natural language requests?
19+
- **Documentation is clear** - Do descriptions guide agents to use the correct tool?
20+
- **Tools work as expected** - Does the output match what you expect?
21+
22+
This is especially important for diagnostic tools where choosing the wrong tool could waste time or provide incorrect information.
23+
24+
## Prerequisites
25+
26+
### 1. Install Claude Code
27+
28+
Claude Code acts as the AI agent for testing:
29+
30+
```bash
31+
curl -fsSL https://anthropic.com/install-claude-code | sh
32+
```
33+
34+
For more installation options, see the [official installation guide](https://github.com/anthropics/claude-code).
35+
36+
### 2. Install MCPChecker
37+
38+
Download the latest release:
39+
40+
```bash
41+
# For Linux (adjust version as needed)
42+
curl -LO https://github.com/mcpchecker/mcpchecker/releases/download/v0.1.0/mcpchecker-linux-amd64
43+
chmod +x mcpchecker-linux-amd64
44+
sudo mv mcpchecker-linux-amd64 /usr/local/bin/mcpchecker
45+
```
46+
47+
### 3. Install Linux MCP Server
48+
49+
```bash
50+
pip install --user linux-mcp-server
51+
```
52+
53+
This installs the server to `~/.local/bin/linux-mcp-server`. Make sure `~/.local/bin` is in your PATH:
54+
55+
```bash
56+
# Add to your ~/.bashrc or ~/.zshrc if needed
57+
export PATH="$HOME/.local/bin:$PATH"
58+
59+
# Verify installation
60+
which linux-mcp-server
61+
```
62+
63+
For more installation options and documentation, see the [Linux MCP Server documentation](https://rhel-lightspeed.github.io/linux-mcp-server/).
64+
65+
### 4. Configure Judge LLM
66+
67+
MCPChecker uses an LLM to verify test results. Set these environment variables:
68+
69+
```bash
70+
export JUDGE_BASE_URL="https://api.openai.com/v1"
71+
export JUDGE_API_KEY="sk-your-key-here"
72+
export JUDGE_MODEL_NAME="gpt-4o-mini"
73+
```
74+
75+
**Why a judge LLM?** Testing AI agents requires flexible verification. Instead of exact string matching, we use an LLM to verify if the output is semantically correct.
76+
77+
For example, instead of checking for the exact string "Fedora Linux 43", the judge checks if the output "contains information about the operating system". This allows the test to pass even if the formatting varies, as long as the required information is present.
78+
79+
Each verification step includes a `reason` explaining what the judge is checking, which helps with debugging when tests fail.
80+
81+
## What Gets Tested
82+
83+
This quickstart tests two diagnostic tools from the Linux MCP Server:
84+
85+
### Tool 1: get_system_information
86+
```python
87+
@mcp.tool(
88+
title="Get system information",
89+
description="Get basic system information such as operating system, distribution, kernel version, uptime, and last boot time.",
90+
tags={"hardware", "system"},
91+
)
92+
async def get_system_information(host: Host = None) -> SystemInfo:
93+
"""Get basic system information.
94+
95+
Retrieves hostname, OS name/version, kernel version, architecture,
96+
system uptime, and last boot time.
97+
"""
98+
```
99+
100+
### Tool 2: get_disk_usage
101+
```python
102+
@mcp.tool(
103+
title="Get disk usage",
104+
description="Get detailed disk space information including size, mount points, and utilization.",
105+
tags={"disk", "filesystem", "storage", "system"},
106+
)
107+
async def get_disk_usage(host: Host = None) -> DiskUsage:
108+
"""Get disk usage information.
109+
110+
Retrieves filesystem usage for all mounted volumes including size,
111+
used/available space, utilization percentage, and mount points.
112+
"""
113+
```
114+
115+
## The Test Tasks
116+
117+
Both tools are tested with **natural language prompts** that don't mention specific tool names:
118+
119+
### Task 1: System Information (`evals/tasks/system-info.yaml`)
120+
121+
```yaml
122+
kind: Task
123+
apiVersion: mcpchecker/v1alpha2
124+
metadata:
125+
name: "system-info-test"
126+
difficulty: easy
127+
description: |
128+
Tests if the agent can discover the get_system_information tool from a natural
129+
language request for "basic information about this Linux system". The judge
130+
verifies that the output contains OS and kernel information as requested.
131+
spec:
132+
verify:
133+
- llmJudge:
134+
contains: "operating system"
135+
reason: "Verify the output identifies the operating system (e.g., 'Fedora Linux 43')"
136+
- llmJudge:
137+
contains: "kernel"
138+
reason: "Verify the output includes the kernel version as requested"
139+
prompt:
140+
inline: |
141+
I need to know basic information about this Linux system.
142+
143+
Please tell me what operating system it's running and the kernel version.
144+
```
145+
146+
**What this tests:**
147+
- **Tool discovery:** Can the agent find `get_system_information` from "basic information about this Linux system"?
148+
- **Documentation clarity:** Does the tool's description guide the agent correctly?
149+
- **Output verification:** The judge LLM verifies that:
150+
- The output mentions the operating system (e.g., "Fedora Linux 43")
151+
- The output includes the kernel version as requested
152+
153+
### Task 2: Disk Usage (`evals/tasks/disk-usage.yaml`)
154+
155+
```yaml
156+
kind: Task
157+
apiVersion: mcpchecker/v1alpha2
158+
metadata:
159+
name: "disk-usage-test"
160+
difficulty: easy
161+
description: |
162+
Tests if the agent can discover the get_disk_usage tool from a natural language
163+
request about disk space. The judge verifies that the output contains disk space
164+
information including available space and filesystem details.
165+
spec:
166+
verify:
167+
- llmJudge:
168+
contains: "disk space"
169+
reason: "Verify the output discusses disk space (not just 'disk' or 'usage' separately)"
170+
- llmJudge:
171+
contains: "available"
172+
reason: "Verify the output shows available/free space, which was requested"
173+
prompt:
174+
inline: |
175+
I want to check how much disk space is available on this system.
176+
177+
Please show me the disk usage information.
178+
```
179+
180+
**What this tests:**
181+
- **Tool discovery:** Can the agent find `get_disk_usage` from "disk space available"?
182+
- **Documentation clarity:** Does the description clearly indicate this tool shows disk usage?
183+
- **Output verification:** The judge LLM verifies that:
184+
- The output discusses disk space (contains "disk space" or similar)
185+
- The output shows available/free space, since that's what was requested
186+
187+
## Expected Output
188+
189+
When you run the tests, you should see:
190+
191+
```
192+
Task: system-info-test
193+
Difficulty: easy
194+
→ Running agent...
195+
→ Verifying results...
196+
✓ Task passed
197+
198+
Task: disk-usage-test
199+
Difficulty: easy
200+
→ Running agent...
201+
→ Verifying results...
202+
✓ Task passed
203+
```
204+
205+
## Running the Tests
206+
207+
### Configure the Server
208+
209+
The MCP configuration (`evals/mcp-config.yaml`) tells MCPChecker how to connect to the stdio server:
210+
211+
```yaml
212+
mcpServers:
213+
linux-server:
214+
type: stdio
215+
command: linux-mcp-server
216+
args: []
217+
enableAllTools: true
218+
```
219+
220+
**Key differences from HTTP servers:**
221+
- `type: stdio` - Server communicates via stdin/stdout
222+
- `command` - Executable name (must be on PATH) or absolute path
223+
- `args` - Command-line arguments (empty for this server)
224+
- No need to start a separate server process
225+
- MCPChecker manages the subprocess lifecycle automatically
226+
227+
### Run the Tests
228+
229+
```bash
230+
cd evals
231+
mcpchecker check eval.yaml
232+
```
233+
234+
The command will:
235+
1. Start the linux-mcp-server as a subprocess
236+
2. Connect Claude Code to it
237+
3. Run each test task
238+
4. Verify the results with the judge LLM
239+
5. Report pass/fail for each test
240+
241+
### Review Results
242+
243+
Check the output file:
244+
245+
```bash
246+
cat linux-diagnostic-test-out.json
247+
```
248+
249+
This contains detailed information about:
250+
- Which tools were called
251+
- What arguments were used
252+
- The actual output
253+
- Judge verification results
254+
255+
## What This Demonstrates
256+
257+
**Tool Discoverability:**
258+
- The tasks use natural language ("basic information about this Linux system")
259+
- The agent must find the right tool based on descriptions
260+
- Clear tool names (`get_system_information`, `get_disk_usage`) help discoverability
261+
262+
**Documentation Quality:**
263+
- Good descriptions guide agents to the right tool
264+
- Tags (`hardware`, `system`, `disk`, `filesystem`) provide additional context
265+
- Docstrings explain what information is retrieved
266+
267+
**Stdio Transport:**
268+
- Unlike HTTP servers, no separate server process needed
269+
- MCPChecker manages the subprocess lifecycle
270+
- Simpler setup for local-only servers
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
kind: Eval
2+
metadata:
3+
name: "linux-diagnostic-test"
4+
5+
config:
6+
# Use Claude Code as the AI agent
7+
agent:
8+
type: "builtin.claude-code"
9+
10+
# MCP server configuration
11+
mcpConfigFile: mcp-config.yaml
12+
13+
# LLM judge configuration
14+
llmJudge:
15+
env:
16+
baseUrlKey: JUDGE_BASE_URL
17+
apiKeyKey: JUDGE_API_KEY
18+
modelNameKey: JUDGE_MODEL_NAME
19+
20+
# Test tasks
21+
taskSets:
22+
- path: tasks/system-info.yaml
23+
assertions:
24+
toolsUsed:
25+
- server: linux-server
26+
tool: get_system_information
27+
minToolCalls: 1
28+
maxToolCalls: 3
29+
30+
- path: tasks/disk-usage.yaml
31+
assertions:
32+
toolsUsed:
33+
- server: linux-server
34+
tool: get_disk_usage
35+
minToolCalls: 1
36+
maxToolCalls: 3
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
mcpServers:
2+
linux-server:
3+
type: stdio
4+
command: linux-mcp-server
5+
args: []
6+
enableAllTools: true

0 commit comments

Comments
 (0)