test_mcp_visibility.pyโข5.83 kB
#!/usr/bin/env python3
"""
Test script to simulate what Claude Desktop sees through MCP
Shows the comparison between before and after documentation indexing
"""
import sys
import os
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.core.clean_search import CleanSmartCodeSearch
import json
def simulate_mcp_queries():
"""Simulate typical queries Claude Desktop might make"""
print("๐ค CLAUDE DESKTOP MCP SERVER VISIBILITY TEST")
print("=" * 70)
search = CleanSmartCodeSearch(project_root=".")
# Simulate various types of queries Claude might make
test_scenarios = [
{
"scenario": "User asks: 'How do I install this project?'",
"query": "installation setup install requirements",
"expected": "Should find README.md and INSTALLATION.md"
},
{
"scenario": "User asks: 'What tools does this MCP server provide?'",
"query": "MCP tools API available commands",
"expected": "Should find API.md and server.py tool definitions"
},
{
"scenario": "User asks: 'How can I contribute to this project?'",
"query": "contributing guidelines pull request",
"expected": "Should find CONTRIBUTING.md and PR template"
},
{
"scenario": "User asks: 'Is there a security policy?'",
"query": "security vulnerability report CVE",
"expected": "Should find SECURITY.md"
},
{
"scenario": "User asks: 'How does the voice assistant work?'",
"query": "voice assistant speech recognition elevenlabs",
"expected": "Should find voice-assistant/README.md and related files"
},
{
"scenario": "User asks: 'What's the project architecture?'",
"query": "architecture design system components",
"expected": "Should find ARCHITECTURE.md"
},
{
"scenario": "User asks: 'Show me the search implementation'",
"query": "search function semantic embedding",
"expected": "Should find clean_search.py and search methods"
},
{
"scenario": "User asks: 'What configuration options are available?'",
"query": "configuration settings environment variables",
"expected": "Should find .env.example and config files"
}
]
print("\n๐ SIMULATED CLAUDE DESKTOP QUERIES\n")
for i, test in enumerate(test_scenarios, 1):
print(f"Scenario {i}: {test['scenario']}")
print(f"Query: '{test['query']}'")
print(f"Expected: {test['expected']}")
results = search.search(test['query'], limit=5)
if results:
print(f"โ
Found {len(results)} results:")
for j, result in enumerate(results[:3], 1):
file_name = Path(result['file_path']).name
score = result.get('score', 0)
print(f" {j}. {result['name']:<30} in {file_name:<25} (score: {score:.3f})")
else:
print("โ No results found!")
print("-" * 70)
# Summary comparison
print("\n๐ VISIBILITY COMPARISON")
print("=" * 70)
# Count what's visible
doc_queries = [
("Documentation files", "README CONTRIBUTING LICENSE SECURITY CHANGELOG"),
("Configuration files", "json yaml config settings"),
("API documentation", "API tools MCP commands"),
("Installation guides", "installation setup requirements"),
("Code files", "class function search analyze")
]
print(f"{'Category':<25} | {'Results Found':<15} | {'Status'}")
print("-" * 70)
for category, query in doc_queries:
results = search.search(query, limit=10)
doc_results = [r for r in results if any(
ext in r['file_path']
for ext in ['.md', '.json', '.yaml', '.yml', 'LICENSE', 'SECURITY']
)]
code_results = [r for r in results if '.py' in r['file_path']]
status = "โ
Full" if doc_results else "โ ๏ธ Code only" if code_results else "โ None"
print(f"{category:<25} | Docs: {len(doc_results):<3} Code: {len(code_results):<3} | {status}")
print("\n" + "=" * 70)
print("๐ก ANALYSIS FOR CLAUDE DESKTOP")
print("-" * 70)
# Check documentation coverage
doc_count = len(search.search("README CONTRIBUTING SECURITY API documentation", limit=20))
if doc_count > 10:
print("โ
EXCELLENT: Full documentation is indexed and searchable")
print(" Claude can now provide comprehensive answers about:")
print(" โข Installation and setup procedures")
print(" โข API documentation and tool usage")
print(" โข Contributing guidelines and workflows")
print(" โข Security policies and best practices")
print(" โข Project architecture and design")
elif doc_count > 5:
print("โ ๏ธ PARTIAL: Some documentation is indexed")
print(" Claude has limited visibility into project documentation")
else:
print("โ LIMITED: Mostly code-only visibility")
print(" Claude cannot answer questions about installation, setup, or usage")
print("\n๐ฏ CAPABILITIES UNLOCKED:")
print(" โข Can guide users through installation")
print(" โข Can explain all 30+ MCP tools with examples")
print(" โข Can help with contribution workflows")
print(" โข Can reference security guidelines")
print(" โข Can describe system architecture")
print("\nโจ The MCP server now provides full project context to Claude Desktop!")
if __name__ == "__main__":
simulate_mcp_queries()