Model Context Protocol
Model Context Protocol for Nile
The Model Context Protocol (MCP) is a standardized interface that enables Large Language Models (LLMs) like Claude to interact with external tools and services. For Nile, MCP provides a natural language interface to manage databases, execute queries, and handle database operations through AI assistants.
Key benefits:
- Natural language interaction with your databases
- Standardized interface across different AI tools
- Type-safe operations with input validation
- Real-time database management and querying
- Secure credential handling
Installing Nile Model Context Protocol
Stable Version
This will install @niledatabase/nile-mcp-server in your node_modules folder. For example: node_modules/@niledatabase/nile-mcp-server/dist/
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
Configuration
Create a .env
file in your project root:
You can get the API key and workspace from Nile console. Note the workspace name at the top and you can create an API key from the Security tab on the left.
Available Tools
Database Management
- create-database: Create new databases
- list-databases: List all databases in workspace
- get-database: Get detailed database information
- delete-database: Delete databases
Credential Management
- list-credentials: List database credentials
- create-credential: Create new database credentials
Region Management
- list-regions: List available regions for database creation
SQL Operations
- execute-sql: Execute SQL queries with results as markdown tables
Resource Management
- read-resource: Get detailed schema information
- list-resources: List all database resources
Tenant Management
- list-tenants: List all database tenants
- create-tenant: Create new tenants
- delete-tenant: Delete existing tenants
Server Modes
STDIN Mode (Default)
STDIN mode uses standard input/output for communication, ideal for direct integration with AI tools.
- Start the server:
- The server automatically uses STDIN/STDOUT for communication
SSE Mode
Server-Sent Events (SSE) mode enables HTTP-based, event-driven communication.
- Configure SSE mode in
.env
:
- Start the server:
- Connect to SSE endpoint:
- Send commands:
Claude Desktop Setup
-
Install Claude Desktop
-
Configure MCP Server:
- Open Claude Desktop
- Go to Settings > MCP Servers
- Click “Add Server”
- Add configuration:
-
Replace:
/path/to/your/nile-mcp-server
with your actual project pathyour_api_key_here
with your Nile API keyyour_workspace_slug
with your workspace slug
-
Click Save and restart Claude Desktop
Cursor Setup
-
Install Cursor
-
Configure MCP Server:
- Open Cursor
- Go to Settings (⌘,) > Features > MCP Servers
- Click “Add New MCP Server”
-
Add server configuration:
- Name:
nile-database
- Command:
- Name:
-
Replace:
your_key
with your Nile API keyyour_workspace
with your workspace slug/absolute/path/to
with your project path
-
Click Save and restart Cursor
Windsurf Setup
-
Open Windsurf and go to the Cascade assistant
-
Click on the hammmer icon (should show MCP on hover) and then on configure
-
Paste the configuration below into the mcp_configuration.json file
-
Replace:
/path/to/your/nile-mcp-server
with your actual project pathyour_api_key_here
with your Nile API keyyour_workspace_slug
with your workspace slug
-
On saving, Windsurf will ask for confirmation. Once confirmed, it should show nile-database MCP active with a green active status
Cline Setup
-
Click on MCP Servers in the Cline chat window
-
Click on the Installed tab and tap the “Configure MCP Servers” SignOutButton
-
Paste the configuration below into the cline_mcp_settings.json file
-
Replace:
/path/to/your/nile-mcp-server
with your actual project pathyour_api_key_here
with your Nile API keyyour_workspace_slug
with your workspace slug
-
On saving, Cline will ask for confirmation. Once confirmed, it should show nile-database MCP active with a green active status
Claude Code Setup
- Install Claude Code
- Add the MCP Server to Claude Code (note that right now Claude Code only supports STDIO mode, not SSE):
- You should see the following output:
- You can now use the MCP Server in Claude Code:
Example Usage
Troubleshooting
Common Issues
-
Connection Issues
- Verify API key and workspace slug
- Check server path in configuration
- Ensure project is built (
npm run build
)
-
Permission Issues
- Verify API key permissions
- Check workspace access
- Ensure correct environment variables
-
Tool Access Issues
- Restart AI tool (Claude/Cursor)
- Check server logs for errors
- Verify tool configuration
Getting Help
- Check server logs in the
logs
directory - Review error messages in AI tool
- Ensure all environment variables are set
- Verify network connectivity
Was this page helpful?