MCP ExplorerExplorer

Researchmcp

@chew-zon 10 months ago
1 MIT
FreeCommunity
AI Systems
#golang#mcp-server#perplexity-api
MCP server for Perplexity

Overview

What is Researchmcp

ResearchMCP is a Model Completion Protocol (MCP) service designed for internet research using Perplexity AI. It provides a ‘research’ tool that allows users to query Perplexity AI’s API for comprehensive and current information on various topics.

Use cases

Use cases for ResearchMCP include conducting literature reviews, gathering data for reports, answering complex queries in real-time, and supporting decision-making processes with up-to-date information.

How to use

To use ResearchMCP, set up the required environment variables, build the service using Go, and run it. An example .env file is provided to help configure the necessary parameters, including the Perplexity API key and model settings.

Key features

Key features of ResearchMCP include internet research capabilities through Perplexity AI, integration with the MCP protocol for tool discovery, graceful error handling with a degraded mode, configurable environment variables, and structured logging.

Where to use

ResearchMCP can be used in various fields such as academic research, market analysis, content creation, and any area requiring in-depth information retrieval from the internet.

Content

ResearchMCP

A Model Completion Protocol (MCP) service for internet research using Perplexity AI.

Overview

ResearchMCP is a service that provides internet research capabilities through the MCP protocol. It exposes a “research” tool that allows querying Perplexity AI’s API for in-depth, up-to-date information on a wide range of topics.

Features

  • Internet research through Perplexity AI
  • Integration with MCP protocol for tool discovery and invocation
  • Graceful error handling with degraded mode
  • Configurable through environment variables
  • Structured logging

Requirements

  • Go 1.18 or later
  • Perplexity AI API key

Configuration

The service is configured through environment variables:

Variable Description Required Default
PERPLEXITY_API_KEY API key for Perplexity AI Yes -
PERPLEXITY_MODEL Model to use for research No sonar-medium-online
PERPLEXITY_TIMEOUT Timeout in seconds for API requests No 90
PERPLEXITY_MAX_RETRIES Maximum number of retry attempts No 2
PERPLEXITY_INITIAL_BACKOFF Initial backoff time in seconds No 1
PERPLEXITY_MAX_BACKOFF Maximum backoff time in seconds No 10

Usage

  1. Set up the required environment variables (you can use a .env file)
  2. Build and run the service:
go build
./ResearchMCP

Example .env file

PERPLEXITY_API_KEY=your_api_key_here
PERPLEXITY_MODEL=sonar-medium-online
PERPLEXITY_TIMEOUT=120
PERPLEXITY_MAX_RETRIES=3
PERPLEXITY_INITIAL_BACKOFF=2
PERPLEXITY_MAX_BACKOFF=15

API

Research Tool

Name: research

Input Schema:

{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "The research query or question"
    }
  },
  "required": [
    "query"
  ]
}

Example Request:

{
  "name": "research",
  "arguments": {
    "query": "What is the current state of quantum computing?"
  }
}

Example Response:

{
  "content": [
    {
      "type": "text",
      "text": "Comprehensive research report on quantum computing...\n\nSources:\n- https://example.com/source1\n- https://example.com/source2"
    }
  ]
}

Development

Project Structure

  • main.go: Application entry point
  • config.go: Configuration handling
  • logger.go: Logging infrastructure
  • perplexity.go: Perplexity API integration
  • structs.go: Data structures
  • context.go: Context handling

Code Style

Run formatting and linting with the provided scripts:

./run_format.sh
./run_lint.sh

License

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

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers