Nile Database MCP server

Integrates with Nile Database services to enable database operations through TypeScript-based server implementation supporting both stdio and HTTP communication modes for seamless database functionality in AI workflows.
Back to servers
Provider
Nile
Release date
Mar 11, 2025
Language
TypeScript
Package
Stats
4.0K downloads
14 stars

This MCP server implementation allows LLM applications to interact with Nile database platform through a standardized protocol interface. It provides tools for database management, SQL querying, credential management, and more.

Installation

You can install the Nile MCP server using npm:

npm install @niledatabase/nile-mcp-server

For the latest alpha/preview version:

npm install @niledatabase/nile-mcp-server@alpha

Manual Installation

If you prefer to install manually:

# Clone the repository
git clone https://github.com/yourusername/nile-mcp-server.git
cd nile-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

Configuration

Create a .env file in the root directory with your Nile credentials:

NILE_API_KEY=your_api_key_here
NILE_WORKSPACE_SLUG=your_workspace_slug

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.

Starting the Server

There are several ways to start the server:

# Direct Node execution
node dist/index.js

# Development mode (with auto-rebuild)
npm run dev

The server will start and listen for MCP protocol messages. A successful startup will show logs similar to:

[info] Starting Nile MCP Server...
[info] Loading environment variables...
[info] Environment variables loaded successfully
[info] Creating server instance...
[info] Tools initialized successfully
[info] Setting up stdio transport...
[info] Server started successfully

To stop the server, press Ctrl+C.

Using with Claude Desktop

Setup

  1. Install Claude Desktop
  2. Build the project: npm run build
  3. Open Claude Desktop
  4. Go to Settings > MCP Servers
  5. Click "Add Server"
  6. Add the following configuration:
{
  "mcpServers": {
    "nile-database": {
      "command": "node",
      "args": [
        "/path/to/your/nile-mcp-server/dist/index.js"
      ],
      "env": {
        "NILE_API_KEY": "your_api_key_here",
        "NILE_WORKSPACE_SLUG": "your_workspace_slug"
      }
    }
  }
}

Be sure to replace the path and credentials with your actual values.

Using with Cursor

Setup

  1. Install Cursor
  2. Build the project: npm run build
  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:
      env NILE_API_KEY=your_key NILE_WORKSPACE_SLUG=your_workspace node /absolute/path/to/nile-mcp-server/dist/index.js
      
  7. Click "Save"
  8. Restart Cursor for the changes to take effect

Server 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:

# In terminal 1 - Listen for events
curl -N http://localhost:3000/sse

# In terminal 2 - Send commands
curl -X POST http://localhost:3000/messages \
  -H "Content-Type: application/json" \
  -d '{
    "type": "function",
    "name": "list-databases",
    "parameters": {}
  }'

Available Tools

Database Management

  • create-database: Creates a new database with specified name and region
  • list-databases: Lists all databases in your workspace
  • get-database: Gets detailed information about a specific database
  • delete-database: Deletes a database

Credential Management

  • list-credentials: Lists all credentials for a database
  • create-credential: Creates new credentials for a database

Region Management

  • list-regions: Lists all available regions for creating databases

SQL Query Execution

  • execute-sql: Executes SQL queries on a Nile database

Resource Management

  • read-resource: Reads schema information for database resources (tables, views)
  • list-resources: Lists all resources (tables, views) in a database

Tenant Management

  • list-tenants: Lists all tenants in a database
  • create-tenant: Creates a new tenant in a database
  • delete-tenant: Deletes a tenant in a database

Example Prompts

After setting up the MCP server, you can use natural language to interact with Nile databases:

Create a new database named "my_app" in AWS_US_WEST_2 region

List all my databases

Get details for database "my_app"

Delete database "test_db"

Create a users table in my_app database with columns:
- tenant_id (UUID, references tenants)
- id (INTEGER)
- email (VARCHAR, unique per tenant)
- name (VARCHAR)
- created_at (TIMESTAMP)

Execute this query on my_app database:
SELECT * FROM users WHERE tenant_id = 'your-tenant-id' LIMIT 5

Show me the schema for the users table in my_app database

Troubleshooting

  1. If Claude says it can't access the tools:

    • Check that the server path in the configuration is correct
    • Ensure the project is built (npm run build)
    • Verify your API key and workspace slug are correct
    • Restart Claude Desktop
  2. If database creation fails:

    • Check your API key permissions
    • Ensure the database name is unique in your workspace
    • Verify the region is one of the supported options
  3. If credential operations fail:

    • Verify the database exists and is in the READY state
    • Check that your API key has the necessary permissions

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later