关于 Scansca - MCP Database Connector (under-development)
Scansca 是一款开发中的可自托管 MCP 服务,用于连接 LLM 客户端与数据库。技术用户可注册 PostgreSQL 数据库、发现数据库结构,并通过 MCP 和 REST API 使用数据库操作。
主要功能
- 01连接 PostgreSQL
- 02发现数据库结构
- 03通过 REST 提供数据库操作
- 04使用 Docker Compose 部署
适用场景
- 01向 MCP 客户端开放 PostgreSQL 数据
- 02通过结构发现了解数据库组成
MCP 相关
通过 MCP 端点提供数据库工具列表和工具调用功能。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
暂未收录安装方式
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
还没有获取到工具列表
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Scansca - MCP 数据库连接器(开发中)
Scansca 是一款可自托管的服务,通过模型上下文协议(MCP)将大模型(LLM)客户端与数据库系统连接起来。它让技术人员能够使用自然语言,从多种数据环境中获取整合后的洞见。
功能
- 支持多种数据库:连接 PostgreSQL(即将支持 MySQL、SQLite 和 DynamoDB)
- MCP 集成:与兼容 MCP 的大模型客户端无缝集成
- 自动发现架构:只需极少配置即可公开数据库结构
- 简单 API:用于数据库操作的 RESTful 接口
- 支持 Docker:通过 Docker Compose 轻松部署
快速开始
前置条件
- Go 1.22+
- Docker 和 Docker Compose(可选,用于数据库依赖项)
安装
# Clone the repository
git clone https://github.com/royceleond/scansca.git
cd scansca
# Install dependencies
make deps
# Start a PostgreSQL database (optional)
make docker-compose
# Build and run the server
make run
基本用法
注册数据库
curl -X POST http://localhost:8080/api/v1/databases \
-H "Content-Type: application/json" \
-d '{
"name": "my-postgres",
"type": "postgresql",
"connection_string": "postgres://scansca_user:scansca_password@localhost:5432/scansca"
}'
执行查询
curl -X POST http://localhost:8080/api/v1/query \
-H "Content-Type: application/json" \
-d '{
"database": "my-postgres",
"query": "SELECT current_database(), current_user"
}'
与大模型客户端配合使用
对于兼容 MCP 的大模型客户端,Scansca 提供以下端点:
GET /mcp/v1/tools # Lists available tools
POST /mcp/v1/tools/:name/invoke # Invokes a specific tool
文档
运行以下命令查看文档:
make docs
这将在 8080 端口启动文档服务(可通过 DOCS_PORT 配置)。
更多信息请参阅在线文档。
架构
┌──────────────────────────┐
│ MCP Client │
│ (LLM, CLI, Application) │
└──────────────┬───────────┘
│
▼
┌──────────────────────────┐
│ Scansca MCP Server │ HTTP API for database operations
│ │ and MCP protocol support
├──────────────────────────┤
│ Database Connectors │ Uniform interface for different
└──────────────┬───────────┘ database systems
│
▼
┌──────────────────────────┐
│ Database Servers │
│ (Postgres, MySQL, etc.) │
└──────────────────────────┘
开发
# Build the project
make build
# Run tests
make test
# Start the server
make run
# Start PostgreSQL using Docker Compose
make docker-compose
# Stop Docker Compose services
make docker-compose-down
# Start documentation server
make docs
# Build and publish documentation to a Docker registry
make docs-publish
环境配置
对于 Docker 注册表 URL 等敏感设置,Scansca 使用不会被 git 跟踪的 .env 文件:
-
复制模板文件以创建配置:
cp .env.example .env -
编辑
.env文件并设置相关配置:# Registry settings - Replace with your actual values DOCKER_REGISTRY=docker.your-company.com -
运行 make 命令时,Makefile 会自动加载这些设置
项目结构
scansca/
├── cmd/ # Application entry point
├── config/ # Configuration files
├── docker/ # Docker configurations
├── docs/ # Documentation
├── internal/ # Private implementation
│ ├── db/ # Database connections and models
│ ├── server/ # HTTP server and API
│ └── mcp/ # MCP protocol implementation
└── Makefile # Build automation
许可证
本项目采用 Scansca Software License 许可,允许:
- 将本项目免费用于非商业用途、非营利组织和小型实体(收入/资产低于 10,000 美元)
- 商业和政府用途需另行获得作者许可
完整详情请参阅 LICENSE 文件。
贡献
欢迎贡献!请随时提交 Pull Request。
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。