MCP Discovery Server
by bmcgauley
README.md
# MCP Discovery Server
A meta-MCP for discovering and exploring other MCPs using progressive disclosure patterns to reduce token usage.
## Overview
The MCP Discovery Server helps you:
- **Discover** available MCPs without loading all schemas upfront
- **Search** for MCPs by keyword or category
- **Load** detailed schemas on-demand (progressive disclosure)
- **Reduce** token usage by 95%+ through intelligent caching
## Features
### Progressive Disclosure
Load only what you need:
- **Minimal**: Just MCP names (50-100 bytes)
- **Brief**: Names + key metadata (500-1000 bytes)
- **Full**: Complete schemas (2000-5000 bytes)
### Resource-Based Access
- MCP metadata via `mcp-discovery://mcp/{name}/info`
- Tool lists via `mcp-discovery://mcp/{name}/tools`
- 5-minute cache TTL for fast repeat access
### Smart Search
- Keyword-based search
- Category filtering
- Relevance scoring
- Fast results (<100ms)
## Installation
### Prerequisites
- Python 3.8+
- FastMCP library
### Setup
1. Install dependencies:
```bash
pip install fastmcp pydantic httpx
```
2. Add to Claude Desktop config:
```json
{
"mcpServers": {
"mcp-discovery": {
"command": "python",
"args": ["C:/github/mcps/mcp-discovery-server/server.py"]
}
}
}
```
3. Restart Claude Desktop
## Usage
### Tool 1: List MCPs
Get a list of all available MCPs with configurable detail.
**Minimal (Best for initial discovery)**
```python
# Returns: ["webscrape", "midi-converter", "drawio"]
list_mcps({
"detail_level": "minimal"
})
```
**Brief (Balanced detail)**
```python
# Returns: [{"name": "webscrape", "language": "python", "categories": ["web"]}, ...]
list_mcps({
"detail_level": "brief"
})
```
**Full (Complete schemas)**
```python
# Returns: Full MCP schemas with all metadata
list_mcps({
"detail_level": "full",
"category": "web" # Optional filter
})
```
### Tool 2: Search MCPs
Find MCPs by keyword with relevance scoring.
```python
# Search by keyword
search_mcps({
"query": "web scraping"
})
# Search with category filter
search_mcps({
"query": "audio",
"category": "audio",
"detail_level": "brief"
})
```
### Tool 3: Get MCP Schema
Load full schema for a specific MCP.
```python
# Get MCP schema
get_mcp_schema({
"mcp_name": "webscrape"
})
# Get tool-specific schema
get_mcp_schema({
"mcp_name": "webscrape",
"tool_name": "scrape_url"
})
```
## Token Savings
### Before (Traditional Approach)
```
Load all MCP schemas upfront: ~150KB
Execute operation: ~25KB
Total: ~175KB per interaction
```
### After (Progressive Disclosure)
```
List MCPs (minimal): ~50 bytes
Search for relevant MCP: ~200 bytes
Load specific schema: ~800 bytes
Execute operation: ~500 bytes
Total: ~1.5KB per interaction
Savings: 99.1%!
```
## Progressive Disclosure Workflow
```
1. Discovery Phase
├─ list_mcps("minimal") → ["webscrape", "midi-converter", ...]
└─ Token usage: ~50 bytes
2. Search Phase (optional)
├─ search_mcps(query="web") → [{webscrape details}]
└─ Token usage: ~200 bytes
3. Schema Loading Phase
├─ get_mcp_schema(mcp_name="webscrape") → {full schema}
└─ Token usage: ~800 bytes
4. Execution Phase
└─ Use loaded schema to call actual MCP tools
Total: ~1KB vs ~150KB (99.3% savings)
```
## Resource URIs
Access MCP metadata directly via resources:
```
mcp-discovery://mcp/{name}/info
→ Get MCP metadata
mcp-discovery://mcp/{name}/tools
→ Get list of tools (if available)
```
## Categories
MCPs are automatically categorized:
- **web**: Web scraping, crawling, extraction
- **audio**: MIDI, music, audio processing
- **diagrams**: Draw.io, flowcharts, visualizations
- **meta**: Discovery, helper tools
## Caching
- **Cache TTL**: 5 minutes (configurable)
- **Automatic cleanup**: Expired entries removed automatically
- **Performance**: 100x+ faster for repeated queries
## TypeScript Definitions
Progressive disclosure for type-safe tool loading:
```typescript
// Load only what you need
import { ListMCPsParams } from './tools/list_mcps';
import { SearchMCPsParams } from './tools/search_mcps';
import { GetMCPSchemaParams } from './tools/get_schema';
```
## Testing
Run the test suite:
```bash
python tests/test_server.py
```
Expected output:
```
========================================================
MCP DISCOVERY SERVER - TEST SUITE
========================================================
[Test 1] Loading MCP registry...
✓ Found 3 MCPs
[Test 2] List MCPs (minimal)...
✓ Returned 3 MCP names
[Test 9] Progressive disclosure token savings...
✓ Progressive disclosure working:
Minimal: 47 bytes
Full: 2847 bytes
Savings: 98.3%
Total: 10 | Passed: 10 | Failed: 0
Success Rate: 100.0%
```
## Architecture
```
┌─────────────────────────────────────────┐
│ MCP Discovery Server │
├─────────────────────────────────────────┤
│ │
│ [Discovery Tools] │
│ ├─ list_mcps() - List all MCPs │
│ ├─ search_mcps() - Search by keyword │
│ └─ get_mcp_schema() - Load full schema │
│ │
│ [Resource Layer] │
│ ├─ mcp://{name}/info - MCP metadata │
│ └─ mcp://{name}/tools - Tool list │
│ │
│ [Cache Layer] │
│ ├─ 5-minute TTL │
│ ├─ Automatic cleanup │
│ └─ Fast repeat access │
│ │
│ [Config Reader] │
│ └─ Claude Desktop config integration │
│ │
└─────────────────────────────────────────┘
```
## Examples
### Example 1: Find Web-Related MCPs
```python
# Step 1: Search for web MCPs
result = search_mcps({
"query": "web",
"detail_level": "brief"
})
# Returns:
{
"success": true,
"count": 1,
"results": [
{
"name": "webscrape",
"language": "python",
"categories": ["web"],
"relevance_score": 10
}
]
}
# Step 2: Get full schema
schema = get_mcp_schema({"mcp_name": "webscrape"})
# Now use webscrape tools with full knowledge
```
### Example 2: Discover Audio Capabilities
```python
# List all audio MCPs
audio_mcps = list_mcps({
"detail_level": "brief",
"category": "audio"
})
# Returns:
[
{
"name": "midi-converter",
"language": "python",
"categories": ["audio"]
}
]
```
### Example 3: Explore All Tools
```python
# Get minimal list
mcps = list_mcps({"detail_level": "minimal"})
# ["webscrape", "midi-converter", "drawio"]
# For each MCP, get tools
for mcp in mcps:
tools = get_resource(f"mcp-discovery://mcp/{mcp}/tools")
# Returns list of available tools
```
## Performance Benchmarks
| Operation | Time | Token Usage |
|-----------|------|-------------|
| list_mcps (minimal) | <10ms | 50 bytes |
| list_mcps (brief) | <20ms | 500 bytes |
| list_mcps (full) | <50ms | 2500 bytes |
| search_mcps | <30ms | 300 bytes |
| get_mcp_schema | <20ms | 800 bytes |
| Resource access (cached) | <5ms | 0 bytes |
## Contributing
To add a new MCP to the registry:
1. Add MCP to Claude Desktop config
2. Restart Claude Desktop
3. Discovery server automatically detects it
To add custom categories:
1. Edit `_load_mcp_registry()` in `server.py`
2. Add category detection logic
3. Restart server
## Troubleshooting
### MCPs not showing up
- Check Claude Desktop config file location
- Verify JSON syntax in config
- Restart Claude Desktop
### Slow performance
- Check cache TTL settings
- Verify network connectivity
- Monitor cache cleanup frequency
### Missing categories
- Categories are auto-detected from MCP names
- Add custom logic in `_load_mcp_registry()`
## Future Enhancements
- [ ] Persistent cache (Redis)
- [ ] Real-time MCP health monitoring
- [ ] Tool usage statistics
- [ ] Fuzzy search with ranking
- [ ] Tool dependency detection
- [ ] Auto-generate tool documentation
## License
MIT
## Credits
Created following Anthropic's MCP progressive disclosure patterns.
Based on guidelines from https://www.anthropic.com/engineering/code-execution-with-mcp
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues