nolleh
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"vertica": {
"args": [
"mcp-vertica",
"--host=localhost",
"--db-port=5433",
"--database=VMart",
"--user=dbadmin",
"--password=",
"--connection-limit=10"
],
"command": "uvx"
}
}
}
可用工具 (6 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
execute_query
Execute a SQL query and return the results.Args: ctx: FastMCP context for progress reporting and logging query: SQL query to execute database: Optional database name to execute the query againstReturns: Query results as a string
该工具无需必填参数,直接调用即可
stream_query
Execute a SQL query and stream the results in batches.Args: ctx: FastMCP context for progress reporting and logging query: SQL query to execute batch_size: Number of rows to fetch at onceYields: Batches of query results as strings
该工具无需必填参数,直接调用即可
copy_data
Copy data into a Vertica table using COPY command.Args: ctx: FastMCP context for progress reporting and logging schema: vertica schema to execute the copy against table: Target table name data: List of rows to insertReturns: Status message indicating success or failure
该工具无需必填参数,直接调用即可
get_table_structure
Get the structure of a table including columns, data types, and constraints.Args: ctx: FastMCP context for progress reporting and logging table_name: Name of the table to inspect schema: Schema name (default: public)Returns: Table structure information as a string
该工具无需必填参数,直接调用即可
list_indexes
List all indexes for a specific table.Args: ctx: FastMCP context for progress reporting and logging table_name: Name of the table to inspect schema: Schema name (default: public)Returns: Index information as a string
该工具无需必填参数,直接调用即可
list_views
List all views in a schema.Args: ctx: FastMCP context for progress reporting and logging schema: Schema name (default: public)Returns: View information as a string
该工具无需必填参数,直接调用即可
服务介绍
MCP Vertica
一个 Vertica MCP(模型-上下文-协议)服务器
示例:MCP 服务器设置
创建或编辑您的 MCP 客户端配置文件,内容如下:
json
{
"mcpServers": {
"vertica": {
"command": "uvx",
"args": [
"mcp-vertica",
"--host=localhost",
"--db-port=5433",
"--database=VMart",
"--user=dbadmin",
"--password=",
"--connection-limit=10"
]
}
}
}
[!注意]
- 对于像
--ssl或--ssl-reject-unauthorized这样的布尔标志,只需添加该标志(例如"--ssl")以启用它,或者省略它以禁用。- 对于空密码,使用如上所示的空字符串。
功能
数据库连接管理
- 带有可配置限制的连接池
- SSL/TLS 支持
- 自动连接清理
- 连接超时处理
查询操作
- 执行 SQL 查询
- 分批流式传输大量查询结果
- 数据复制操作
- 事务管理
模式管理
- 表结构检查
- 索引管理
- 视图管理
- 约束信息
- 列详细信息
安全特性
- 操作级权限(INSERT, UPDATE, DELETE, DDL)
- 特定模式的权限
- SSL/TLS 支持
- 日志中的密码掩码
工具
数据库操作
-
execute_query- 执行 SQL 查询
- 支持所有 SQL 操作
-
stream_query- 分批流式传输大量查询结果
- 可配置的批次大小
-
copy_data- 使用 COPY 命令批量加载数据
- 适用于大数据集
模式管理
-
get_table_structure- 获取详细的表结构
- 列信息
- 约束
-
list_indexes- 列出表的所有索引
- 索引类型和唯一性
- 列信息
-
list_views- 列出模式中的所有视图
- 视图定义
配置
环境变量
env
VERTICA_HOST=localhost
VERTICA_PORT=5433
VERTICA_DATABASE=VMart
VERTICA_USER=newdbadmin
VERTICA_PASSWORD=vertica
VERTICA_CONNECTION_LIMIT=10
VERTICA_SSL=false
VERTICA_SSL_REJECT_UNAUTHORIZED=true
操作权限
env
ALLOW_INSERT_OPERATION=false
ALLOW_UPDATE_OPERATION=false
ALLOW_DELETE_OPERATION=false
ALLOW_DDL_OPERATION=false
模式权限
env
SCHEMA_INSERT_PERMISSIONS=schema1:true,schema2:false
SCHEMA_UPDATE_PERMISSIONS=schema1:true,schema2:false
SCHEMA_DELETE_PERMISSIONS=schema1:true,schema2:false
SCHEMA_DDL_PERMISSIONS=schema1:true,schema2:false
安装
通过 Smithery 安装
要通过 Smithery 自动安装 Claude Desktop 的 Vertica 数据库连接器:
bash
npx -y @smithery/cli install @nolleh/mcp-vertica --client claude
手动安装
bash
uvx mcp-vertica
许可证
本项目采用 MIT 许可证 - 详情请参阅 LICENSE 文件。
在 Docker 环境中运行
当使用 Docker Compose 运行 Vertica 时,可以按以下方式运行 MCP 服务器:
1. 使用直接参数运行
bash
uvx mcp-vertica
--host localhost
--db-port 5433
--database VMart
--user dbadmin
--password ""
--connection-limit 10
2. 使用环境变量运行
创建一个包含以下内容的 .env 文件:
env
VERTICA_HOST=localhost
VERTICA_PORT=5433
VERTICA_DATABASE=test_db
VERTICA_USER=test_user
VERTICA_PASSWORD=test_password
VERTICA_CONNECTION_LIMIT=10
VERTICA_SSL=false
VERTICA_SSL_REJECT_UNAUTHORIZED=true
然后使用 .env 文件运行
bash
uvx mcp-vertica
--env-file .env
测试用例:VerticaDB Docker Compose 示例
yaml
version: "3.8"
services:
vertica:
# image: vertica/vertica-ce:11.1.0-0
image: vertica/vertica-ce:latest
platform: linux/amd64
container_name: vertica-ce
environment:
VERTICA_MEMDEBUG: 2
ports:
- "5433:5433"
- "5444:5444"
volumes:
- vertica_data:/home/dbadmin/VMart
healthcheck:
test:
[
"CMD",
"/opt/vertica/bin/vsql",
"-h",
"localhost",
"-d",
"VMart",
"-U",
"dbadmin",
"-c",
"SELECT 1",
]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
volumes:
vertica_data:
driver: local请提供需要翻译的英文技术文档内容,以便我进行翻译。
