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.
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
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
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.
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
.
npm run build
{
"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.
npm run build
nile-database
(or any name you prefer)env NILE_API_KEY=your_key NILE_WORKSPACE_SLUG=your_workspace node /absolute/path/to/nile-mcp-server/dist/index.js
The default mode uses standard input/output for communication, making it compatible with Claude Desktop and Cursor integrations.
Server-Sent Events (SSE) mode enables real-time, event-driven communication over HTTP.
To enable SSE mode:
MCP_SERVER_MODE=sse
in your .env
filehttp://localhost:3000/sse
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": {}
}'
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
If Claude says it can't access the tools:
npm run build
)If database creation fails:
If credential operations fail:
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.
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"
]
}
}
}
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.
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.