# Search Agent An intelligent search service with REST API, CLI, and MCP server interfaces. ## Features - **REST API**: Full-featured HTTP API with streaming support - **CLI**: Command-line interface for quick searches - **MCP Server**: Model Context Protocol server for integration with AI assistants ## Installation ```bash npm install ``` ## Usage ### REST API Server ```bash npm run serve ``` The server will start at `http://localhost:3000`. ### CLI ```bash npm run search "Your question here" ``` ### MCP Server ```bash npm run mcp ``` ## MCP Configuration To use the search agent as an MCP server in your AI assistant, add this to your configuration: ### Claude Desktop Add to `claude_desktop_config.json`: ```json { "mcpServers": { "search-agent": { "command": "node", "args": ["/path/to/searchAgent/mcpServer.js"], "env": { "EXA_API_KEY": "your-exa-api-key", "OPENROUTER_API_KEY": "your-openrouter-api-key" } } } } ``` ### Other MCP Clients For other MCP clients, configure the command as: - Command: `node` - Args: `["/path/to/searchAgent/mcpServer.js"]` - Environment variables: `EXA_API_KEY` and `OPENROUTER_API_KEY` ## Available MCP Tools ### search Search for information and return a summarized answer with sources. **Parameters:** - `question` (required): The question or topic to search for - `previousClarification` (optional): Previous clarification from the user if the question needed refinement - `originalQuestion` (optional): The original question if this is a follow-up **Example:** ```json { "name": "search", "arguments": { "question": "What are the latest developments in AI?" } } ``` ## Environment Variables Required: - `EXA_API_KEY`: Your Exa API key - `OPENROUTER_API_KEY`: Your OpenRouter API key Optional: - `PORT`: Port for REST server (default: 3000) - `HOST`: Host for REST server (default: 0.0.0.0) - `MAINTENANCE_MODE`: Set to "true" to enable maintenance mode