Files
mcp/MCP_DEMO.md
zeekay c9850818a9 docs: add MCP demo guide and test scripts
- Add comprehensive MCP_DEMO.md with setup instructions
- Add test scripts for E2E and protocol testing
- Update build configuration for better module compatibility
- Configure Claude Desktop with multiple MCP server options
2025-09-15 07:06:29 -05:00

4.4 KiB

Hanzo MCP Search - E2E Demo Guide

โœ… Setup Complete

The Hanzo MCP Search has been successfully:

  1. Built and installed globally (@hanzo/mcp v2.0.0)
  2. Configured with Claude Desktop
  3. Tested with the CLI

๐Ÿš€ How to Use with Claude Desktop

1. Restart Claude Desktop

After installation, restart Claude Desktop to load the MCP tools.

2. Available Tools

Once restarted, Claude will have access to these search tools:

search Tool

Search across your codebase with the following parameters:

  • query (required): Search query text
  • maxResults (optional): Limit results (default: 10)
  • filePattern (optional): File glob pattern (e.g., ".ts", "**/.js")

Example prompts to try in Claude:

"Search for 'LanceDB' in the codebase"
"Find all TypeScript files containing 'search'"
"Look for 'function' in JavaScript files"

fetch Tool

Fetch full document content by ID:

  • id (required): Document ID from search results

3. Testing the Integration

In a new Claude conversation, try these commands:

  1. Basic Search Test: "Use the search tool to find files containing 'vector'"

  2. Pattern Search Test: "Search for 'export' in TypeScript files only"

  3. Fetch Document Test: "Search for 'search' and then fetch the first result"

4. CLI Usage

You can also use the CLI directly:

# Start the server
hanzo-mcp serve

# Check version
hanzo-mcp --version
# Output: 2.0.0

# Install to Claude Desktop (already done)
hanzo-mcp install-desktop

๐Ÿ”’ Security Features

Ngrok Integration (Optional)

To enable secure remote access:

# Set ngrok token
export NGROK_AUTHTOKEN=your_token_here
export NGROK_ENABLED=true
export ACCESS_TOKEN=your_secure_token

# Start server with ngrok
hanzo-mcp serve

When ngrok is enabled:

  • Files are served over HTTPS with post-quantum TLS
  • ACCESS_TOKEN authentication required
  • URLs automatically use ngrok tunnel

Local Mode (Default)

Without ngrok configuration:

  • Files use file:// URLs
  • Only accessible locally
  • No external exposure

๐Ÿงช Testing

Run Direct Tests

# Run the test script
node test-search.js

Expected Output Format

Search results follow OpenAI MCP specification:

{
  "results": [
    {
      "id": "unique-id",
      "title": "filename.ts:42",
      "url": "file:///path/to/file"
    }
  ]
}

Fetch results return:

{
  "id": "unique-id",
  "title": "filename.ts",
  "text": "file content...",
  "url": "file:///path/to/file",
  "metadata": {
    "type": "code",
    "language": "typescript"
  }
}

๐Ÿ“ Project Structure

/Users/z/work/hanzo/mcp/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ search/          # Unified search implementation
โ”‚   โ”‚   โ”œโ”€โ”€ index.ts     # Main search & fetch tools
โ”‚   โ”‚   โ”œโ”€โ”€ strategies/  # Search strategy pattern
โ”‚   โ”‚   โ”œโ”€โ”€ secure-tunnel.ts  # Ngrok integration
โ”‚   โ”‚   โ””โ”€โ”€ url-helper.ts     # URL generation
โ”‚   โ””โ”€โ”€ tools/           # All MCP tools
โ”œโ”€โ”€ dist/                # Built output
โ”œโ”€โ”€ test-search.js       # Direct test script
โ””โ”€โ”€ package.json         # v2.0.0

๐ŸŽฏ Features

  • Multi-modal Search: Text, AST, Symbol, Vector, File
  • OpenAI MCP Compliance: Standard search and fetch tools
  • Extensible Architecture: Strategy pattern for new search types
  • Secure Remote Access: Optional ngrok with authentication
  • 54 Total Tools: Including UI, AutoGUI, and Orchestration tools

๐Ÿ“Š Current Status

  • โœ… CLI installed and working
  • โœ… Claude Desktop configured
  • โœ… Server can be started
  • โœ… Search returns MCP-compliant format
  • โœ… Build process optimized
  • โš ๏ธ CI has test failures (non-blocking)

๐Ÿ”ง Troubleshooting

If Claude doesn't show the tools:

  1. Fully quit Claude Desktop (not just close window)
  2. Restart Claude Desktop
  3. Check config: ~/Library/Application Support/Claude/claude_desktop_config.json

If search returns no results:

  1. Ensure you're in a directory with code files
  2. Try broader search terms
  3. Check file patterns match your project

๐Ÿ“ Next Steps

  1. In Claude Desktop: Try the search commands above
  2. Set up ngrok (optional): For remote access capability
  3. Customize search: Add project-specific search strategies
  4. Monitor usage: Check server logs for debugging

Version: 2.0.0
NPM Package: @hanzo/mcp
GitHub: https://github.com/hanzoai/mcp