Skip to content

Commit

Permalink
Enhanced Exa MCP server with comprehensive search capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
Saksham Adhikari authored and Saksham Adhikari committed Dec 16, 2024
1 parent 27cee5d commit e959083
Show file tree
Hide file tree
Showing 4 changed files with 535 additions and 331 deletions.
289 changes: 137 additions & 152 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,205 +1,190 @@
# Exa MCP Server 🔍
# Enhanced Exa MCP Server

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
This is an enhanced fork of the [original Exa MCP server](https://github.com/exa-labs/exa-mcp-server) that provides neural search capabilities using the Exa API. The server enables Large Language Models (LLMs) to search and analyze both academic research papers and news articles with improved semantic understanding.

Demo video https://www.loom.com/share/ac676f29664e4c6cb33a2f0a63772038?sid=0e72619f-5bfc-415d-a705-63d326373f60
## What's New in This Fork

## What is MCP? 🤔
- **Always Comprehensive**: Returns both research papers and news articles for every query
- **Enhanced Result Format**: Includes source domains, relevance scores, and content highlights
- **Improved Error Handling**: Better error messages and type safety
- **Rich Console Output**: Colorized logging for better debugging
- **Type Safety**: Fully typed TypeScript implementation

The Model Context Protocol (MCP) is a system that lets AI apps, like Claude Desktop, connect to external tools and data sources. It gives a clear and safe way for AI assistants to work with local services and APIs while keeping the user in control.
## Prerequisites

## What does this server do? 🚀
- Node.js (v16 or higher)
- NPM
- An Exa API key (get one from [Exa's website](https://exa.ai))

The Exa MCP server:
- Enables AI assistants to perform web searches using Exa's powerful search API
- Provides structured search results including titles, URLs, and content snippets
- Handles rate limiting and error cases gracefully
## Quick Start


## Prerequisites 📋

Before you begin, ensure you have:

- [Node.js](https://nodejs.org/) (v18 or higher)
- [Claude Desktop](https://claude.ai/download) installed
- An [Exa API key](https://dashboard.exa.ai/api-keys)
- Git installed

You can verify your Node.js installation by running:
1. Fork and clone the repository:
```bash
node --version # Should show v18.0.0 or higher
````

## Installation 🛠️

1. Clone the repository:


```
git clone https://github.com/exa-labs/exa-mcp-server.git
# Fork using GitHub's interface, then:
git clone https://github.com/YOUR_USERNAME/exa-mcp-server.git
cd exa-mcp-server
```

2. Install dependencies:
```
npm install --save axios dotenv
# Add original repo as upstream
git remote add upstream https://github.com/exa-labs/exa-mcp-server.git
```

3. Build the project:
```
npm run build
2. Install dependencies:
```bash
npm install
```

4. Create a global link (this makes the server executable from anywhere):
```
npm link
3. Set up your API key:
```bash
echo "EXA_API_KEY=your-api-key-here" > .env
```

## Configuration ⚙️
### 1. Claude Desktop Configuration
Configure Claude Desktop to recognize the Exa MCP server:
You can also find claude_desktop_config.json inside the settings of Claude Desktop app
or
4. Build the server:
```bash
npm run build
```

#### For macOS:
## Connecting to Claude Desktop

1. Open your Claude Desktop configuration:
1. Create or edit your Claude Desktop config:

```
```bash
# On macOS:
mkdir -p ~/Library/Application\ Support/Claude/
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
```

#### For Windows:
1. Open your Claude Desktop configuration:
```
# On Windows:
code %APPDATA%\Claude\claude_desktop_config.json
```

2. Add the Exa server configuration:
```
2. Add the server configuration:
```json
{
"mcpServers": {
"exa": {
"command": "npx",
"args": ["/path/to/exa-mcp-server/build/index.js"],
"env": {
"EXA_API_KEY": "your-api-key-here"
}
"command": "node",
"args": ["/absolute/path/to/exa-mcp-server/build/index.js"]
}
}
}
```

Replace `your-api-key-here` with your actual Exa API key from [dashboard.exa.ai/api-keys](https://dashboard.exa.ai/api-keys).
3. Restart Claude Desktop

### 2. Restart Claude Desktop
## Features

For the changes to take effect:
### Search Capabilities
- Neural search with semantic understanding
- Dual category search (research papers + news)
- Content highlights and summaries
- Source attribution and relevance scoring
- Query caching and history

1. Completely quit Claude Desktop (not just close the window)
2. Start Claude Desktop again
3. Look for the 🔌 icon to verify the Exa server is connected
### Response Format

## Usage 🎯
Every search returns results in this format:
```json
{
"research_papers": {
"results": [
{
"title": "Example Research Paper",
"url": "https://example.edu/paper",
"source": "example.edu",
"relevance_score": 0.95,
"highlights": ["relevant excerpt 1", "relevant excerpt 2"],
"summary": "Brief summary of the paper..."
}
],
"total_found": 100
},
"news_articles": {
"results": [...],
"total_found": 50
},
"query_info": {
"query": "original search query",
"timestamp": "2024-12-16T00:00:00.000Z",
"results_per_category": 10
}
}
```

Once configured, you can ask Claude to perform web searches. Here are some example prompts:
## Development

### Project Structure
```
Can you search for recent developments in quantum computing?
exa-mcp-server/
├── src/
│ └── index.ts # Main server implementation
├── build/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── .env
```

### Staying Updated with Upstream

To get updates from the original repo:
```bash
git fetch upstream
git checkout main
git merge upstream/main
```
Search for and summarize the latest news about artificial intelligence startups in new york.

### Making Changes

1. Create a new branch:
```bash
git checkout -b feature/your-feature-name
```

2. Make your changes and commit:
```bash
git add .
git commit -m "Description of your changes"
```
Find and analyze recent research papers about climate change solutions.

3. Push to your fork:
```bash
git push origin feature/your-feature-name
```

The server will:
## Contributing Back

1. Update your fork with the latest upstream changes
2. Make your improvements in a new branch
3. Push to your fork
4. Create a Pull Request to the original repository
5. Describe your changes and why they're valuable

1. Process the search request
2. Query the Exa API
3. Return formatted results to Claude
4. Cache the search for future reference
## Troubleshooting

## Features ✨
### Common Issues

* **Web Search Tool**: Enables Claude to search the web using natural language queries
* **Error Handling**: Gracefully handles API errors and rate limits
* **Type Safety**: Full TypeScript implementation with proper type checking
1. **Build Errors**
- Make sure TypeScript is installed: `npm install -D typescript`
- Check your Node.js version: `node --version`

## Troubleshooting 🔧
2. **Connection Issues**
- Verify your API key in .env
- Check Claude Desktop config path
- Ensure absolute paths are used

### Common Issues
3. **Type Errors**
- Run `npm install` to get latest types
- Check TypeScript version matches requirements

## Credit

This project is a fork of the [Exa MCP Server](https://github.com/exa-labs/exa-mcp-server) created by Exa Labs. The original work laid the foundation for this enhanced version.

## License

This project is licensed under the MIT License - see the LICENSE file for details.

## Acknowledgments

1. **Server Not Found**
* Verify the npm link is correctly set up
* Check Claude Desktop configuration syntax
* Ensure Node.js is properly installed
2. **API Key Issues**
* Confirm your Exa API key is valid
* Check the API key is correctly set in the Claude Desktop config
* Verify no spaces or quotes around the API key
3. **Connection Issues**
* Restart Claude Desktop completely
* Check Claude Desktop logs:
```
# macOS
tail -n 20 -f ~/Library/Logs/Claude/mcp*.log
```
### Getting Help
If you encounter issues review the [MCP Documentation](https://modelcontextprotocol.io)
## Acknowledgments 🙏
* [Exa AI](https://exa.ai) for their powerful search API
* [Model Context Protocol](https://modelcontextprotocol.io) for the MCP specification
* [Anthropic](https://anthropic.com) for Claude Desktop
- [Original Exa MCP Server](https://github.com/exa-labs/exa-mcp-server)
- [Model Context Protocol](https://github.com/modelcontextprotocol)
- [Exa API](https://exa.ai)
- [Claude by Anthropic](https://anthropic.com)
Loading

0 comments on commit e959083

Please sign in to comment.