Bollard MCP

Bollard MCP

Enables safe, AI-driven database interactions with schema discovery, intent validation, and session memory, supporting multiple databases.

Category
访问服务器

README

Bollard MCP 🛡️

An AI-powered, safe database access gateway built on the Model Context Protocol (MCP).

Bollard acts as an intelligent execution proxy between your AI code assistant (Cursor, VS Code, Windsurf, Claude Desktop, OpenAI Codex) and your physical databases — providing safe query execution, dynamic schema discovery, cost-based risk parsing, data leak prevention, and session memory.


How It Works

Bollard sits as a transparent intermediary layer between your AI development client and your target database. When the client executes database tools, the requests are statically evaluated, authorized, and structured to optimize context window tokens before the database engine sees them.

Before Bollard vs. With Bollard

Workflow Aspect Before Bollard (Direct SQL Assistant) With Bollard (Safe Database Gateway)
Schema Context Relies on manually pasted schema blocks, leading to hallucinated queries on outdated schemas. Inspects schemas dynamically, caching metadata and profiles to feed the LLM accurate context.
Execution Safety AI directly runs generated queries. High risk of accidental data modification, deletion, or drops. Risk levels (LOW to EXTREME) are computed statically. Destructive operations are safely blocked.
Human-in-the-Loop None. Large batch updates or structural migrations execute immediately without warnings. Write queries require double confirmation (confirming query matching phrases and typing local PINs).
Data Leak Prevention AI can query any table, including sensitive tables (e.g., password hashes, user secrets, API keys). Access control lists block sensitive tables via connection-level blocklist wildcards.
Token & Context Usage Large queries return massive raw rows, flooding the context window and wasting thousands of tokens. Large queries are compressed into structured summaries with a 10-row preview and column stats (up to 97% token savings).
Correction Loop No memory of past mistakes. AI repeats the same syntax/query errors in new sessions. Custom fixes and deprecated field overrides are persisted and auto-injected as agent instructions.

Getting Started

1. Installation

Bollard is written in Python and is available on PyPI:

  • Global Installation (Recommended for CLI / standalone runtimes):
    pipx install bollard-mcp
    
  • Virtual Environment Installation:
    pip install bollard-mcp
    

2. Client Configurations

Cursor

  1. Go to Cursor Settings > Features > MCP.
  2. Click + Add New MCP Server.
  3. Set the following fields:
    • Name: bollard
    • Type: command
    • Command: bollard-mcp (or the absolute path to bollard-mcp or python inside your virtualenv, e.g., python -m bollard_mcp.server)

Or edit your Cursor config file directly (~/.cursor/mcp.json):

{
  "mcpServers": {
    "bollard": {
      "command": "bollard-mcp"
    }
  }
}

VS Code (Cline / Roo Code)

Add the configuration to your Cline settings file (located at %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json on Windows):

{
  "mcpServers": {
    "bollard": {
      "command": "bollard-mcp"
    }
  }
}

Windsurf

Add the configuration under your global Windsurf MCP configuration file (~/.codeium/windsurf/mcp_config.json):

{
  "mcpServers": {
    "bollard": {
      "command": "bollard-mcp"
    }
  }
}

Claude Desktop

Add the configuration to your Claude Desktop config file (%APPDATA%\Claude\claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "bollard": {
      "command": "bollard-mcp"
    }
  }
}

OpenAI Codex

Add the server block under the [mcp_servers] table in your Codex configuration file (~/.codex/config.toml):

[mcp_servers.bollard]
command = "python" # or "bollard-mcp" if installed globally via pipx
args = ["-m", "bollard_mcp.server"]
cwd = "/path/to/your/bollard-mcp"

💡 Write Operations in Standalone Clients: In standalone clients (like OpenAI Codex or Claude Desktop) that do not run the editor helper extension, Bollard automatically falls back to an In-Chat PIN Gate. When the AI attempts a write query, the server will block execution, generate a local 4-digit verification PIN, and print it directly in the chat. You simply need to copy-paste this PIN back into the chat prompt to authorize and execute the write query safely.


Database Connection Reference

Once Bollard is registered, prompt your AI agent inside your chat client to connect.

Connection Prompts

  • General Connect:

    "Connect to my local database with alias local_postgres and connection string postgresql://postgres:postgres@localhost:5432/dbcopilot"

  • Connect with a security blocklist:

    "Connect to local database with alias local_postgres at postgresql://postgres:postgres@localhost:5432/dbcopilot and forbid access to user_secrets"

Local Docker Testing & Seeding

If you are testing database safety gates locally using a Docker PostgreSQL container:

  1. Make sure your local Docker container is running: docker ps
  2. Seed the database tables (users, orders, user_secrets) by running our seeding script:
    python examples/create_postgres_test_db.py
    
  3. Prompt the agent in chat to connect and query (e.g. query user_secrets to verify the blocklist intercepts the request).

License

Bollard is dual-licensed under:

  • AGPL-3.0-only for open-source non-commercial use. See LICENSE for details.
  • Commercial License for commercial production use. If you need custom SLAs, Okta/SSO integrations, or compliance audit log exporting, please contact sales at pavakstudio@gmail.com.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选