nile-mcp-server
Nile MCP Server: Securely connect LLMs to Nile databases for easy data management and querying.

nile-mcp-server Solution Overview
The Nile MCP Server is a crucial component, acting as a bridge between Large Language Models (LLMs) and the Nile database. As an MCP server implementation, it enables AI applications to securely access and manipulate data within the Nile ecosystem through a standardized interface.
This server empowers LLMs to perform database operations, manage credentials, and execute SQL queries on Nile databases. Key features include database and credential management, SQL query support, and full MCP protocol implementation. Built with TypeScript, it ensures type safety and provides comprehensive error handling.
By using the Nile MCP Server, developers can seamlessly integrate AI models with the Nile database, unlocking the potential for AI-driven data interactions. It supports both STDIO and SSE modes, offering flexibility in deployment. Installation is straightforward via npm, and integration guides are available for Claude Desktop and Cursor, making it easy to get started.
nile-mcp-server Key Capabilities
Database Lifecycle Management
The Nile MCP Server provides a suite of tools for managing the lifecycle of Nile databases directly through natural language commands. This includes creating new databases with specified names and regions (AWS_US_WEST_2 or AWS_EU_CENTRAL_1), listing existing databases within a workspace, retrieving detailed information about a specific database (including API and DB host information), and deleting databases that are no longer needed. This functionality is exposed through the create-database
, list-databases
, get-database
, and delete-database
tools.
For example, a user could ask an LLM: "Create a new database named 'my_app' in AWS_US_WEST_2 region". The server would then use the Nile API to provision the database, returning details such as the database ID, name, region, and status. This simplifies database administration by abstracting away the complexities of the Nile API and allowing users to manage their databases using intuitive language. The server handles the underlying API calls and error handling, providing a seamless experience for the user.
Secure SQL Query Execution
The execute-sql
tool enables LLMs to run SQL queries against Nile databases securely. It automatically manages database credentials, creating new ones if necessary, and establishes secure SSL connections. The tool accepts a database name and a SQL query as input, executes the query, and formats the results as a markdown table, including column headers and row count. This allows LLMs to retrieve and manipulate data within Nile databases without requiring users to manually manage connections or format results.
For instance, a user could ask: "Execute SELECT * FROM users LIMIT 5 on database 'my-app'". The server would then obtain credentials, connect to the database, execute the query, and return the results in a markdown table, which can be easily displayed in applications like Claude Desktop or Cursor. The tool also provides detailed error messages with hints, aiding in debugging and troubleshooting SQL queries. It also supports the use of pre-existing connection strings for advanced use cases.
Dynamic Resource Schema Discovery
The Nile MCP Server allows LLMs to dynamically discover the schema of database resources (tables, views) using the read-resource
and list-resources
tools. The list-resources
tool lists all available resources within a specified database. The read-resource
tool then provides detailed schema information for a given resource, including column names, types, primary keys, indexes, foreign key relationships, and constraints. This enables LLMs to understand the structure of the data and generate more accurate and relevant SQL queries or data analysis.
For example, a user could ask: "Show me the schema for the users table in my-app". The server would then retrieve the schema information from the Nile database and return it to the LLM, allowing the LLM to understand the structure of the users
table and generate appropriate queries. This dynamic schema discovery is crucial for enabling LLMs to interact intelligently with evolving database schemas.
Credential Management Automation
The Nile MCP Server automates the management of database credentials through the create-credential
and list-credentials
tools. The create-credential
tool generates new credentials for a specified database, providing a username and a one-time password. The list-credentials
tool lists all existing credentials for a database, including their IDs, usernames, and creation dates. This simplifies the process of managing access to Nile databases, allowing LLMs to create and retrieve credentials as needed without requiring manual intervention.
For example, when executing a SQL query, the server can automatically create a new credential if one doesn't already exist or if the user doesn't provide a connection string. The server securely stores and manages these credentials, ensuring that LLMs can access the database without exposing sensitive information. It's important to note that the one-time password generated by create-credential
is only shown once and should be saved securely.
Server Operational Modes
The Nile MCP Server supports two operational modes: STDIO and SSE. The default STDIO mode uses standard input/output for communication, making it compatible with integrations like Claude Desktop and Cursor. This mode is simple to set up and use, requiring minimal configuration. The SSE (Server-Sent Events) mode enables real-time, event-driven communication over HTTP. In SSE mode, the server starts an HTTP server and exposes endpoints for sending commands and receiving events.
To enable SSE mode, the MCP_SERVER_MODE
environment variable must be set to sse
. This mode is useful for applications that require real-time updates or asynchronous communication. For example, a user could use curl
to send commands to the server and listen for events in a separate terminal. This flexibility in operational modes allows the Nile MCP Server to be integrated into a wide range of applications and environments.