MCP Inspector Testing Guide
The MCP Inspector is an in-browser debugging tool for testing MCP servers without connecting to actual applications. This guide explains how to use it for DocuMCP development.
Prerequisites
- Node.js 20+ installed
- DocuMCP repository cloned
- Dependencies installed (
npm install)
Quick Start
Option 1: Build and Launch Inspector
npm run build:inspect
This command:
- Compiles TypeScript to
dist/ - Launches MCP Inspector
- Opens browser at
http://localhost:5173(or similar)
Option 2: Launch Inspector with Existing Build
npm run build # First build (if needed)
npm run dev:inspect # Then launch inspector
Using the Inspector
1. Connect to Server
- Open the browser URL provided by the inspector
- Click the "Connect" button in the left sidebar
- Wait for connection confirmation
2. Test Tools
The Tools section lists all available MCP tools:
Example: Testing analyze_repository
- Click "Tools" in the top navigation
- Select "analyze_repository" from the list
- In the right panel, enter parameters:
{
"path": "./",
"depth": "standard"
} - Click "Run Tool"
- Verify the output includes:
- File counts
- Language detection
- Dependency analysis
- Memory insights
Example: Testing recommend_ssg
- First run
analyze_repository(as above) to get ananalysisId - Select "recommend_ssg"
- Enter parameters:
{
"analysisId": "<id-from-previous-analysis>",
"userId": "test-user",
"preferences": {
"priority": "simplicity",
"ecosystem": "javascript"
}
} - Click "Run Tool"
- Verify recommendation includes:
- Recommended SSG
- Confidence score
- Reasoning
- Alternative options
3. Test Resources
Resources provide static data for application UIs:
Example: Testing SSG List
- Click "Resources" in the top navigation
- Select "documcp://ssgs/available"
- Verify output shows all 5 SSGs:
- Jekyll
- Hugo
- Docusaurus
- MkDocs
- Eleventy
- Check each SSG includes:
- ID, name, description
- Language, complexity, build speed
- Best use cases
Example: Testing Configuration Templates
- Select "documcp://templates/jekyll-config"
- Verify YAML template is returned
- Test other templates:
documcp://templates/hugo-configdocumcp://templates/docusaurus-configdocumcp://templates/mkdocs-configdocumcp://templates/eleventy-configdocumcp://templates/diataxis-structure
4. Test Prompts
Prompts provide pre-written instructions for specialized tasks:
Example: Testing tutorial-writer
- Click "Prompts" in the top navigation
- Select "tutorial-writer"
- Provide arguments:
{
"project_path": "./",
"target_audience": "beginners",
"learning_goal": "deploy first documentation site"
} - Click "Get Prompt"
- Verify prompt messages include:
- Project context (languages, frameworks)
- Diataxis tutorial requirements
- Step-by-step structure guidance
Example: Testing analyze-and-recommend workflow
- Select "analyze-and-recommend"
- Provide arguments:
{
"project_path": "./",
"analysis_depth": "standard",
"preferences": "good community support"
} - Verify workflow prompt includes:
- Complete analysis workflow
- SSG recommendation guidance
- Implementation steps
Common Test Cases
Tool Testing Checklist
-
analyze_repository
- Test with current directory (
./) - Test with different depth levels
- Verify memory integration works
- Check similar projects are found
- Test with current directory (
-
recommend_ssg
- Test with valid analysisId
- Test different preference combinations
- Verify confidence scores
- Check historical data integration
-
generate_config
- Test each SSG type
- Verify output format
- Check template variables
-
setup_structure
- Test Diataxis structure creation
- Verify all categories included
- Check example content
-
deploy_pages
- Test workflow generation
- Verify GitHub Actions YAML
- Check custom domain support
-
validate_content
- Test with documentation path
- Verify link checking
- Check code block validation
Resource Testing Checklist
-
documcp://ssgs/available
- All 5 SSGs listed
- Complete metadata for each
-
Templates
- Jekyll config valid YAML
- Hugo config valid YAML
- Docusaurus config valid JS
- MkDocs config valid YAML
- Eleventy config valid JS
- Diataxis structure valid JSON
-
Workflows
- All workflows listed
- Quick setup available
- Full setup available
- Guidance provided
Prompt Testing Checklist
-
Technical Writer Prompts
- tutorial-writer
- howto-guide-writer
- reference-writer
- explanation-writer
- diataxis-organizer
- readme-optimizer
-
Workflow Prompts
- analyze-and-recommend
- setup-documentation
- troubleshoot-deployment
Troubleshooting
Inspector Won't Connect
Problem: Connection fails or times out
Solutions:
- Ensure server is built:
npm run build - Check no other process is using the port
- Try restarting:
Ctrl+Cand re-runnpm run dev:inspect
Tool Returns Error
Problem: Tool execution fails with error message
Solutions:
- Check parameter format (must be valid JSON)
- Verify required parameters are provided
- Ensure file paths exist (for file-based tools)
- Check server logs for detailed error messages
Resource Not Found
Problem: Resource URI returns "Resource not found" error
Solutions:
- Verify URI spelling matches exactly (case-sensitive)
- Check resource list for available URIs
- Ensure server version matches documentation
Prompt Arguments Missing
Problem: Prompt doesn't use provided arguments
Solutions:
- Check argument names match prompt definition
- Verify JSON format is correct
- Required arguments must be provided
Best Practices
During Development
- Keep Inspector Open: Launch inspector at start of development session
- Test After Changes: Run tool tests after modifying tool implementation
- Verify All Paths: Test both success and error paths
- Check Edge Cases: Test with unusual inputs, empty values, etc.
Before Committing
- Full Tool Test: Test at least one example from each tool
- Resource Validation: Verify all resources return valid data
- Prompt Verification: Check prompts generate correct messages
- Error Handling: Test with invalid inputs to verify error messages
For Bug Fixing
- Reproduce in Inspector: Use inspector to reproduce bug consistently
- Test Fix: Verify fix works in inspector before integration testing
- Regression Test: Test related tools to ensure no regressions
- Document: Add test case to this guide if bug was subtle
Integration with Development Workflow
Daily Development
# Morning startup
npm run build:inspect
# Keep inspector tab open
# Make code changes in editor
# Test changes in inspector
# Iterate until working
# Before lunch/end of day
npm run build && npm test
Pre-Commit Workflow
# Run full validation
npm run ci
# Test in inspector
npm run build:inspect
# Manual spot checks on key tools
# Commit when all checks pass
CI/CD Integration
While MCP Inspector is primarily for local development, you can add automated checks:
# In CI pipeline (future enhancement)
npm run build
npx @modelcontextprotocol/inspector dist/index.js --test automated-tests.json
Additional Resources
- MCP Inspector GitHub: https://github.com/modelcontextprotocol/inspector
- MCP Specification: https://modelcontextprotocol.io/docs
- MCP TypeScript SDK: https://github.com/modelcontextprotocol/typescript-sdk
- DocuMCP Architecture: See
docs/adrs/for detailed architectural decisions
Feedback
If you encounter issues with MCP Inspector or this guide:
- Check for known issues: https://github.com/modelcontextprotocol/inspector/issues
- Report DocuMCP-specific issues: https://github.com/anthropics/documcp/issues
- Suggest improvements to this guide via pull request
Last Updated: 2025-10-09 Version: 1.0.0