Skip to main content
Glama
README.md
# haksnbot-map

An MCP (Model Context Protocol) server that provides persistent location storage for AI agents. Uses SQLite with full-text search for efficient storage and retrieval of named locations with coordinates, tags, and spatial queries.

> **Part of the Haksnbot suite:** This project was originally developed as part of [Haksnbot](https://github.com/haksndot), an autonomous Minecraft bot. The suite includes five repos that work together: [haksnbot-tools](https://github.com/haksndot/haksnbot-tools) (Minecraft bot control), [haksnbot-mind](https://github.com/haksndot/haksnbot-mind) (the autonomous agent), [haksnbot-admin](https://github.com/haksndot/haksnbot-admin) (server administration), [haksnbot-memory](https://github.com/haksndot/haksnbot-memory) (persistent memory), and [haksnbot-map](https://github.com/haksndot/haksnbot-map) (this repo - location storage). Each can be used independently, but they're designed to work together.

## Features

- **Named locations** - Store places with unique names (e.g., "spawn", "my_base", "nether_hub")
- **Full coordinates** - X, Y, Z with dimension support (overworld, nether, end)
- **Tagging system** - Organize locations with flexible tags (e.g., "farm", "public", "danger")
- **Full-text search** - Find locations by name, description, or tags using FTS5
- **Spatial queries** - Find nearest locations, search within radius, calculate distances
- **Nether math** - Convert coordinates between overworld and nether (÷8 or ×8)

## Installation

```bash
git clone https://github.com/haksndot/haksnbot-map.git
cd haksnbot-map
npm install
```

## Usage with Claude Code

Add to your Claude Code MCP settings (`~/.claude/settings.json`):

```json
{
  "mcpServers": {
    "map": {
      "command": "node",
      "args": ["/path/to/haksnbot-map/src/index.js"]
    }
  }
}
```

## Configuration

The database path can be set via environment variable:

```json
{
  "mcpServers": {
    "map": {
      "command": "node",
      "args": ["/path/to/haksnbot-map/src/index.js"],
      "env": {
        "MAP_DB_PATH": "/path/to/locations.db"
      }
    }
  }
}
```

If not set, defaults to `locations.db` in the package directory.

## Available Tools

### Core Operations

| Tool | Description |
|------|-------------|
| `save_location` | Save a named location with coordinates, dimension, description, tags, and owner |
| `get_location` | Retrieve a specific location by name |
| `list_locations` | List all locations with optional dimension/owner filtering |
| `delete_location` | Remove a saved location |

### Search & Tags

| Tool | Description |
|------|-------------|
| `search_locations` | Full-text search across names, descriptions, and tags |
| `find_by_tags` | Find locations with specific tags (match all or any) |
| `list_tags` | Get all unique tags with usage counts |
| `add_tags` | Add tags to an existing location |
| `remove_tags` | Remove tags from a location |

### Spatial Queries

| Tool | Description |
|------|-------------|
| `get_distance` | Calculate distance between two points (supports names or raw coords) |
| `find_nearest` | Find the N nearest locations to a point |
| `find_in_radius` | Find all locations within a specified radius |
| `get_nether_coords` | Convert coordinates between overworld and nether |

### Statistics

| Tool | Description |
|------|-------------|
| `get_location_stats` | Get overview: total locations, by dimension, by owner, top tags |

## Location Structure

Each location contains:

- **name** - Unique identifier for the location (required, case-insensitive)
- **x, y, z** - Coordinates (required)
- **dimension** - overworld, nether, or end (default: overworld)
- **description** - What this place is
- **tags** - Array of categorization tags (e.g., `["farm", "public", "wheat"]`)
- **owner** - Who saved this location (player name)
- **created_at** / **updated_at** - Timestamps

## Examples

```
> Save my base at coordinates 100, 64, -200

> Where is the nether hub?

> What locations are near spawn?

> Find all public farms

> How far is it from my base to the end portal?

> What are the nether coordinates for the witch farm?
```

## Requirements

- Node.js 18+

## Dependencies

- [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) - SQLite bindings
- [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/sdk) - MCP server SDK

## Related Projects

- [haksnbot-mind](https://github.com/haksndot/haksnbot-mind) - Autonomous Minecraft bot using Claude Agent SDK
- [haksnbot-tools](https://github.com/haksndot/haksnbot-tools) - Minecraft MCP tools
- [haksnbot-admin](https://github.com/haksndot/haksnbot-admin) - Server administration MCP tools
- [haksnbot-memory](https://github.com/haksndot/haksnbot-memory) - Persistent memory storage

## License

MIT