abuhtig
服务介绍
UniCloudDB-MCP
A uniCloud database operation tool based on the MCP protocol, supporting CRUD operations through an AI assistant.
Features
- Supports integration with standardized MCP protocol tools
- Provides a complete set of JQL format database operation interfaces
- Supports common operations such as querying, adding, updating, and deleting
- Simple and easy-to-use API design
- Compatible with mainstream AI model tool invocations
- Supports local execution and source code modification
Direct MCP Configuration Usage
json
{
"uniclouddb-mcp": {
"command": "npx",
"args": ["-y", "uniclouddb-mcp"],
"env": {
"DB_SERVICE_URL": "https://your-uniCloud-cloud-function-URL.next.bspapp.com/mcp"
}
}
}
Local Execution Instructions
Installation
bash
npm install uniclouddb-mcp
Environment Variable Configuration
You can configure the database service parameters via environment variables:
bash
config file
DB_SERVICE_URL=https://your-uniCloud-cloud-function-URL/mcp
REQUEST_TIMEOUT=30000
Copy the mcp_service folder to your project's uniCloud/cloudfunctions directory and upload the cloud function
Open the uniCloud web console, find the mcp_service cloud function, and set the cloud function URL
Set the URL for accessing this cloud function via HTTP or HTTPS. The domain is bound in the cloud function list interface; here, you only need to set the path. Reference documentation: https://uniapp.dcloud.io/uniCloud/http
Set up MCP Service
json
{
"uniclouddb": {
"name": "uniclouddb",
"key": "uniclouddb",
"command": "node",
"args":[
"D:\uniCloudDB-mcp\index.js"
],
"disabled": false,
"env": {}
}
}
MCP Tool Description
This library provides the following MCP tools that can be directly invoked by an AI assistant:
1. query - Query Data
Parameters:
collection: Collection namewhere: Query condition (JQL format)field(optional): Fields to returnlimit(optional): Limit on the number of returned recordsskip(optional): Number of records to skiporderBy(optional): Sorting condition
2. add - Add Data
Parameters:
collection: Collection namedata: Data to add (object/array)
3. update - Update Data
Parameters:
collection: Collection namewhere: Update condition (JQL format)data: Data to update (object)
4. remove - Remove Data
Parameters:
collection: Collection namewhere: Deletion condition (JQL format)
Database Connection Test
Use the built-in test tool to verify the database connection and basic functionality:
bash
npm test
System Requirements
- Node.js >= 18.0.0
- Deployed uniCloud cloud function
uniCloud Cloud Function Integration
This tool needs to be used in conjunction with a uniCloud cloud function. Please ensure that the corresponding processing function has been deployed. The cloud function receives standard JQL format requests, processes the database operations, and returns the results.
Security Tips
- It is recommended to configure access control and authentication in production environments.
- Avoid exposing the database URL in public environments.
- Regularly update dependency packages to fix potential security issues.
License
MIT