Nile MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Learn more ↗️
Discord
🔵
Website
🔵
Issues
A Model Context Protocol (MCP) server implementation for Nile database platform. This server allows LLM applications to interact with Nile platform through a standardized interface.
Features
- **Database Management**: Create, list, get details, and delete databases
- **Credential Management**: Create and list database credentials
- **Region Management**: List available regions for database creation
- **SQL Query Support**: Execute SQL queries directly on Nile databases
- **MCP Protocol Support**: Full implementation of the Model Context Protocol
- **Type Safety**: Written in TypeScript with full type checking
- **Error Handling**: Comprehensive error handling and user-friendly error messages
- **Test Coverage**: Comprehensive test suite using Jest
- **Environment Management**: Automatic loading of environment variables from .env file
- **Input Validation**: Schema-based input validation using Zod
Installation
Install the stable version:
For the latest alpha/preview version:
This will install @niledatabase/nile-mcp-server in your node_modules folder. For example: node_modules/@niledatabase/nile-mcp-server/dist/
Manual Installation
Other mcp package managers
1. npx @michaellatman/mcp-get@latest install @niledatabase/nile-mcp-server
Starting the Server
There are several ways to start the server:
1. **Direct Node Execution**:
2. **Development Mode** (with auto-rebuild):
The server will start and listen for MCP protocol messages. You should see startup logs indicating:
- Environment variables loaded
- Server instance created
- Tools initialized
- Transport connection established
To stop the server, press Ctrl+C.
Verifying the Server is Running
When the server starts successfully, you should see logs similar to:
If you see these logs, the server is ready to accept commands from Claude Desktop.
Configuration
Create a .env file in the root directory with your Nile credentials:
To create a Nile API key, log in to your Nile account, click Workspaces in the top-left, select your workspace, and navigate to the Security section in the left menu.
Using with Claude Desktop
Setup
1. Install Claude Desktop if you haven't already
2. Build the project:
3. Open Claude Desktop
4. Go to Settings > MCP Servers
5. Click "Add Server"
6. Add the following configuration:
Replace:
- /path/to/your/nile-mcp-server with the absolute path to your project directory
- your_api_key_here with your Nile API key
- your_workspace_slug with your Nile workspace slug
Using with Cursor
Setup
1. Install Cursor if you haven't already
2. Build the project:
3. Open Cursor
4. Go to Settings (⌘,) > Features > MCP Servers
5. Click "Add New MCP Server"
6. Configure the server:
- Name: nile-database (or any name you prefer)
- Command:
Replace:
- your_key with your Nile API key
- your_workspace with your Nile workspace slug
- /absolute/path/to with the actual path to your project
7. Click "Save"
8. You should see a green indicator showing that the MCP server is connected
9. Restart Cursor for the changes to take effect
Server Modes
The server supports two operational modes:
STDIO Mode (Default)
The default mode uses standard input/output for communication, making it compatible with Claude Desktop and Cursor integrations.
SSE Mode
Server-Sent Events (SSE) mode enables real-time, event-driven communication over HTTP.
To enable SSE mode:
1. Set MCP_SERVER_MODE=sse in your .env file
2. The server will start an HTTP server (default port 3000)
3. Connect to the SSE endpoint: http://localhost:3000/sse
4. Send commands to: http://localhost:3000/messages
Example SSE usage with curl:
Example Prompts
After setting up the MCP server in Cursor, you can use natural language to interact with Nile databases. Here are some example prompts:
Database Management