Datastore MCP Server

Datastore MCP Server

Enables AI assistants to interact with Google Cloud Datastore, allowing them to create, read, update, delete entities, and perform queries with filtering and ordering.

Category
访问服务器

README

Datastore MCP Server

A Model Context Protocol (MCP) server that provides access to Google Cloud Datastore. This server enables AI assistants like Claude to interact with Datastore entities, perform queries, and manage data.

Features

  • Entity Operations: Create, read, update, and delete Datastore entities
  • Query Support: Execute queries with filters, ordering, and pagination
  • Namespace Support: Work with different Datastore namespaces
  • Emulator Support: Connect to local Datastore emulator by default for development
  • Production Ready: Easy configuration for production Google Cloud Datastore

Installation

Prerequisites

Option 1: Docker (Recommended)

  • Docker Engine 20.10+
  • Docker Compose v2.0+

Option 2: Local Python

  • Python 3.10 or higher
  • Google Cloud Datastore emulator (for local development) or Google Cloud project (for production)

Install from source

# Clone the repository
git clone <repository-url>
cd datastore-mcp

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -e .

Using uv (recommended)

# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv pip install -e .

Using Docker (recommended for testing)

Docker provides an isolated environment with both the Datastore emulator and MCP server pre-configured.

# Run tests
make test

# Start all services (emulator + server)
make up

# View logs
make logs

# Stop services
make down

For detailed Docker documentation, see DOCKER.md.

Configuration

The server can be configured using environment variables or command-line arguments.

Environment Variables

For Emulator:

  • DATASTORE_DATASET - Dataset name (default: test)
  • DATASTORE_EMULATOR_HOST - Datastore emulator host (default: localhost:8081)
  • DATASTORE_EMULATOR_HOST_PATH - Emulator host path (default: localhost:8081/datastore)
  • DATASTORE_HOST - Datastore HTTP host (default: http://localhost:8081)
  • DATASTORE_PROJECT_ID - Google Cloud project ID (default: test)
  • DATASTORE_NAMESPACE - Default namespace (optional)

For Production:

  • DATASTORE_PROJECT_ID - Google Cloud project ID (required)
  • GOOGLE_APPLICATION_CREDENTIALS - Path to service account key file (required)
  • DATASTORE_NAMESPACE - Default namespace (optional)

Running with Datastore Emulator (Default)

# Start the Datastore emulator (in a separate terminal)
gcloud beta emulators datastore start --host-port=localhost:8081

# Run the MCP server (uses emulator by default)
python src/datastore_mcp/server.py

# Or with custom emulator host
DATASTORE_EMULATOR_HOST=localhost:9090 python src/datastore_mcp/server.py

Running with Production Datastore

# Set credentials and project
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json
export DATASTORE_PROJECT_ID=your-gcp-project-id

# Unset emulator host to use production
unset DATASTORE_EMULATOR_HOST

# Run the server
python src/datastore_mcp/server.py

Usage with Claude Desktop

Add this configuration to your Claude Desktop config file:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

For Emulator (Development)

{
  "mcpServers": {
    "datastore": {
      "command": "python",
      "args": ["/path/to/datastore-mcp/src/datastore_mcp/server.py"],
      "env": {
        "DATASTORE_DATASET": "test",
        "DATASTORE_EMULATOR_HOST": "localhost:8081",
        "DATASTORE_EMULATOR_HOST_PATH": "localhost:8081/datastore",
        "DATASTORE_HOST": "http://localhost:8081",
        "DATASTORE_PROJECT_ID": "test"
      }
    }
  }
}

For Production

{
  "mcpServers": {
    "datastore": {
      "command": "python",
      "args": ["/path/to/datastore-mcp/src/datastore_mcp/server.py"],
      "env": {
        "DATASTORE_PROJECT_ID": "your-gcp-project-id",
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account-key.json"
      }
    }
  }
}

Using Docker with Claude Desktop (Recommended)

Option 1: Fully Automated (Emulator + Server)

Use the provided wrapper script (included in the repository):

MacOS/Linux: start-datastore-mcp.sh Windows: start-datastore-mcp.bat

Then configure Claude Desktop:

MacOS/Linux:

{
  "mcpServers": {
    "datastore": {
      "command": "/path/to/datastore-mcp/start-datastore-mcp.sh"
    }
  }
}

Windows:

{
  "mcpServers": {
    "datastore": {
      "command": "C:\\path\\to\\datastore-mcp\\start-datastore-mcp.bat"
    }
  }
}

This option automatically starts the emulator if it's not running and waits for it to be healthy before starting the MCP server.

Option 2: Manual Emulator Start

First, start the Datastore emulator once:

cd /path/to/datastore-mcp
make emulator-only  # Keeps running in background

Then configure Claude Desktop:

{
  "mcpServers": {
    "datastore": {
      "command": "docker",
      "args": [
        "compose",
        "-f",
        "/path/to/datastore-mcp/docker-compose.yml",
        "run",
        "--rm",
        "mcp-server"
      ]
    }
  }
}

Option 3: External Emulator (Custom IP)

If your emulator runs on a different machine or custom IP:

{
  "mcpServers": {
    "datastore": {
      "command": "docker",
      "args": [
        "compose",
        "-f",
        "/path/to/datastore-mcp/docker-compose.yml",
        "run",
        "--rm",
        "-e", "DATASTORE_EMULATOR_HOST=localhost:8081",
        "-e", "DATASTORE_EMULATOR_HOST_PATH=localhost:8081/datastore",
        "-e", "DATASTORE_HOST=http://localhost:8081",
        "mcp-server"
      ]
    }
  }
}

Using uv with Claude Desktop

{
  "mcpServers": {
    "datastore": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/datastore-mcp",
        "run",
        "datastore-mcp"
      ],
      "env": {
        "DATASTORE_DATASET": "test",
        "DATASTORE_EMULATOR_HOST": "localhost:8081",
        "DATASTORE_EMULATOR_HOST_PATH": "localhost:8081/datastore",
        "DATASTORE_HOST": "http://localhost:8081",
        "DATASTORE_PROJECT_ID": "test"
      }
    }
  }
}

Available Tools

Once connected, the following tools are available to Claude:

  • datastore_get - Retrieve an entity by key
  • datastore_put - Create or update an entity
  • datastore_delete - Delete an entity
  • datastore_query - Query entities with filters and ordering
  • datastore_batch_get - Retrieve multiple entities by keys
  • datastore_list_kinds - List all entity kinds in the namespace

Example Queries

Ask Claude to:

  • "Get the User entity with ID 12345"
  • "Query all Products where price > 100, ordered by name"
  • "Create a new BlogPost entity with title and content"
  • "Delete the Comment entity with ID abc123"
  • "List all entity kinds in my datastore"

Development

Using Docker (Recommended)

# Run tests
make test

# Run tests with coverage
docker-compose run --rm test

# Start emulator only for local development
make emulator-only

# Interactive shell in container
make shell

Using Local Python

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=src/datastore_mcp --cov-report=term-missing

# Run the server
python src/datastore_mcp/server.py

Project Structure

datastore-mcp/
├── src/
│   └── datastore_mcp/
│       ├── server.py          # Main MCP server
│       ├── datastore.py       # Datastore client wrapper
│       └── tools.py           # Tool implementations
├── tests/
│   └── test_tools.py
├── pyproject.toml
└── README.md

License

MIT License

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选