# Nile MCP

> Nile (PostgreSQL for Multi-Tenant Apps) provides natural language control over complex, isolated database environments. Use this MCP to manage B2B tenant isolation, provision new data boundaries on demand, and pull real-time performance metrics without writing SQL or clicking dashboards.

## Overview
- **Category:** databases
- **Price:** Free
- **Tags:** postgresql, multi-tenancy, saas-infrastructure, tenant-sharding, serverless-db, database-metrics

## Description

Managing multi-tenant databases is usually a pain point involving constant dashboard switching and brittle shell scripts. This MCP lets your AI client talk directly to your PostgreSQL infrastructure through Nile. You control everything from high-level database configuration to the individual user access rights within specific tenants, all via conversation.

Need to spin up a new department's isolated data space? Just ask. Need to know if storage is running low or if connections are spiking? Ask that too. Your agent handles the complexity of mapping those requests into precise actions against your virtual boundaries. It gives you full visibility into who can access what, and exactly how much compute power each tenant uses. Connecting this MCP through Vinkius means you get to manage all your complex database needs—from provisioning new tenants to auditing user access—all from one place in any compatible AI client.

## Tools

### list_databases
Lists all top-level, tenant-aware PostgreSQL databases configured on Nile for querying.

### get_database
Retrieves detailed configuration and current state information for any specific Nile database endpoint.

### list_tenants
Lists all active, virtualized B2B tenants currently residing within a specified Nile database.

### create_tenant
Provisions a new, highly isolated virtual tenant boundary inside the existing database structure.

### list_users
Retrieves an enumeration of all globally tracked users who have access to various segments of tenant data.

### get_metrics
Pulls precise operational performance numbers that track the overall strain and utilization of the database.

## Prompt Examples

**Prompt:** 
```
List all active databases in my Nile account
```

**Response:** 
```
I've retrieved your Nile databases. Highlights include 'production-v1' (Status: Active), 'staging-cluster', and 'analytics-db'. Would you like to see the configuration details or metrics for the production database?
```

**Prompt:** 
```
Create a new isolated tenant called 'Acme-Corp' in the 'production-v1' database
```

**Response:** 
```
Provisioning virtual tenant boundary… Success. I've created 'Acme-Corp' (ID: ten-12345) inside your production database. This tenant is now logically isolated and ready for data sharding. Would you like me to verify the initial metrics for this new boundary?
```

**Prompt:** 
```
Show me the compute and storage metrics for database 'production-v1'
```

**Response:** 
```
Retrieving performance metrics… For 'production-v1', you currently have 45 active connections out of a 100 limit. Storage usage is at 2.4 GB (12% of cap). Compute utilization averaged 15% over the last hour. Everything looks healthy. Would you like a list of active users?
```

## Capabilities

### Inventory Databases
List all high-level tenant-aware PostgreSQL databases provisioned on Nile for immediate context.

### Monitor Performance Metrics
Pull exact operational numbers showing database strain, active connections, and compute utilization over time.

### Provision Tenant Boundaries
Instantly create highly isolated virtual tenant boundaries within an existing database to support new B2B clients.

### Audit User Access
Enumerate all globally tracked users and map their identities to specific internal tenants for access control checks.

### Inspect Tenant Data Isolation
Query the strict virtual boundaries that split tenant data, allowing deep inspection of exact SaaS IDs before querying records.

## Use Cases

### Onboarding a New Enterprise Client
The architect needs to add 'Global Corp' as a new, isolated client in the main production database. They ask their agent to execute `create_tenant` with the name 'Global-Corp'. The MCP provisions the virtual boundary and confirms the ID, making the process instant and fully auditable.

### Investigating Performance Bottlenecks
The database engineer notices slow query times. They ask their agent to run `get_metrics` on the affected cluster. The MCP returns current connection counts, storage exhaustion layers, and compute utilization instantly, pinpointing if the issue is resource-based.

### Verifying Data Segmentation
A compliance officer needs to confirm that Client A's data can never leak into Client B's space. They use `list_tenants` and then prompt the agent to query the virtual boundaries, ensuring the segmentation is strictly enforced at the database level.

### Mapping User Permissions
The security team needs a full picture of who has access. They run `list_users`, which gives them a master list of global users. They then use `list_tenants` to verify that each user is only associated with the tenants they are authorized for.

## Benefits

- Provisioning Tenants: Instead of writing a provisioning script, you simply ask the agent to create a new isolated tenant boundary using `create_tenant`, instantly segmenting data for a new client.
- Performance Monitoring: You get immediate visibility into database health by requesting operational metrics via `get_metrics`. It shows true active connections and storage usage without needing to jump through monitoring dashboards.
- Auditing Access: The combination of `list_users` and `list_tenants` lets you audit user access patterns. Your agent correlates global identities to specific virtual tenants, ensuring strict access control compliance.
- Deep Configuration Checks: Need to know the exact state of a production cluster? Use `get_database` to pull detailed configuration JSON directly into your chat window for quick validation.
- Data Discovery: Before running deep data checks, use `list_databases` to map out all potential targets. This helps you scope exactly which tenant-aware PostgreSQL databases need attention.

## How It Works

The bottom line is that you manage your entire multi-tenant infrastructure by simply talking to it.

1. Subscribe to this MCP and provide your specific Nile API URL and API Key.
2. Connect your AI agent (like Claude or Cursor) through the Vinkius marketplace using these credentials.
3. Ask a natural language question, like 'What are the active connections for my production environment?' Your agent executes the necessary tools and returns structured data.

## Frequently Asked Questions

**How does the Nile MCP help with data isolation?**
The MCP provides tools like `create_tenant` and `list_tenants` which provision and manage highly isolated virtual boundaries (shards) inside Postgres, ensuring one tenant's actions don't affect another.

**Do I need to manually write SQL when using the Nile MCP?**
No. The goal is conversation-based control. You tell your agent what you want—like 'Show me storage exhaustion metrics'—and it handles the underlying database calls for you.

**Can I check connection limits using the get_metrics tool?**
Yes, `get_metrics` pulls operational data that tracks active connections. It tells you how many connections are currently open against your defined usage limits.

**What if I have a new client and need to add them? Should I use the Nile MCP?**
Yes, always use the MCP's `create_tenant` tool. This ensures the new B2B tenant is provisioned with proper virtual boundaries and isolation from day one.

**Does the Nile MCP help me audit who can access my data?**
Absolutely. You use `list_users` to see all global users, and then you can cross-reference that list against tenants using `list_tenants` for a full security picture.