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
Visit Server

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured