Nile MCP Server Learn more ↗️ 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. - Database Management: Create, list, get details, and delete databases - Credential Management: Create and list database credentials - Region Management: List available regions for databas
Add this skill
npx mdskills install niledatabase/nile-mcp-serverComprehensive database management MCP server with rich toolset and excellent documentation
1<p align="center">2 <a href="https://thenile.dev" target="_blank"><img width="96px" src="https://www.thenile.dev/about-logo.png" /></a>3 <h2 align="center">Nile MCP Server4 <br/>5 <img src="https://img.shields.io/npm/v/@niledatabase/server"/>6 </h2>7 <p align="center">8 <a href="https://thenile.dev/docs/ai-embeddings/nile-mcp-server"><strong>Learn more ↗️</strong></a>9 <br />10 <br />11 <a href="https://discord.gg/akRKRPKA">Discord</a>12 🔵13 <a href="https://thenile.dev">Website</a>14 🔵15 <a href="https://github.com/orgs/niledatabase/discussions">Issues</a>16 </p>17</p>1819[](https://smithery.ai/server/@niledatabase/nile-mcp-server)2021A Model Context Protocol (MCP) server implementation for Nile database platform. This server allows LLM applications to interact with Nile platform through a standardized interface.2223## Features2425- **Database Management**: Create, list, get details, and delete databases26- **Credential Management**: Create and list database credentials27- **Region Management**: List available regions for database creation28- **SQL Query Support**: Execute SQL queries directly on Nile databases29- **MCP Protocol Support**: Full implementation of the Model Context Protocol30- **Type Safety**: Written in TypeScript with full type checking31- **Error Handling**: Comprehensive error handling and user-friendly error messages32- **Test Coverage**: Comprehensive test suite using Jest33- **Environment Management**: Automatic loading of environment variables from .env file34- **Input Validation**: Schema-based input validation using Zod3536## Installation3738Install the stable version:39```bash40npm install @niledatabase/nile-mcp-server41```4243For the latest alpha/preview version:44```bash45npm install @niledatabase/nile-mcp-server@alpha46```47This will install @niledatabase/nile-mcp-server in your node_modules folder. For example: node_modules/@niledatabase/nile-mcp-server/dist/4849### Manual Installation50```bash51# Clone the repository52git clone https://github.com/yourusername/nile-mcp-server.git53cd nile-mcp-server5455# Install dependencies56npm install5758# Build the project59npm run build60```61### Other mcp package managers621. npx @michaellatman/mcp-get@latest install @niledatabase/nile-mcp-server6364## Starting the Server6566There are several ways to start the server:67681. **Direct Node Execution**:69 ```bash70 node dist/index.js71 ```722. **Development Mode** (with auto-rebuild):73 ```bash74 npm run dev75 ```7677The server will start and listen for MCP protocol messages. You should see startup logs indicating:78- Environment variables loaded79- Server instance created80- Tools initialized81- Transport connection established8283To stop the server, press `Ctrl+C`.8485### Verifying the Server is Running8687When the server starts successfully, you should see logs similar to:88```89[info] Starting Nile MCP Server...90[info] Loading environment variables...91[info] Environment variables loaded successfully92[info] Creating server instance...93[info] Tools initialized successfully94[info] Setting up stdio transport...95[info] Server started successfully96```9798If you see these logs, the server is ready to accept commands from Claude Desktop.99100## Configuration101102Create a `.env` file in the root directory with your Nile credentials:103104```env105NILE_API_KEY=your_api_key_here106NILE_WORKSPACE_SLUG=your_workspace_slug107```108109To create a Nile API key, log in to your [Nile account](console.thenile.dev), click Workspaces in the top-left, select your workspace, and navigate to the Security section in the left menu.110111## Using with Claude Desktop112113### Setup1141151. Install [Claude Desktop](https://claude.ai/desktop) if you haven't already1162. Build the project:117 ```bash118 npm run build119 ```1203. Open Claude Desktop1214. Go to Settings > MCP Servers1225. Click "Add Server"1236. Add the following configuration:124125```json126{127 "mcpServers": {128 "nile-database": {129 "command": "node",130 "args": [131 "/path/to/your/nile-mcp-server/dist/index.js"132 ],133 "env": {134 "NILE_API_KEY": "your_api_key_here",135 "NILE_WORKSPACE_SLUG": "your_workspace_slug"136 }137 }138 }139}140```141142Replace:143- `/path/to/your/nile-mcp-server` with the absolute path to your project directory144- `your_api_key_here` with your Nile API key145- `your_workspace_slug` with your Nile workspace slug146147## Using with Cursor148149### Setup1501511. Install [Cursor](https://cursor.sh) if you haven't already1522. Build the project:153 ```bash154 npm run build155 ```1563. Open Cursor1574. Go to Settings (⌘,) > Features > MCP Servers1585. Click "Add New MCP Server"1596. Configure the server:160 - Name: `nile-database` (or any name you prefer)161 - Command:162 ```bash163 env NILE_API_KEY=your_key NILE_WORKSPACE_SLUG=your_workspace node /absolute/path/to/nile-mcp-server/dist/index.js164 ```165 Replace:166 - `your_key` with your Nile API key167 - `your_workspace` with your Nile workspace slug168 - `/absolute/path/to` with the actual path to your project1697. Click "Save"1708. You should see a green indicator showing that the MCP server is connected1719. Restart Cursor for the changes to take effect172173### Server Modes174175The server supports two operational modes:176177#### STDIO Mode (Default)178The default mode uses standard input/output for communication, making it compatible with Claude Desktop and Cursor integrations.179180#### SSE Mode181Server-Sent Events (SSE) mode enables real-time, event-driven communication over HTTP.182183To enable SSE mode:1841. Set `MCP_SERVER_MODE=sse` in your `.env` file1852. The server will start an HTTP server (default port 3000)1863. Connect to the SSE endpoint: `http://localhost:3000/sse`1874. Send commands to: `http://localhost:3000/messages`188189Example SSE usage with curl:190```bash191# In terminal 1 - Listen for events192curl -N http://localhost:3000/sse193194# In terminal 2 - Send commands195curl -X POST http://localhost:3000/messages \196 -H "Content-Type: application/json" \197 -d '{198 "type": "function",199 "name": "list-databases",200 "parameters": {}201 }'202```203204### Example Prompts205206After setting up the MCP server in Cursor, you can use natural language to interact with Nile databases. Here are some example prompts:207208#### Database Management209```210Create a new database named "my_app" in AWS_US_WEST_2 region211212List all my databases213214Get details for database "my_app"215216Delete database "test_db"217```218219#### Creating Tables220```221Create a users table in my_app database with columns:222- tenant_id (UUID, references tenants)223- id (INTEGER)224- email (VARCHAR, unique per tenant)225- name (VARCHAR)226- created_at (TIMESTAMP)227228Create a products table in my_app database with columns:229- tenant_id (UUID, references tenants)230- id (INTEGER)231- name (VARCHAR)232- price (DECIMAL)233- description (TEXT)234- created_at (TIMESTAMP)235```236237#### Querying Data238```239Execute this query on my_app database:240SELECT * FROM users WHERE tenant_id = 'your-tenant-id' LIMIT 5241242Run this query on my_app:243INSERT INTO users (tenant_id, id, email, name)244VALUES ('tenant-id', 1, 'user@example.com', 'John Doe')245246Show me all products in my_app database with price > 100247```248249#### Schema Management250```251Show me the schema for the users table in my_app database252253Add a new column 'status' to the users table in my_app database254255Create an index on the email column of the users table in my_app256```257258### Available Tools259260The server provides the following tools for interacting with Nile databases:261262#### Database Management2632641. **create-database**265 - Creates a new Nile database266 - Parameters:267 - `name` (string): Name of the database268 - `region` (string): Either `AWS_US_WEST_2` (Oregon) or `AWS_EU_CENTRAL_1` (Frankfurt)269 - Returns: Database details including ID, name, region, and status270 - Example: "Create a database named 'my-app' in AWS_US_WEST_2"2712722. **list-databases**273 - Lists all databases in your workspace274 - No parameters required275 - Returns: List of databases with their IDs, names, regions, and status276 - Example: "List all my databases"2772783. **get-database**279 - Gets detailed information about a specific database280 - Parameters:281 - `name` (string): Name of the database282 - Returns: Detailed database information including API host and DB host283 - Example: "Get details for database 'my-app'"2842854. **delete-database**286 - Deletes a database287 - Parameters:288 - `name` (string): Name of the database to delete289 - Returns: Confirmation message290 - Example: "Delete database 'my-app'"291292#### Credential Management2932941. **list-credentials**295 - Lists all credentials for a database296 - Parameters:297 - `databaseName` (string): Name of the database298 - Returns: List of credentials with IDs, usernames, and creation dates299 - Example: "List credentials for database 'my-app'"3003012. **create-credential**302 - Creates new credentials for a database303 - Parameters:304 - `databaseName` (string): Name of the database305 - Returns: New credential details including username and one-time password306 - Example: "Create new credentials for database 'my-app'"307 - Note: Save the password when it's displayed, as it won't be shown again308309#### Region Management3103111. **list-regions**312 - Lists all available regions for creating databases313 - No parameters required314 - Returns: List of available AWS regions315 - Example: "What regions are available for creating databases?"316317#### SQL Query Execution3183191. **execute-sql**320 - Executes SQL queries on a Nile database321 - Parameters:322 - `databaseName` (string): Name of the database to query323 - `query` (string): SQL query to execute324 - `connectionString` (string, optional): Pre-existing connection string to use for the query325 - Returns: Query results formatted as a markdown table with column headers and row count326 - Features:327 - Automatic credential management (creates new if not specified)328 - Secure SSL connection to database329 - Results formatted as markdown tables330 - Detailed error messages with hints331 - Support for using existing connection strings332 - Example: "Execute SELECT * FROM users LIMIT 5 on database 'my-app'"333334#### Resource Management3353361. **read-resource**337 - Reads schema information for database resources (tables, views, etc.)338 - Parameters:339 - `databaseName` (string): Name of the database340 - `resourceName` (string): Name of the resource (table/view)341 - Returns: Detailed schema information including:342 - Column names and types343 - Primary keys and indexes344 - Foreign key relationships345 - Column descriptions and constraints346 - Example: "Show me the schema for the users table in my-app"3473482. **list-resources**349 - Lists all resources (tables, views) in a database350 - Parameters:351 - `databaseName` (string): Name of the database352 - Returns: List of all resources with their types353 - Example: "List all tables in my-app database"354355#### Tenant Management3563571. **list-tenants**358 - Lists all tenants in a database359 - Parameters:360 - `databaseName` (string): Name of the database361 - Returns: List of tenants with their IDs and metadata362 - Example: "Show all tenants in my-app database"3633642. **create-tenant**365 - Creates a new tenant in a database366 - Parameters:367 - `databaseName` (string): Name of the database368 - `tenantName` (string): Name for the new tenant369 - Returns: New tenant details including ID370 - Example: "Create a tenant named 'acme-corp' in my-app"3713723. **delete-tenant**373 - Deletes tenants in the database374 - Parameters:375 - `databaseName` (string): Name of the database376 - `tenantName` (string): Name for the tenant377 - Returns: Success if the tenant is deleted378 - Example: "Delete tenant named 'acme-corp' in my-app"379380### Example Usage381382Here are some example commands you can use in Claude Desktop:383384```385# Database Management386Please create a new database named "my-app" in the AWS_US_WEST_2 region.387Can you list all my databases?388Get the details for database "my-app".389Delete the database named "test-db".390391# Connection String Management392Get a connection string for database "my-app".393# Connection string format: postgres://<user>:<password>@<region>.db.thenile.dev:5432/<database>394# Example: postgres://cred-123:password@us-west-2.db.thenile.dev:5432/my-app395396# SQL Queries397Execute SELECT * FROM users LIMIT 5 on database "my-app"398Run this query on my-app database: SELECT COUNT(*) FROM orders WHERE status = 'completed'399Using connection string "postgres://user:pass@host:5432/db", execute this query on my-app: SELECT * FROM products WHERE price > 100400```401402### Response Format403404All tools return responses in a standardized format:405- Success responses include relevant data and confirmation messages406- Error responses include detailed error messages and HTTP status codes407- SQL query results are formatted as markdown tables408- All responses are formatted for easy reading in Claude Desktop409410### Error Handling411412The server handles various error scenarios:413- Invalid API credentials414- Network connectivity issues415- Invalid database names or regions416- Missing required parameters417- Database operation failures418- SQL syntax errors with helpful hints419- Rate limiting and API restrictions420421### Troubleshooting4224231. If Claude says it can't access the tools:424 - Check that the server path in the configuration is correct425 - Ensure the project is built (`npm run build`)426 - Verify your API key and workspace slug are correct427 - Restart Claude Desktop4284292. If database creation fails:430 - Check your API key permissions431 - Ensure the database name is unique in your workspace432 - Verify the region is one of the supported options4334343. If credential operations fail:435 - Verify the database exists and is in the READY state436 - Check that your API key has the necessary permissions437438## Development439440### Project Structure441442```443nile-mcp-server/444├── src/445│ ├── server.ts # MCP server implementation446│ ├── tools.ts # Tool implementations447│ ├── types.ts # Type definitions448│ ├── logger.ts # Logging utilities449│ ├── index.ts # Entry point450│ └── __tests__/ # Test files451│ └── server.test.ts452├── dist/ # Compiled JavaScript453├── logs/ # Log files directory454├── .env # Environment configuration455├── .gitignore # Git ignore file456├── package.json # Project dependencies457└── tsconfig.json # TypeScript configuration458```459460### Key Files461462- `server.ts`: Main server implementation with tool registration and transport handling463- `tools.ts`: Implementation of all database operations and SQL query execution464- `types.ts`: TypeScript interfaces for database operations and responses465- `logger.ts`: Structured logging with daily rotation and debug support466- `index.ts`: Server startup and environment configuration467- `server.test.ts`: Comprehensive test suite for all functionality468469### Development470471```bash472# Install dependencies473npm install474475# Build the project476npm run build477478# Start the server in production mode479node dist/index.js480481# Start the server using npm script482npm start483484# Start in development mode with auto-rebuild485npm run dev486487# Run tests488npm test489```490491### Development Scripts492493The following npm scripts are available:494- `npm run build`: Compiles TypeScript to JavaScript495- `npm start`: Starts the server in production mode496- `npm run dev`: Starts the server in development mode with auto-rebuild497- `npm test`: Runs the test suite498- `npm run lint`: Runs ESLint for code quality checking499- `npm run clean`: Removes build artifacts500501### Testing502503The project includes a comprehensive test suite that covers:504- Tool registration and schema validation505- Database management operations506- Connection string generation507- SQL query execution and error handling508- Response formatting and error cases509510Run the tests with:511```bash512npm test513```514515### Logging516517The server uses structured logging with the following features:518- Daily rotating log files519- Separate debug logs520- JSON formatted logs with timestamps521- Console output for development522- Log categories: info, error, debug, api, sql, startup523524## License525526MIT License - See [LICENSE](LICENSE) for details.527528## Related Links529530- [Model Context Protocol](https://modelcontextprotocol.io)531- [Nile Database](https://thenile.dev)532- [Claude Desktop](https://claude.ai/desktop)533- [Cursor](https://cursor.sh)534
Full transparency — inspect the skill content before installing.