Token导航 LogoToken导航

MCP Server · 数据服务

Project-Heimdall

Project Heimdall是一款高安全性的中间件,作为PostgreSQL数据库的模型上下文协议(MCP)守门员,允许大型语言模型(如Claude或Cursor)安全查询数据库,同时严格阻止任何修改、删除或破坏数据的尝试。

未说明官方级别未说明来源级核验工具 3
大型语言模型GoClaude中间件Claude DesktopCursor

快速开始

公开资料没有提供安装命令,按仓库或官方文档接入。
作者 / 组织
AnubhavMadhav
提供方
AnubhavMadhav

工具数量

3

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

0

仓库热度

收录来源

1 个

MCP World

选型结论

Project-Heimdall 属于数据服务类 MCP Server,公开资料标注 3 个工具,通过传输方式未标注接入,适配 Claude Desktop、Claude、Cursor,没有现成的安装命令;接入前先确认权限范围。

分类

数据服务

传输方式

未说明

认证方式

无需认证

部署方式

公开资料未说明

安装与配置

公开目录没有给出安装命令,需要按仓库 README安装;下面按同类条目的通用流程说明。

公开命令不是通用的启动方式,拼不出可靠配置示例;请在客户端 MCP 配置里按官方文档填写 command 和 args。

上手步骤

  1. 1

    先确认运行方式

    公开资料没有标注传输方式,先看仓库 README,确认是本地进程还是远程地址。

  2. 2

    获取服务

    公开目录没有给出安装命令,按仓库 README里的步骤安装或获取服务。

  3. 3

    写入客户端配置

    在客户端的 MCP 配置里填启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4

    验证是否可用

    连接成功后客户端会列出 3 个工具,随便调一个只读工具确认能返回结果。

接入前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

公开资料仍需确认:安装命令

详细介绍

Project Heimdall

*"Heimdall sees all, hears all, and guards the Bifrost. No enemy shall pass through to Asgard."*

Project Heimdall is a high-security middleware that acts as a Model Context Protocol (MCP) Gatekeeper for PostgreSQL databases. It allows Large Language Models (like Claude or Cursor) to query your database to answer questions, while strictly blocking any attempt to modify, delete, or destroy data.


What is Project-Heimdall?

The Layman's Explanation (The Asgard Analogy)

Imagine your Production Database is Asgard—a realm of infinite value that must be protected. The LLM (Claude/AI) is a traveler trying to cross the Bifrost (the bridge) to see what is inside. Heimdall stands at the gate.

  • He allows travelers to look around ("Show me the users," "List the tables").
  • But if a traveler tries to burn a village (DROP TABLE) or steal gold (DELETE FROM), Heimdall summons his sword and strictly blocks the path.

The Technical Explanation

Heimdall is an MCP Server written in Golang. It sits between the AI client and the PostgreSQL database. Instead of passing SQL queries directly to the driver, it passes them through a custom Abstract Syntax Tree (AST) Parser. This parser deconstructs the SQL command into its grammatical components to ensure it is a read-only SELECT statement. If any mutation keywords (INSERT, UPDATE, DELETE, DROP, ALTER) are detected in the syntax tree, the query is rejected before it ever touches a database connection.

LLM (Client) → MCP Server → AST Security Layer → PostgreSQL

Key Features

  • AST-Based Security: Uses sqlparser to tokenize and analyze queries, strictly rejecting any non-SELECT statements (superior to regex matching).
  • Model Context Protocol (MCP): Native integration with the Anthropic ecosystem, exposing list_tables, get_schema, and safe_query as standardized tools.
  • High-Performance Driver: Built on pgx/v5 for efficient connection pooling and type handling.

Tech Stack & Rationale

We didn't just pick "popular" tools; we picked the *safest* tools for high-concurrency infrastructure.

ComponentChoiceWhy we chose it (vs. Alternatives)
LanguageGolangPros: Strict typing prevents runtime surprises. Goroutines handle concurrent MCP requests efficiently.
Cons: More verbose than Python, but safer for infrastructure.
Protocolmcp-goPros: Native implementation of the Model Context Protocol. Handles the JSON-RPC handshake so we focus on logic.
Driverpgx/v5Pros: Uses the PostgreSQL binary protocol (faster than text). Better connection pooling than standard database/sql.
Securityxwb1989/sqlparserPros: Parses SQL into an Abstract Syntax Tree (AST).
Why not Regex? Regex is easily tricked (e.g., SeLeCt vs SELECT). An AST understands the *intent* of the code, making it nearly impossible to bypass.
ArchitectureHexagonalPros: Decouples the "Security Layer" from the "Database Layer." Allows us to swap the database or protocol later without rewriting the core logic.

How to Setup Locally

Follow these steps to deploy Heimdall on your local machine (Mac, Linux, or Windows WSL).

Prerequisites

1. Clone & Build

git clone 
cd Project-Heimdall
cd heimdall
go mod tidy
go build -o heimdall cmd/heimdall/main.go

Note: This creates a binary executable named heimdall in your folder.

2. Start a Local Database (Docker)

If you don't have a database, spin up a safe sandbox:

# Run Postgres on port 5432
- docker run --name heimdall-db -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres

# Create some dummy data to test
- docker exec -it heimdall-db psql -U postgres -c "CREATE TABLE heroes (id SERIAL, name TEXT, role TEXT);"
- docker exec -it heimdall-db psql -U postgres -c "INSERT INTO heroes (name, role) VALUES ('Thor', 'God of Thunder'), ('Loki', 'Trickster');"

# (Crucial) Export the DB URL for manual testing
- export DATABASE_URL="postgres://postgres:password@localhost:5432/postgres?sslmode=disable"

3. Configure Claude Desktop

Tell Claude where to find your Gatekeeper.

  • Mac/Linux: Edit ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: Edit %APPDATA%\Claude\claude_desktop_config.json

Add this configuration (Update the path to your actual project folder!):

{
  "mcpServers": {
    "heimdall": {
      "command": "`/YOUR/FULL/PATH/TO/Project-Heimdall/heimdall/heimdall",
      "args": [],
      "env": {
        "DATABASE_URL": "postgres://postgres:password@localhost:5432/postgres?sslmode=disable"
      }
    }
  }
}

4. Restart & Chat

Restart Claude Desktop. You should see the 🔌 (plug/connector) connection icon. Ask: "Check the heimdall database. Who are the heroes?"


Demo: Heimdall in Action

See Heimdall protecting the database in real-time interactions with Claude Desktop.

1. Discovery & Safe Access

Heimdall allows the LLM to explore the schema and read data safely.

Scenario 1: Schema DiscoveryScenario 2: Safe Data Retrieval
*Claude asks to see available tables.**Claude executes a standard SELECT * query.*

2. The Gatekeeper (Security Enforcement)

This is the core feature. Notice how Heimdall intercepts the AST before it reaches the database.

Scenario 3: Blocking a DELETEScenario 4: Preventing SQL Injection
*Claude attempts a DELETE command. Heimdall detects the *sqlparser.Delete node and rejects it.**A stacked query (SELECT; DROP) is caught by the parser.*

Security Deep Dive: AST vs. Regex

Heimdall doesn't use Regular Expressions (Regex) for security because:

The Regex Problem: A naive filter might block strings containing DELETE.

  • Attack: "Select * from deleted_users" -> Blocked (False Positive)
  • Attack: "D E L E T E from users" -> Allowed (False Negative)

The Heimdall (AST) Solution: Heimdall converts the SQL string into a structured tree object. It checks the Node Type.

  • Is stmt of type *sqlparser.Select? Pass.
  • Is stmt of type *sqlparser.Delete? Fail.

This ensures that SELECT * FROM deleted_users is allowed (because it's a SELECT node), but DELETE FROM users is blocked, no matter how you format the whitespace.


Project Structure

We follow the Standard Go Layout with Hexagonal Architecture:

heimdall/
├── cmd/main.go           # Entry point (Wiring & Config)
├── internal/
│   ├── core/             # Pure Business Logic
│   │   ├── ports/        # Interfaces (Gatekeeper)
│   │   └── services/     # Implementation (The Guard)
│   └── adapters/         # Infrastructure
│       ├── mcp/          # The Interface (Claude)
│       ├── postgres/     # The Storage (Asgard)
│       └── security/     # The Firewall (AST Parser)
└── pkg/logger/           # Structured Logging

*Built with ❤️ and Golang by Anubhav Madhav.*

工具与能力

工具数量

3

资源数量

0

提示词数量

0

能力标签

数据库安全Go本地部署中间件PostgreSQL大型语言模型AST解析

支持客户端

Claude DesktopClaudeCursor

数量来自来源目录的标注,具体工具清单以官方文档为准。

典型使用场景

用自然语言查库

不用手写 SQL,直接问数据,让模型组织查询语句。

数据巡检

定期拉指标、做对比,把异常项整理成一段说明。

打通业务数据

把数据库、数仓和接口接进同一个上下文,减少导出再上传。

选择建议

值得选的地方

  • 只提供 3 个工具,职责集中,接入后不容易误操作。
  • 已经适配 Claude Desktop、Claude、Cursor,换客户端不用重新研究配置。
  • 公开说明写得比较完整,接入前能看清能力边界。

先想清楚的地方

  • 公开资料没有可直接复制的安装命令,第一次接入要自己找入口。
  • 第三方目录整理,版本更新和行为细节以官方仓库为准。

更适合

  • 需要在数据服务场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop 的用户,接入路径最短。
  • 愿意照着官方文档一步步配环境的人。

不太适合

  • 希望一条命令就装好、不想看文档的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

5 个同类
MCP Server工具数传输方式安装命令收录来源最后核验
Project-Heimdall

MCP World · 本页

3未说明未标注1 个2026-05-17
Memory 9d25f64e

MCP World

9未说明未标注1 个2026-05-17
Prisma MCP Server

MCP World

0stdio有3 个2026-05-17
Astr Bot

MCP World

0stdio有1 个2026-05-17
Getzep MCP

MCP World

9stdio有1 个2026-05-17

按同分类和工具数量挑出最接近的几条,字段以各自详情页为准。

常见问题

5 条

Project-Heimdall 怎么安装?

公开目录没有给出可以直接复制的安装命令,需要按仓库 README里的步骤安装;装好后写进客户端的 MCP 配置再重启。

Project-Heimdall 怎么在 Claude Desktop、Cursor 里配置?

它是传输方式未标注,客户端配置里要写启动命令和参数,运行环境是 未标注;保存后完全退出客户端再打开,配置才会生效。

Project-Heimdall 收费吗?

本站只整理公开资料,不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Project-Heimdall 需要 API Key 吗?

公开资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Project-Heimdall 支持哪些客户端?

公开资料标注支持 Claude Desktop、Claude、Cursor;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

来源信息

继续浏览同类 MCP