Presearch MCP Server

Presearch MCP Server

Enables privacy-focused web searches through the Presearch API and web content scraping. Supports multi-language search, configurable safe search, result caching, and multiple export formats (JSON, CSV, Markdown).

Category
访问服务器

README

Presearch MCP Server

npm version License: MIT Node.js Version MCP Compatible

A Model Context Protocol (MCP) server that provides seamless integration with the Presearch API, enabling privacy-focused search capabilities and web scraping functionality for AI assistants.

Features

  • 🔍 Privacy-focused search through Presearch API
  • 🌐 Web content scraping with intelligent extraction
  • 🔌 MCP Protocol compliance for seamless AI assistant integration
  • 📊 Search result caching for improved performance
  • 🛡️ Configurable safe search options
  • 🗂️ Multiple export formats (JSON, CSV, Markdown)
  • 🌍 Multi-language support for search and UI
  • 📈 Performance insights and analytics

Installation

npm install presearch-mcp-server

Quick Start

  1. Clone the repository:
git clone https://github.com/NosytLabs/presearch-search-api-mcp.git
cd presearch-search-api-mcp
  1. Install dependencies:
npm install
  1. Copy and configure the environment variables:
cp .env.example .env
# Edit .env with your Presearch API key and other settings
  1. Start the server:
npm start

MCP Configuration

To use this server with an MCP client, add the following to your MCP client configuration:

{
  "mcpServers": {
    "presearch": {
      "command": "node",
      "args": ["path/to/presearch-mcp-server/src/server/server.js"]
    }
  }
}

Available Tools

Search Tools

search

Perform a search query using the Presearch API.

Parameters:

  • query (string, required): Search query
  • ip (string, required): IP address of the user
  • count (number, optional): Number of results (1-20, default 10)
  • offset (number, optional): Pagination offset (default 0)
  • country (string, optional): Country code (e.g., US, GB)
  • search_lang (string, optional): Search language (e.g., en, es)
  • ui_lang (string, optional): UI language (e.g., en-US)
  • safesearch (string, optional): Safe search level (off, moderate, strict)
  • freshness (string, optional): Time filter (pd, pw, pm, py)
  • useCache (boolean, optional): Whether to use cached results

Example:

{
  "query": "Model Context Protocol",
  "ip": "192.168.1.1",
  "count": 5,
  "search_lang": "en",
  "safesearch": "moderate"
}

export_results

Export search results in different formats.

Parameters:

  • query (string, required): Search query to export
  • ip (string, required): IP address of the user
  • format (string, required): Export format (json, csv, markdown)
  • count (number, optional): Number of results to export
  • country (string, optional): Country code for search

Web Scraping Tools

scrape_content

Extract content from a web page.

Parameters:

  • url (string, required): URL to scrape content from
  • extractText (boolean, optional): Extract text content
  • extractLinks (boolean, optional): Extract links
  • extractImages (boolean, optional): Extract images
  • includeMetadata (boolean, optional): Include page metadata

Cache Management Tools

cache_stats

Get statistics about the search result cache.

cache_clear

Clear the search result cache.

health_check

Check the health status of the MCP server.

Usage Examples

Basic Search

const searchResults = await client.call("search", {
  "query": "artificial intelligence",
  "ip": "192.168.1.1",
  "count": 10,
  "search_lang": "en"
});

Web Scraping

const pageContent = await client.call("scrape_content", {
  "url": "https://example.com",
  "extractText": true,
  "extractLinks": true,
  "includeMetadata": true
});

Export to CSV

const csvExport = await client.call("export_results", {
  "query": "machine learning",
  "ip": "192.168.1.1",
  "format": "csv",
  "count": 50
});

Configuration

The server can be configured using environment variables or a configuration file:

Environment Variables

  • PRESEARCH_API_KEY: Your Presearch API key (required)
  • SERVER_HOST: Host address for the MCP server (default: localhost)
  • SERVER_PORT: Port for the MCP server (default: 3000)
  • CACHE_SIZE: Maximum number of cached results (default: 100)
  • CACHE_TTL: Cache time-to-live in seconds (default: 3600)
  • LOG_LEVEL: Logging level (error, warn, info, debug)

Configuration File

Create a config/config.json file with the following structure:

{
  "presearch": {
    "apiKey": "your-api-key",
    "defaultCountry": "US",
    "defaultLanguage": "en",
    "safeSearch": "moderate"
  },
  "server": {
    "host": "localhost",
    "port": 3000
  },
  "cache": {
    "enabled": true,
    "maxSize": 100,
    "ttl": 3600
  },
  "logging": {
    "level": "info"
  }
}

Testing

Run the test suite:

# Run basic tests
npm test

# Run MCP protocol tests
npm run test:mcp

# Run all tests
npm run test:all

Development

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and commit them: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature-name
  5. Submit a pull request

API Reference

For detailed API documentation, see the API Reference.

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

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

Support

Related Projects

#presearch #mcp

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选