chew_z_researchmcp

chew_z_researchmcp

by chew-z
A Model Completion Protocol (MCP) service for internet research using Perplexity AI.

Perplexity Ask MCP Server: Internet Research with Perplexity AI

Overview

ResearchMCP is a service that provides internet research capabilities through the Model Completion Protocol (MCP). It integrates with Perplexity AI's API to deliver in-depth, up-to-date information on a wide range of topics. This service is designed to expose a "research" tool that allows users to query Perplexity AI for comprehensive research results.

Features

  • Internet Research: Leverage Perplexity AI for detailed and current information.
  • MCP Protocol Integration: Seamlessly integrates with MCP for tool discovery and invocation.
  • Error Handling: Graceful degradation with robust error handling.
  • Configurable: Easily configured through environment variables.
  • Structured Logging: Provides detailed logs for debugging and monitoring.

Requirements

  • Go 1.18 or later: Ensure you have the correct version of Go installed.
  • Perplexity AI API Key: Obtain an API key from Perplexity AI.

Configuration

The service is configured using 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

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

Usage

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

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.

About

ResearchMCP is a service designed to provide internet research capabilities through the MCP protocol, leveraging Perplexity AI for accurate and up-to-date information.

Features & Capabilities

Categories
mcp_server model_context_protocol go perplexity api_integration search internet_research

Implementation Details

Stats

0 Views
1 GitHub Stars

Repository Info

chew-z Organization

Similar MCP Servers

continuedev_continue by continuedev
25049
21423
9300