Skip to content

Commit 0bd91bf

Browse files
committed
updated readme and test notes
1 parent c5f9f78 commit 0bd91bf

File tree

3 files changed

+153
-10
lines changed

3 files changed

+153
-10
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ mcp_testing/server_configs/*
1010
.venv/
1111
env/
1212
venv/
13+
test_notes.md
1314

1415
# macOS metadata
1516
.DS_Store

README.md

+43-1
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,30 @@ python -m mcp_testing.scripts.compliance_report --server-command "python -m mcp_
129129
python -m mcp_testing.scripts.compliance_report --server-command "python -m mcp_server_fetch" --protocol-version 2024-11-05
130130
```
131131

132+
3. **Handling servers with timeout issues:**
133+
134+
When working with servers that may hang during certain operations (particularly tools tests), you can use the timeout features:
135+
136+
```bash
137+
# Set timeouts for tools tests vs. other tests
138+
python -m mcp_testing.scripts.compliance_report --server-command "python -m mcp_server_fetch" --protocol-version 2024-11-05 --test-timeout 30 --tools-timeout 15
139+
140+
# For servers with known tool list issues, try the basic interaction script
141+
python -m mcp_testing.scripts.basic_interaction --server-command "python -m mcp_server_fetch" --protocol-version 2024-11-05
142+
```
143+
144+
Tool-related tests that timeout are now treated as non-critical, allowing the testing process to continue and produce reports even when specific methods like `tools/list` hang.
145+
132146
### Troubleshooting Pip-Installed Servers
133147

134148
If you encounter issues when testing pip-installed servers:
135149

136150
- **"Failed to start transport" error**: Ensure the server is installed in the same environment as the testing framework
137151
- **Module not found errors**: Verify the module is installed with `python -c "import module_name"`
138152
- **Dependency issues**: Make sure all required dependencies are installed
153+
- **Hanging/timeout issues**: Use the `--test-timeout` and `--tools-timeout` parameters to set appropriate timeouts
139154

140-
For more details, see the [Pip-Installed Servers Plan](plan_pip.md).
155+
For more details, see the [Pip-Installed Servers Plan](plan_pip.md) and [Test Notes](test_notes.md) documents.
141156

142157
## MCP Testing Framework
143158

@@ -223,6 +238,9 @@ python -m mcp_testing.scripts.compliance_report --server-command "/path/to/serve
223238

224239
# Auto-detect server capabilities and protocol version
225240
python -m mcp_testing.scripts.compliance_report --server-command "/path/to/server" --auto-detect
241+
242+
# Set timeouts for tests (tools tests often need different timeouts)
243+
python -m mcp_testing.scripts.compliance_report --server-command "/path/to/server" --test-timeout 30 --tools-timeout 15
226244
```
227245

228246
For HTTP testing, additional options include:
@@ -251,6 +269,30 @@ The generated reports include:
251269
- Server capabilities overview
252270
- Compliance status and score
253271

272+
### Basic Testing
273+
274+
For servers that may have issues with specific protocol features (like tools functionality), a simplified basic interaction script is available:
275+
276+
```bash
277+
# Run a basic test that only verifies server initialization and lists tools
278+
python -m mcp_testing.scripts.basic_interaction --server-command "python -m mcp_server_fetch" --protocol-version 2024-11-05
279+
```
280+
281+
This script:
282+
- Starts the server
283+
- Sends an initialization request
284+
- Verifies the response
285+
- Lists available tools (if the server responds correctly)
286+
- Terminates gracefully
287+
288+
This is useful for:
289+
- Initial verification of server functionality
290+
- Testing servers with known issues in complex compliance tests
291+
- Quick verification of initialization success
292+
- Interactive exploration of available tools
293+
294+
The script displays output directly in the terminal, making it easy to see exactly what's happening during the server communication.
295+
254296
### Running the Test Suite
255297

256298
```bash

test_notes.md

+109-9
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,69 @@ python -m mcp_testing.scripts.compliance_report --server-command "cd /Users/scot
122122
python -m mcp_testing.scripts.compliance_report --server-command "docker run -i --rm mcp/fetch" --protocol-version 2024-11-05
123123
```
124124

125+
### Known Issues with Fetch Server
126+
127+
The Fetch server has a known issue with the `tools/list` method which causes it to hang indefinitely when this method is called. The server successfully initializes and can respond to the initialization request, but does not correctly implement the `tools/list` method.
128+
129+
To work around this issue, we've implemented two approaches:
130+
131+
1. **Use the Basic Interaction Script**: A simplified test that only verifies initialization
132+
```bash
133+
python -m mcp_testing.scripts.basic_interaction --server-command "python -m mcp_server_fetch" --protocol-version 2024-11-05
134+
```
135+
136+
2. **Use Timeouts for Tools Tests**: The compliance report script now supports timeouts for tools-related tests
137+
```bash
138+
python -m mcp_testing.scripts.compliance_report --server-command "python -m mcp_server_fetch" --protocol-version 2024-11-05 --test-mode tools --tools-timeout 15 --report-prefix "fetch_"
139+
```
140+
141+
When testing the fetch server, you will still see a successful initialization but the tool list test will time out. The test framework has been updated to treat tool test timeouts as non-critical, so a report can still be generated showing the server's partial compliance with the protocol.
142+
143+
### Compliance Status for Fetch Server
144+
145+
The Fetch MCP Server demonstrates partial compliance with the 2024-11-05 protocol specification:
146+
- **Total Tests**: 5 (in tools mode)
147+
- **Passed**: 1 (Initialization)
148+
- **Failed/Timed out**: 4 (Tool-related tests)
149+
- **Status**: ⚠️ Partially Compliant (Initialization works, tools functionality times out)
150+
151+
A successful basic interaction test shows:
152+
```
153+
Starting server...
154+
Initializing server...
155+
Initialization result:
156+
{
157+
"jsonrpc": "2.0",
158+
"id": "init",
159+
"result": {
160+
"protocolVersion": "2024-11-05",
161+
"serverInfo": {
162+
"name": "mcp-fetch",
163+
"version": "1.6.0"
164+
},
165+
"capabilities": {
166+
"tools": {
167+
"listChanged": false
168+
},
169+
"experimental": {}
170+
}
171+
}
172+
}
173+
Sending initialized notification...
174+
175+
Listing available tools...
176+
Error listing tools: Timeout waiting for response
177+
```
178+
179+
This shows the server initializes correctly but has an issue with the tools/list method.
180+
125181
### Troubleshooting
126182

127183
When testing the Fetch server, you might encounter a "Failed to start transport" error. This could be due to:
128184

129185
1. **Dependencies not installed**: Make sure all dependencies are installed correctly.
130186
```bash
131-
cd /Users/scott/AI/MCP/servers/src/fetch
132-
pip install -e .
187+
pip install mcp-server-fetch sseclient-py==1.7.2
133188
```
134189

135190
2. **Module Not Found**: The command might need to include the proper Python path.
@@ -148,16 +203,61 @@ When testing the Fetch server, you might encounter a "Failed to start transport"
148203
python -m mcp_testing.scripts.compliance_report --server-command "python /Users/scott/AI/MCP/servers/src/fetch/src/mcp_server_fetch/__main__.py" --protocol-version 2024-11-05
149204
```
150205

151-
### Server Configuration Details
206+
## Improved Test Framework Features
152207

153-
The Fetch server has the following configuration in the testing framework:
208+
### Timeout Handling for Tool Tests
154209

155-
- **Package**: `mcp-server-fetch`
156-
- **Required Tools**: `fetch`
157-
- **Recommended Protocol**: 2024-11-05
158-
- **Skipped Tests**: `test_shutdown`, `test_exit_after_shutdown`, `test_initialization_order`
210+
The testing framework has been enhanced to better handle servers that may time out during specific test operations, particularly tool-related tests. New features include:
211+
212+
1. **Separate timeouts for tool tests**:
213+
```bash
214+
python -m mcp_testing.scripts.compliance_report --server-command "command" --test-timeout 30 --tools-timeout 15
215+
```
216+
217+
2. **Non-critical tool test failures**: Tool tests that time out are now marked as non-critical and don't prevent the generation of a compliance report. This allows testing servers that may have issues with specific methods but are otherwise functional.
218+
219+
3. **Timeout visibility in reports**: Reports now show which tests timed out, making it easier to diagnose server issues.
220+
221+
### Example Run with Timeout Handling
222+
223+
Running the minimal MCP server with timeout parameters demonstrates the improved functionality:
224+
225+
```
226+
[2025-04-08 18:33:04] Running 3 non-tool tests with 30s timeout
227+
[2025-04-08 18:33:04] Starting test suite with 3 tests
228+
[2025-04-08 18:33:04] Running test 1/3: test_echo_tool
229+
[2025-04-08 18:33:05] Test 1/3: test_echo_tool - PASSED (0.51s)
230+
[2025-04-08 18:33:05] Progress: 1/3 tests completed, time elapsed: 0.5s, estimated remaining: 1.0s
231+
[2025-04-08 18:33:05] Running test 2/3: test_add_tool
232+
[2025-04-08 18:33:05] Test 2/3: test_add_tool - PASSED (0.51s)
233+
[2025-04-08 18:33:05] Progress: 2/3 tests completed, time elapsed: 1.0s, estimated remaining: 0.5s
234+
[2025-04-08 18:33:05] Running test 3/3: test_invalid_tool
235+
[2025-04-08 18:33:06] Test 3/3: test_invalid_tool - PASSED (0.52s)
236+
[2025-04-08 18:33:06] Progress: 3/3 tests completed, time elapsed: 1.6s, estimated remaining: 0.0s
237+
[2025-04-08 18:33:06] Test suite completed: 3 passed, 0 failed, total time: 1.55s
238+
[2025-04-08 18:33:06] Running 2 tool tests with 15s timeout
239+
```
240+
241+
### Test Output Interpretation
242+
243+
When a server has tool-related timeout issues, you'll see output like:
244+
245+
```
246+
⚠️ WARNING: Test test_tools_list timed out after 15s (continuing)
247+
```
248+
249+
And the generated report will indicate the timeout but still show initialization success:
250+
251+
```
252+
## Status: Success
253+
254+
## Test Details
255+
256+
- ✅ Server Initialization: Successful
257+
- ⚠️ Tools List: Timed out after 15s (non-critical)
258+
```
159259

160-
The fetch server provides a single tool to fetch content from web URLs and convert them to a format suitable for consumption by an LLM.
260+
This approach allows the testing framework to gracefully handle servers with partial compliance, providing useful feedback while still allowing the testing process to complete.
161261

162262
## Testing Minimal MCP Server (STDIO)
163263

0 commit comments

Comments
 (0)