Skip to main content
Glama
20251009-0016-claude-code-testing.md10.2 kB
--- story_id: "0016" title: "Claude Code integration testing" created: "2025-10-09" status: done dependencies: ["0005", "0006", "0007", "0008", "0014"] estimated_complexity: "medium" tags: ["testing", "integration", "claude-code", "phase1"] - status: in-progress timestamp: 2025-10-10T02:54:22Z - status: ready-for-review timestamp: 2025-10-14T02:37:00Z - status: ready-for-review timestamp: 2025-10-14T02:38:37Z - status: done timestamp: 2025-10-14T02:39:44Z --- # Story 0016: Claude Code integration testing ## Description Test mcp-test-mcp as an actual MCP server in Claude Code to verify it works correctly in the target environment. This is the ultimate validation that the MVP is ready for use. ## Acceptance Criteria - [x] mcp-test-mcp installed in Claude Code MCP configuration - [x] All 13 tools visible with `mcp__mcp-test-mcp__` prefix (note: hyphens, not underscores) - [x] Test connection to a real deployed MCP server (tested FDA Da Vinci server) - [x] Test connection to hosted MCP server (tested Weather MCP server - full workflow success) - [x] Verify tool schemas appear correctly in Claude Code - [x] Test complete workflow: connect → list tools → list prompts → list resources → call tool → read resource → get prompt → execute prompt with LLM - [x] Verify error messages are clear and actionable in Claude Code - [x] Test that AI can interpret verbose responses correctly - [x] Document any Claude Code-specific configuration issues (compatibility issue found - see below) - [x] Validated fill_variables fix (v0.1.5) works in production with real LLM execution ## Technical Notes **Test scenarios:** 1. **First-time setup** - Install and configure mcp-test-mcp 2. **Basic workflow** - Connect to server, list tools, call tool 3. **Error handling** - Test with invalid URL, disconnected state 4. **Verbose output** - Verify AI doesn't hallucinate from schemas 5. **Multiple operations** - Test statistics tracking across operations **Configuration to test:** ```json { "mcpServers": { "mcp-test-mcp": { "command": "python", "args": ["-m", "mcp_test_mcp"], "transport": "stdio", "env": { "MCP_TEST_LOG_LEVEL": "INFO" } } } } ``` **Expected behavior:** - Tools appear as `mcp__mcp_test_mcp__connect_to_server`, etc. - AI can use tools to test other MCP servers - AI doesn't try to use curl or REST approaches - Error messages help AI understand what went wrong ## Test Results (2025-10-10) ### Successful Operations ✅ 1. **Installation & Configuration** - mcp-test-mcp successfully installed in Claude Code - Tools appeared with `mcp__mcp-test-mcp__` prefix (hyphens, not underscores) - All 13 tools visible and accessible 2. **Connection Management** - ✅ Successfully connected to FDA Da Vinci MCP server at `https://fda-mcp-davinci-mcp.apps.cluster-sdzgj.sdzgj.sandbox319.opentlc.com/mcp/` - Transport auto-detected as `streamable-http` - Connection time: ~180ms - ✅ Successfully disconnected with clean state clearing 3. **Error Handling** - ✅ Clear, actionable error messages for connection failures - ✅ Helpful suggestions included in error responses - ✅ Proper error type classification (connection_failed, execution_error) - Tested invalid URLs - got clear 400/404 errors with explanations 4. **Statistics Tracking** - ✅ Error counter properly incremented (tracked 3 errors) - ✅ Connection duration tracked - ✅ Metadata included in all responses (request timing, etc.) 5. **AI Interpretation** - ✅ All verbose responses were correctly interpreted - ✅ JSON responses were clear and structured - ✅ No hallucination from tool schemas ### Compatibility Issue Found ⚠️ **Problem**: When calling `list_tools`, `list_resources`, and `list_prompts` on the FDA Da Vinci MCP server, received errors: ```python AttributeError: 'list' object has no attribute 'tools' AttributeError: 'list' object has no attribute 'resources' AttributeError: 'list' object has no attribute 'prompts' ``` **Root Cause**: The FDA server appears to return lists directly, but mcp-test-mcp expects response objects with `.tools`, `.resources`, and `.prompts` attributes. **Impact**: Cannot list or interact with tools/resources/prompts on some MCP servers. **Recommendation**: Update the tools in `src/mcp_test_mcp/tools/` to handle both response formats: - Check if response is already a list - If so, use it directly instead of accessing `.tools` attribute - This will improve compatibility with different MCP server implementations **Files to fix**: - `src/mcp_test_mcp/tools/tools.py` (list_tools) - `src/mcp_test_mcp/tools/resources.py` (list_resources) - `src/mcp_test_mcp/tools/prompts.py` (list_prompts) ## Additional Test Results (2025-10-13) - NPM Wrapper & Prompts ### Issue 1: STDOUT Contamination ⚠️ → Fixed in v0.1.3 **Problem**: Claude Desktop showed Zod validation errors when connecting: ``` invalid_literal errors expecting '2.0' Received keys: timestamp, level, logger, message ``` **Root Cause**: JSON log messages were being output to stdout during server initialization. Since MCP uses stdout for JSON-RPC communication, these logs corrupted protocol messages. **Fix** (v0.1.3): - Changed `logger.info()` to `logger.debug()` at lines 88, 178 in `server.py` - Removed early logging before logging system was configured - Logging already configured to use `sys.stderr` (line 71) **Verification**: ```bash npx -y mcp-test-mcp@0.1.3 > stdout.log 2> stderr.log # stdout.log was empty - confirmed clean! ``` ### Issue 2: fill_variables Validation Errors ⚠️ → Fixed in v0.1.5 **Problem**: Claude Desktop reported input validation errors when using `execute_prompt_with_llm`: ``` Input validation error: '{"weather_data": ...}' is not valid under any of the given schemas ``` **Root Cause**: Claude Desktop was sending `fill_variables`, `prompt_arguments`, and `llm_config` as JSON **strings** instead of parsed objects. The function signature only accepted `dict[str, Any] | None`, causing FastMCP's input validation to reject the strings. **Fix** (v0.1.5 - `tools/llm.py:21-115`): 1. Changed function signature to accept `dict[str, Any] | str | None` for all three parameters 2. Added automatic JSON parsing at start of function to handle string inputs 3. Returns helpful error messages if JSON parsing fails **Result**: ✅ `execute_prompt_with_llm` now works correctly with Claude Desktop! ### NPM Wrapper Architecture The project uses an NPM wrapper for Python distribution: - `npm install mcp-test-mcp` creates a virtual environment during postinstall - Isolates Python dependencies from system Python - Enables easy installation via `npx -y mcp-test-mcp@version` - User configuration: `"args": ["-y", "mcp-test-mcp@0.1.5"]` **Documentation**: Added comprehensive STDOUT vs STDERR guidelines to `CLAUDE.md` to prevent future issues. ### Complete Workflow Test with Weather MCP Server (2025-10-13) ✅ **Server**: `https://mcp-server-weather-mcp.apps.cluster-6gftl.6gftl.sandbox3207.opentlc.com/mcp/` **Full workflow executed successfully:** 1. **Connection** (388ms) - Transport: streamable-http (auto-detected) - Connected successfully to hosted weather MCP server 2. **List Tools** (265ms) - ✅ Found 3 tools: `get_weather`, `get_weather_from_coordinates`, `geocode_location` - All tool schemas retrieved correctly - No compatibility issues (unlike FDA server) 3. **List Prompts** (278ms) - ✅ Found 4 prompts: `weather_report`, `daily_forecast_brief`, `severe_weather_alert`, `weather_comparison` - All prompts have proper descriptions and argument schemas 4. **List Resources** (262ms) - ✅ Found 4 resources: Weather API citations, geocode API citations, all citations, data sources - Resources use proper URI scheme (`citations://`, `info://`) 5. **Call Tool** (1.3 seconds) - ✅ Called `get_weather` for Seattle, WA - Received: `{"location":"Seattle, WA","temperature":"53.6°F (12.0°C)","conditions":"Clear","forecast":"Sunny, with a high near 57...","humidity":"50.4%","wind":"3.4 mph from 360°","timestamp":"2025-10-14T02:36:57...","source":"Weather.gov"}` - Tool execution successful with proper error handling 6. **Read Resource** (268ms) - ✅ Read `citations://weather-api` resource - Retrieved 803 bytes of citation data in JSON format - Resource content properly formatted 7. **Get Prompt** (263ms) - ✅ Retrieved `weather_report` prompt template - Contains `{weather_data}` and `{output_format}` variables for substitution - Includes complete JSON schema for structured output 8. **Execute Prompt with LLM** (5.4 seconds total, 5.1s LLM execution) - ✅ Used `fill_variables` to populate `{weather_data}` and `{output_format}` - **This demonstrates the v0.1.5 fix working in production!** - LLM successfully generated professional weather report in JSON format - Response included: summary, temperature analysis, conditions, wind details, recommendations - Model: llama-4-scout-17b-16e-w4a16 - Tokens: 496 prompt + 331 completion = 827 total **Key Findings:** - ✅ No compatibility issues with Weather MCP server (unlike FDA server) - ✅ `fill_variables` parameter works correctly after v0.1.5 fix - ✅ Complete end-to-end workflow validated - ✅ LLM integration successful with real prompt execution - ✅ All response times reasonable for production use - ✅ Connection statistics properly tracked throughout workflow **Published Versions:** - v0.1.3: Fixed STDOUT contamination - v0.1.4: Published with updated npm wrapper - v0.1.5: Fixed fill_variables validation (currently deployed) ## AI Directives **IMPORTANT**: As you work through this story, please mark checklist items as complete `[x]` as you finish them. This ensures that if we need to pause and resume work, we have a clear record of progress. Update the `status` field in the frontmatter when moving between stages (in-progress, ready-for-review, done, blocked). This is the final validation for Phase 1 MVP. Test thoroughly in real Claude Code environment.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rdwj/mcp-test-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server