Nile MCP Server is a Model Context Protocol (MCP) server implementation for the Nile database platform, allowing LLM applications to interact with the Nile platform through a standardized interface, thereby managing operations such as databases, tenants, users, and authentication using natural language.
Main Capabilities
- Database management: create, list, get details, and delete databases.
- Credential management: create and list database credentials; when creating credentials, a one-time password is returned, which must be saved when displayed and will not be shown again afterward.
- Region management: list the regions available for creating databases.
- SQL query support: execute SQL queries directly on the Nile database, with results returned as a Markdown table with column headers and row counts. It features automatic credential management (automatically created when not specified), secure SSL connections, support for using an existing connection string, and detailed error messages.
- Resources and tenants: read schema information for database resources (tables, views, etc.) (column names and types, primary keys and indexes, foreign key relationships, column descriptions and constraints), and list all resources in the database; list, create, and delete tenants.
- MCP protocol support: fully implements the Model Context Protocol.
- Type safety and validation: written in TypeScript with full type checking, and schema-based input validation via Zod.
- Error handling: comprehensive error handling and user-friendly error messages.
- Test coverage: a complete test suite using Jest.
- Environment management: automatically loads environment variables from the .env file.
Installation and Running
Install the stable version:npm install @niledatabase/nile-mcp-server(The original text only gives this command).
Install the latest alpha/preview version: (the original text does not provide a specific command).
After installation, the package is located in node_modules, for example:node_modules/@niledatabase/nile-mcp-server/dist/.
Manual installation (the original text does not expand on the specific steps).
Other MCP package managers:npx @michaellatman/mcp-get@latest install @niledatabase/nile-mcp-server.
There are multiple ways to start the server:
- Run Node directly:
node dist/index.js - Development mode (automatic rebuild):
npm run dev
After the server starts, it listens for MCP protocol messages. The startup log will show: environment variables loaded, server instance created, tools initialized, transport connection established. Press Ctrl+C to stop the server.
Configuration
You need to create a .env file in the root directory and fill in the Nile credentials (the original text gives the steps to create a Nile API key: log in to your Nile account, click Workspaces in the upper left corner, select a workspace, and go to the Security section in the left menu).
Using with Claude Desktop
- Install Claude Desktop.
- Build the project:
npm run build. - Open Claude Desktop.
- Go to Settings > MCP Servers.
- Click "Add Server".
- Add the configuration (replace
/path/to/your/nile-mcp-serverwith the absolute path to the project directory, replaceyour_api_key_herewith the Nile API key, and replaceyour_workspace_slugwith the Nile workspace identifier).
Using with Cursor
- Install Cursor.
- Go to Settings (⌘,) > Features > MCP Servers.
- Click "Add New MCP Server".
- Configure the server: the name can be customized (e.g., nile-database), and the command is
env NILE_API_KEY=your_key NILE_WORKSPACE_SLUG=your_workspace node /absolute/path/to/nile-mcp-server/dist/index.js, and you need to replace your_key, your_workspace, and /absolute/path/to. - A green indicator means the MCP server is connected.
- Restart Cursor for the changes to take effect.
Running Modes
The server supports two running modes:
- Default mode: uses standard input/output communication, compatible with Claude Desktop and Cursor integration.
- SSE mode: implements real-time, event-driven communication over HTTP. How to enable: set
MCP_SERVER_MODE=ssein .env; the server will start an HTTP server (default port 3000); SSE endpoint:http://localhost:3000/sse; Command send address:http://localhost:3000/messages. The original text provides a curl example (specific content not expanded).
Available tools
- create-database: Create a new Nile database. Parameters: name (string, database name), region (string, optional AWS_US_WEST_2 (Oregon) or AWS_EU_CENTRAL_1 (Frankfurt)). Returns database details (ID, name, region, status).
- list-databases: List all databases in the workspace. No parameters required. Returns a list of databases (ID, name, region, status).
- get-database: Get detailed information about a specific database. Parameters: name (string). Returns detailed database information, including the API host and database host.
- delete-database: Delete a database. Parameters: name (string). Returns a confirmation message.
- list-credentials: List all credentials for a database. Parameters: databaseName (string). Returns a list of credentials (ID, username, creation date).
- create-credential: Create a new credential for a database. Parameters: databaseName (string). Returns the new credential details, including the username and one-time password.
- list-regions: List the available regions for creating databases. No parameters required. Returns a list of available AWS regions.
- execute-sql: Execute an SQL query on a Nile database. Parameters: databaseName (string), query (string), connectionString (string, optional, existing connection string). Returns the query results in Markdown table format, including column headers and row count.
- read-resource: Read the schema information of a database resource (table, view, etc.). Parameters: databaseName (string), resourceName (string, table/view name). Returns column names and types, primary keys and indexes, foreign key relationships, column descriptions and constraints.
- list-resources: List all resources (tables, views) in a database. Parameters: databaseName (string). Returns a list of all resources and their types.
- list-tenants: List all tenants in a database. Parameters: databaseName (string). Returns a list of tenants (ID andmetadata).
- create-tenant: Create a new tenant in the database. Parameters: databaseName (string), tenantName (string). Returns the new tenant details (including ID).
- delete-tenant: Delete a tenant in the database. Parameters: databaseName (string), tenantName (string). Returns a success message on successful deletion.
Response Format and Error Handling
All tools return responses in a standardized format: success responses contain the relevant data and a confirmation message; error responses contain a detailed error message and an HTTP status code; SQL query results are formatted as Markdown tables for easy reading in Claude Desktop. The server can handle a variety of error scenarios: invalid API credentials, network connection issues, invalid database name or region, missing required parameters, database operation failures, SQL syntax errors (with hints), rate limits, and API limits.
Troubleshooting
- Claude reports it cannot access the tools: Check whether the server path in the configuration is correct; make sure the project has been built (npm run build); verify that the API key and workspace identifier are correct; restart Claude Desktop.
- Database creation fails: Check the API key permissions; make sure the database name is unique within the workspace; verify that the region is a supported option.
- Credential operations fail: Verify that the database exists and is in READY state; check whether the API key has the necessary permissions.
Project Structure
- server.ts: Main server implementation, including tool registration and transport handling.
- tools.ts: Implementation of all database operations and SQL query execution.
- types.ts: TypeScript interfaces for database operations and responses.
- logger.ts: Structured logging, with daily rotation and debugging support.
- index.ts: The original text is truncated here (content incomplete).
For more information, see Discord, the website, and Issues (links given in the original text).