# Navigation Equipment Manuals MCP Server

A Model Context Protocol (MCP) server for accessing and searching navigation equipment manuals. This server provides intelligent search capabilities across maritime equipment documentation including radar, GPS, ECDIS, AIS, and other navigation systems.

## Features

- **Smart Search**: AI-powered semantic search with Cohere reranking
- **Equipment Catalog**: Browse manufacturers, equipment types, and models
- **Manual Discovery**: Find specific manuals by equipment specifications
- **Content Search**: Deep search within manual content
- **Web Search**: Integrated Google search via Perplexity AI
- **Interactive Results**: Browser-friendly artifacts for easy document access

## Installation

```bash
npm install
npm run build
```

## Configuration

The server supports both environment variables and command-line arguments for configuration. Command-line arguments take precedence over environment variables.

### Required Configuration

| Environment Variable | Command Line Argument | Description |
|---------------------|----------------------|-------------|
| `MONGO_URI` | `--mongo-uri` | MongoDB connection URI |
| `TYPESENSE_HOST` | `--typesense-host` | Typesense server host |
| `TYPESENSE_PORT` | `--typesense-port` | Typesense server port |
| `TYPESENSE_PROTOCOL` | `--typesense-protocol` | Typesense protocol (http/https) |
| `TYPESENSE_API_KEY` | `--typesense-api-key` | Typesense API key |

### Optional Configuration

| Environment Variable | Command Line Argument | Description |
|---------------------|----------------------|-------------|
| `DB_NAME` | `--db-name` | MongoDB database name |
| `OPENAI_API_KEY` | `--openai-api-key` | OpenAI API key for LLM features |
| `COHERE_API_KEY` | `--cohere-api-key` | Cohere API key for search reranking |
| `PERPLEXITY_API_KEY` | `--perplexity-api-key` | Perplexity API key for web search |

## Usage Examples

### Using Environment Variables

```bash
# Set environment variables
export MONGO_URI="mongodb://localhost:27017"
export TYPESENSE_HOST="localhost"
export TYPESENSE_PORT="8108"
export TYPESENSE_PROTOCOL="http"
export TYPESENSE_API_KEY="your-typesense-api-key"
export COHERE_API_KEY="your-cohere-api-key"
export PERPLEXITY_API_KEY="your-perplexity-api-key"

# Run the server
node dist/index.js
```

### Using Command Line Arguments

```bash
node dist/index.js \
  --mongo-uri "mongodb://localhost:27017" \
  --typesense-host "localhost" \
  --typesense-port "8108" \
  --typesense-protocol "http" \
  --typesense-api-key "your-typesense-api-key" \
  --cohere-api-key "your-cohere-api-key" \
  --perplexity-api-key "your-perplexity-api-key"
```

### Mixed Configuration

```bash
# Set some variables in environment
export MONGO_URI="mongodb://localhost:27017"
export TYPESENSE_HOST="localhost"

# Override others via command line
node dist/index.js \
  --typesense-port "8108" \
  --typesense-protocol "https" \
  --typesense-api-key "your-typesense-api-key"
```

### Help

```bash
node dist/index.js --help
```

## Available Tools

### 1. smart_navigation_manual_search
Universal search tool for navigation equipment manuals with AI-powered reranking.

**Parameters:**
- `query` (string): Natural language search query
- `search_type` (string): Search strategy (default: "semantic")
- `filters` (object): Optional filters for maker, model, equipment, etc.
- `max_results` (number): Maximum results to return (1-10)

### 2. list_equipment_manufacturers
Retrieves all available equipment manufacturers.

### 3. list_navigation_equipment_types
Lists navigation equipment categories, optionally filtered by manufacturer.

**Parameters:**
- `maker` (string, optional): Filter by specific manufacturer

### 4. list_navigation_equipment_models
Lists equipment models with optional filtering.

**Parameters:**
- `maker` (string, optional): Filter by manufacturer
- `equipment` (string, optional): Filter by equipment type

### 5. find_equipment_manuals
Finds manuals for specific equipment specifications.

**Parameters:**
- `maker` (string, optional): Equipment manufacturer
- `model` (string, optional): Equipment model
- `equipment` (string, optional): Equipment type

### 6. search_manual_content
Semantic search within manual content with optional filtering.

**Parameters:**
- `maker` (string, optional): Equipment manufacturer
- `model` (string, optional): Equipment model
- `equipment` (string, optional): Equipment type
- `manual_type` (string, optional): Manual type (installation, operation, service)
- `user_query` (string, optional): Search query

### 7. google_search
Web search using Perplexity AI.

**Parameters:**
- `query` (string): Search query

## Supported Equipment

### Manufacturers
FURUNO, JRC, SIMRAD, KODEN, SPERRY MARINE, SAM ELECTRONICS, SAILOR, SAAB, RAYTHEON, RAYTHEON ANSCHUTZ, ANSCHUTZ, SKIPPER, NINGLU, INMARSAT, DANELEC MARINE, and more.

### Equipment Types
- **Navigation**: AIS, RADAR, GPS, GYRO, AUTO PILOT
- **Communication**: VHF, MF-HF, NAVTEX, INMARSAT-C, SATC
- **Safety**: VDR, BNWAS, SSAS
- **Measurement**: SPEED LOG, ECHO-SOUNDER, ANEMOMETER
- **Display**: ECDIS
- **Other**: FBB, WEATHER FAX, PUBLIC ALARM SYSTEM

## Development

```bash
# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode
npm run dev
```

## Architecture

- **MongoDB**: Document storage for manual metadata
- **Typesense**: Full-text search and semantic search engine
- **Cohere**: AI reranking for improved search relevance
- **Perplexity AI**: Web search capabilities
- **MCP Protocol**: Standard interface for AI model integration

## License

MIT License

## Support

For questions, issues, or feature requests, please:
1. Check the debug logs
2. Review the troubleshooting section
3. Open an issue on the repository

---

**Navigation Equipment Manuals MCP Server** - Making maritime documentation searchable and accessible through AI-powered tools. 