神经搜索服务器

一个企业级的模型上下文协议(MCP)服务器,提供全面的AI驱动的搜索能力,适用于需要理解语义和上下文的高质量内容搜索场景。

  • by Rchintalapati0111
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 rchintalapati0111/exa_mcp_server

使用说明

Exa MCP服务器

演示链接(正确性证明): https://drive.google.com/drive/folders/1WZAcuS1ecK2d7VdmgWYsTilwny2oVfzv?dmr=1&ec=wgc-驱动英雄goto

企业级 模型上下文协议(MCP)服务器 提供全面的访问 Exa 的 人工智能驱动的搜索功能。通过理解意义和上下文的神经搜索来转换您的人工智能应用程序,非常适合在网络上找到高质量、相关的内容。

特性

核心搜索功能

  • 神经搜索 -基于人工智能的语义搜索,能够理解含义和上下文
  • 关键字搜索 -具有精确关键字匹配的传统搜索
  • 内容提取 -从网页中提取全文内容
  • 相似性匹配 -使用先进的AI相似性算法查找相似内容

高级功能

  • 智能过滤 -按域、日期、内容类别等筛选
  • 元数据 -获取相关性得分、发布日期、作者和摘要
  • 灵活的配置 -为不同用例自定义搜索参数
  • 高性能 -针对速度和可靠性进行了优化
  • 错误处理 -全面的错误处理和记录

内容类别

按特定内容类型筛选搜索结果:

  • 🏢 公司和LinkedIn个人资料
  • 📚 研究论文和学术内容
  • 📰 新闻文章和媒体
  • 💻 GitHub存储库和技术内容
  • 🐦 社交媒体帖子(推特)
  • 🎬 娱乐内容(电影、歌曲)
  • 📋 个人网站和PDF

🚀 快速开始

先决条件

安装

  1. 克隆存储库

    git clone https://github.com/Rchintalapati0111/exa_mcp_server.git
    cd exa_mcp_server
    
  2. 安装依赖项

    npm install
    
  3. 设置Exa API密钥

    export EXA_API_KEY="your_exa_api_key_here"
    
  4. 构建项目

    npm run build
    
  5. 测试服务器

    # Start the server
    npm start
    
    # In another terminal, test the tools
    echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | npm start
    

🔧 配置

Claude桌面集成

将以下内容添加到您的Claude Desktop配置文件中:

地点:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 窗户: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "exa-search": {
      "command": "node",
      "args": ["/path/to/your/exa_mcp_server/build/index.js"],
      "env": {
        "EXA_API_KEY": "your_exa_api_key_here"
      }
    }
  }
}

发展模式

对于自动重新加载的开发:

# Install tsx globally (recommended)
npm install -g tsx

# Run in development mode
npm run dev

环境变量

变量 必填 描述 默认值
EXA_API_KEY ✅ 您的Exa API密钥 -
NODE_ENV ❌ 环境模式 production

🛠️ 可用工具

1. exa_search

基于人工智能的网络搜索,具有神经理解能力

// Basic search
{
  "query": "latest developments in quantum computing",
  "num_results": 10,
  "type": "neural"
}

// Advanced search with filters
{
  "query": "machine learning research papers",
  "num_results": 20,
  "type": "neural",
  "category": "research paper",
  "start_published_date": "2024-01-01",
  "include_domains": ["arxiv.org", "nature.com"],
  "include_summary": true
}

参数:

  • query (必填):搜索查询字符串
  • num_results:结果数(1-100,默认值:10)
  • type:“neural”或“关键字”(默认值:“neurar”)
  • include_domains:要包含的域数组
  • exclude_domains:要排除的域数组
  • start_published_date/end_published_date:日期范围(YYYY-MM-DD)
  • category:内容类型筛选器
  • include_text:包括全文内容
  • include_summary:包括人工智能生成的摘要
  • use_autoprompt:让Exa增强您的查询(默认值:true)

2. exa_get_contents

从网页中提取全文内容

// Extract content from URLs
{
  "urls": [
    "https://example.com/article1",
    "https://example.com/article2"
  ],
  "text_length_limit": 5000
}

// Extract content from Exa result IDs
{
  "ids": ["result_id_1", "result_id_2"],
  "include_html": true
}

参数:

  • urls 或 ids (必填):URL或考试结果ID
  • text_length_limit:每页最大字符数(100-50000,默认值:5000)
  • include_html:在文本旁边包含HTML内容

3. exa_find_similar

查找与给定URL类似的网页

{
  "url": "https://openai.com/blog/chatgpt",
  "num_results": 15,
  "category": "news",
  "include_text": true
}

参数:

  • url (必填):相似性搜索的参考URL
  • num_results:相似结果的数量(1-100,默认值:10)
  • include_domains/exclude_domains:域筛选器
  • category:内容类型筛选器
  • include_text:在结果中包含内容

📖 使用示例

基本网络搜索

# Neural search for AI topics
echo '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "exa_search",
    "arguments": {
      "query": "artificial intelligence breakthroughs 2024",
      "num_results": 5,
      "include_summary": true
    }
  }
}' | npm start

研究论文发现

# Find recent ML research papers
echo '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "exa_search",
    "arguments": {
      "query": "transformer architecture improvements",
      "category": "research paper",
      "include_domains": ["arxiv.org"],
      "start_published_date": "2024-01-01",
      "num_results": 10
    }
  }
}' | npm start

内容提取

# Extract content from specific URLs
echo '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "exa_get_contents",
    "arguments": {
      "urls": ["https://example.com/article"],
      "text_length_limit": 3000
    }
  }
}' | npm start

🏗️ 发展

项目结构

exa_mcp_server/
├── src/
│   └── index.ts              # Main server implementation
├── .gitignore               # Properly excluding build files
├── README.md                # Comprehensive documentation ✅
├── claude_desktop_config.json # Example configuration
├── package-lock.json        # Dependency lock file
├── package.json             # Project configuration
└── tsconfig.json           # TypeScript configuration

建筑

# Clean build
npm run build

# Development with watch mode
npm run dev

# Type checking
npx tsc --noEmit

代码质量

# Linting
npm run lint

# Formatting
npm run format

# Run tests
npm test

添加新功能

  1. 分叉存储库
  2. 创建要素分支 (git checkout -b feature/amazing-feature)
  3. 进行更改 使用正确的TypeScript类型
  4. 添加测试 对于新功能
  5. 更新文档 根据需要
  6. 提交拉取请求

🐛 故障排除

常见问题

❌ “需要EXA_API_KEY环境变量”

# Solution: Set your API key
export EXA_API_KEY="your_actual_api_key"

❌ “网络错误”或“连接被拒绝”

  • 检查您的互联网连接
  • 验证您的API密钥是否有效
  • 确保您没有超过费率限制

❌ “未知工具”错误

  • 配置更改后重新启动Claude Desktop
  • 验证服务器是否正常运行
  • 检查MCP配置文件路径

❌ TypeScript编译错误

# Clean and rebuild
rm -rf build/
npm run build

调试模式

启用详细日志记录:

NODE_ENV=development npm start

性能提示

  1. 使用适当 num_results -不要要求超出所需的结果
  2. 筛选域 -使用 include_domains 实现更快、更专注的搜索
  3. 限制文本内容 -调整 text_length_limit 根据您的需求
  4. 缓存结果 -在本地存储经常访问的内容

📊 API限制和定价

  • 费率限制: Exa API对大多数用例都有慷慨的费率限制
  • 定价: 检查 例如,ai定价 对于当前汇率
  • 免费等级: 可用于开发和测试

开发设置

# Clone and setup
git clone https://github.com/Rchintalapati0111/exa_mcp_server.git
cd exa_mcp_server
npm install

# Set up pre-commit hooks
npm run prepare