# Enjoy Nepal MCP Service

**Die Experten für Trekking in Nepal** | [www.enjoy-nepal.de](https://www.enjoy-nepal.de)

Public API for searching and retrieving trek information, comparing trips, and creating booking requests.

## Overview

The Enjoy Nepal MCP (Model Context Protocol) Service provides a standardized JSON-RPC 2.0 interface for AI applications and developers to:

- **Search** for trekking and tour destinations
- **Browse** detailed trip information with pricing, itineraries, and FAQs
- **Compare** multiple trips side-by-side
- **Create** booking requests
- **Access** legal pages (Terms, Privacy, Imprint)

## Quick Start

### Endpoint
```
https://www.enjoy-nepal.de/mcp/
```

### Authentication
By default the service is public. When `MCP_API_KEYS` contains comma-separated keys,
send `Authorization: Bearer <key>` or `X-API-Key: <key>`. Authentication also applies
to initialization and notifications. The healthcheck remains public.

### Initialization and HTTP Transport

The endpoint supports stateless Streamable HTTP with JSON responses (no SSE stream
or `Mcp-Session-Id`). Supported protocol versions are `2025-06-18` and `2025-03-26`.
`MCP_API_VERSION` is the service version, not the MCP protocol version.

Start with `initialize`:

```bash
curl -X POST https://www.enjoy-nepal.de/mcp/ \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"example-client","version":"1.0"}}}'
```

The response contains the negotiated `protocolVersion`, `serverInfo` and
`capabilities.tools.listChanged=false`. An unsupported requested version is answered
with the newest supported version; a client unable to use it should disconnect.

Then POST `{"jsonrpc":"2.0","method":"notifications/initialized"}` without an `id`.
Accepted notifications receive HTTP 202 with an empty body. `ping` returns `{}`.
On subsequent requests send `MCP-Protocol-Version` with the negotiated version.
An invalid/unsupported version header receives HTTP 400.

GET on the MCP endpoint returns 405 (no SSE); the former health JSON is available
at `https://www.enjoy-nepal.de/mcp/?health=1`. Handshake, ping and tool discovery
do not load the application/database bootstrap. Business tool calls still do.
For compatibility, legacy direct `tools/list` and `tools/call` requests remain accepted;
no per-client initialization state is enforced.

Requests with an `Origin` header must match the endpoint's scheme and host, or an
explicit comma-separated `MCP_ALLOWED_ORIGINS` allowlist. Configure this allowlist
for trusted cross-origin clients or TLS termination at a reverse proxy.

### Tool Discovery

After initialization, list the available tools:

```bash
curl -X POST https://www.enjoy-nepal.de/mcp/ \
  -H "Content-Type: application/json" \
  -H 'Accept: application/json, text/event-stream' \
  -H 'MCP-Protocol-Version: 2025-06-18' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list"
  }'
```

### Local Verification

Run the dedicated protocol checks with PowerShell 7:

```powershell
./tests/mcp_test_protocol.ps1 -Uri http://127.0.0.1:3087/ -ApiKey '<local-test-key>'
```

This checks handshake, version negotiation, notifications, ping, all nine tool
schemas, invalid requests, HTTP status codes and API-key rejection (when a key is
provided). It does not execute business tools or connect to a database. The URI is
local by default. A separate local check with the official TypeScript MCP SDK
confirmed initialization, initialized notification, ping and tool discovery.

`tests/mcp_test_all.ps1` additionally calls business tools and booking-validation paths;
run it only against an explicitly approved test environment. It now initializes
the connection first and accepts an optional `-ApiKey` argument.

## Available Tools

### 1. search_trips
Search for treks and tours by keyword.

**Parameters:**
- `query` (string, required): Search term (min 2 characters, e.g., "Everest", "Hiking")

**Example:**
```json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "search_trips",
    "arguments": {
      "query": "Everest"
    }
  }
}
```

### 2. get_trip_details
Get comprehensive information about a specific trek.

**Parameters:**
- `slug` (string, required): Trip identifier (e.g., "Everest-Basecamp-Trekking")
- `include_reviews` (boolean, optional): Include compact public reviews in the response (default: `false`)
- `reviews_limit` (integer, optional): Number of embedded reviews when `include_reviews=true` (1-10, default: `3`)
- `reviews_min_stars` (integer, optional): Minimum rating for embedded reviews (1-5, default: `1`)

**Includes:**
- Full itinerary with daily descriptions
- Pricing by season and group size
- Difficulty, duration, altitude
- FAQ and reviews
- Included and excluded services
- Source/freshness metadata (`source_url`, `updated_at`, `response_meta`)

**Example:**
```json
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "get_trip_details",
    "arguments": {
      "slug": "Everest-Basecamp-Trekking",
      "include_reviews": true,
      "reviews_limit": 3,
      "reviews_min_stars": 4
    }
  }
}
```

### 3. get_trip_faq
Get frequently asked questions for a trek.

**Parameters:**
- `slug` (string, required): Trip identifier

**Example:**
```json
{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
    "name": "get_trip_faq",
    "arguments": {
      "slug": "Everest-Basecamp-Trekking"
    }
  }
}
```

### 4. get_trip_reviews
Get public customer reviews for one trek by slug or tour id.

**Parameters:**
- `slug` (string, optional): Trip identifier
- `tour_id` (integer, optional): Internal tour id (if slug is not provided)
- `max_results` (integer, optional): 1-20 (default: 10)
- `min_stars` (integer, optional): 1-5 (default: 1)

**Allowed review fields:**
- `received` (unix timestamp)
- `received_iso` (ISO timestamp)
- `vorname` (string)
- `wohnort` (string)
- `filename` (base URL filename)
- `stars` (1-5)

**Additional metadata fields:**
- `source_url` (trip URL)
- `updated_at` (latest known review timestamp)
- `response_meta` (generated_at, data_version, source details)

**Example:**
```json
{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "tools/call",
  "params": {
    "name": "get_trip_reviews",
    "arguments": {
      "slug": "Everest-Basecamp-Trekking",
      "max_results": 10,
      "min_stars": 4
    }
  }
}
```

### 5. search_faq
Search across all general Nepal FAQ pages by keyword.

**Parameters:**
- `query` (string, required): Search term (min 2 characters, e.g., "Visum", "Höhenkrankheit")
- `max_results` (integer, optional): 1-20 (default: 5)

**Example:**
```json
{
  "jsonrpc": "2.0",
  "id": 6,
  "method": "tools/call",
  "params": {
    "name": "search_faq",
    "arguments": {
      "query": "Visum",
      "max_results": 3
    }
  }
}
```

**Response fields:**
- `count` (integer)
- `results` (array) with `node_name`, `page_title`, `url`, `question`, `answer`

### 6. get_faq_page
Get general Nepal FAQ content (for example visa, health, packing list, travel times).

**Parameters:**
- `topic` (string, required): One of `reisebestimmungen`, `reisehinweise`, `versicherungen`, `geld_bezahlen`, `equipment`, `unterkunft`, `verpflegung`, `gesundheit`, `hoehenkrankheit`, `schwierigkeitsgrade`, `reisezeiten`, `trekking`

**Example:**
```json
{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "tools/call",
  "params": {
    "name": "get_faq_page",
    "arguments": {
      "topic": "reisebestimmungen"
    }
  }
}
```

### 7. compare_trips
Compare 2-4 trips side-by-side.

**Parameters:**
- `slugs` (array of strings, required): 2-4 trip identifiers

**Example:**
```json
{
  "jsonrpc": "2.0",
  "id": 8,
  "method": "tools/call",
  "params": {
    "name": "compare_trips",
    "arguments": {
      "slugs": ["Everest-Basecamp-Trekking", "Annapurna-Basecamp-Trek"]
    }
  }
}
```

**Response fields:**
- `count` (integer)
- `comparison` (array of normalized trip summaries)

### 8. create_booking_request
Submit a booking inquiry for a trek.

**Parameters:**
- `trip_slug` (string, required): Trip identifier
- `name` (string, required): Full name (min 2 chars)
- `email` (string, required): Contact email
- `participants` (integer, required): Number of participants (1-99)
- `travel_date` (string, required): Preferred start date (YYYY-MM-DD)
- `message` (string, optional): Special requests or notes
- `gender_id` (string, optional): One of `M`, `W`, `D`

**Example:**
```json
{
  "jsonrpc": "2.0",
  "id": 9,
  "method": "tools/call",
  "params": {
    "name": "create_booking_request",
    "arguments": {
      "trip_slug": "Everest-Basecamp-Trekking",
      "name": "John Doe",
      "email": "user@example.com",
      "participants": 2,
      "travel_date": "2026-10-15",
      "message": "We would like a private guide.",
      "gender_id": "M"
    }
  }
}
```

### 9. get_legal_page
Retrieve legal pages (Terms, Privacy, Imprint).

**Parameters:**
- `page` (string, required): One of `"agb"` (Terms), `"datenschutz"` (Privacy), `"impressum"` (Imprint)

**Example:**
```json
{
  "jsonrpc": "2.0",
  "id": 10,
  "method": "tools/call",
  "params": {
    "name": "get_legal_page",
    "arguments": {
      "page": "agb"
    }
  }
}
```

**Response fields:**
- `page` (string)
- `source` (string, currently `_cache`)
- `content_html` (string)

## Response Format

All responses follow the JSON-RPC 2.0 standard.

### Successful Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{...tool payload as JSON string...}"
      }
    ],
    "isError": false
  }
}
```

Parse the actual tool payload from `result.content[0].text`.

### Error Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32602,
    "message": "query must be at least 2 characters",
    "data": {
      "type": "validation_error"
    }
  }
}
```

## Common Error Codes

| Code | Meaning | Action |
|------|---------|--------|
| -32602 | Invalid parameters | Check tool documentation and parameter values |
| -32601 | Tool/method not found | Verify tool name |
| -32002 | Temporary service error | Retry after a few seconds |
| -32000 | Server error | Contact support if persists |

## Integration

### Python Example

```python
import requests
import json

url = "https://www.enjoy-nepal.de/mcp/"
payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list"
}

response = requests.post(url, json=payload)
result = response.json()
print(json.dumps(result, indent=2))
```

### JavaScript/Node.js Example

```javascript
const fetch = require('node-fetch');

const url = "https://www.enjoy-nepal.de/mcp/";
const payload = {
  jsonrpc: "2.0",
  id: 1,
  method: "tools/list"
};

fetch(url, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(payload)
})
.then(r => r.json())
.then(data => console.log(JSON.stringify(data, null, 2)));
```

## Rate Limits & Stability

- **Timeout**: 25 seconds per request
- **Caching**: Data is cached and refreshed daily
- **Reliability**: SLA-backed for production use

## Client Configuration

For AI applications (Claude Desktop, Cursor, Windsurf, VS Code):

```json
{
  "mcpServers": {
    "enjoy-nepal-mcp": {
      "type": "remote",
      "url": "https://www.enjoy-nepal.de/mcp/"
    }
  }
}
```

**For detailed step-by-step setup guides for each client, see:** [Client Configuration Guide](./tests/client-config-snippets.md)

## Support

- **Website**: [www.enjoy-nepal.de](https://www.enjoy-nepal.de)
- **Documentation**: See [Full Technical Docs](./readme.md)
- **Discovery**: https://www.enjoy-nepal.de/.well-known/mcp.json
- **Contact**: info@enjoy-nepal.de

## Status

- **API Version**: 1.1.0
- **Status**: Production
- **Last Updated**: 2026-06-27

---

**Die Experten für Trekking in Nepal**  
https://www.enjoy-nepal.de
