NocoDB MCP Server
Introduction
The NocoDB MCP Server provides a comprehensive toolkit for interacting with your NocoDB database through the Model Context Protocol (MCP). With 13 powerful tools, this server enables you to perform advanced database operations including CRUD operations, table management, relationship creation, and custom API calls - all through natural language commands.
Example Prompts
Basic CRUD Operations
[Get Records with Filtering]
Get all active users from the Users table where age > 25
Filter: (age,gt,25)~and(status,eq,active)
[Create Single Record]
Add a new user named John Doe with email john@example.com
[Bulk Create Records]
Create 5 new products from the product_list.json file
[Update Record]
Update user ID 42 - change status to 'premium'
[Bulk Delete]
Delete all inactive users from last year
Advanced Table Management
[Create New Table]
Create a Products table with columns:
- Name (text)
- Price (number)
- InStock (checkbox)
- CreatedAt (datetime)
[Add Column]
Add a 'Description' text column to the Products table
[Remove Column]
Remove the obsolete 'LegacyCode' column from Products
Table Relationships
[One-to-Many Relationship]
Create a relationship between Teams and Members tables
One team can have many members
[Many-to-Many Relationship]
Link Students and Courses tables
Students can enroll in multiple courses
[Belongs To Relationship]
Connect Orders to Customers
Each order belongs to one customer
Custom API Operations
[Custom API Call]
Make a GET request to /api/v2/meta/bases/{baseId}/info
to get detailed base information
[Complex Filtering]
Find all orders from last month with amount > $1000
and status = 'completed', sorted by date
Real-World Use Cases
1. E-Commerce Database Setup
Create an e-commerce database structure:
1. Create Products, Categories, Customers, and Orders tables
2. Link Products to Categories (many-to-many)
3. Link Orders to Customers (belongs-to)
4. Link Orders to Products (many-to-many through OrderItems)
2. Data Migration from JSON
Migrate data from legacy system:
1. Create tables from JSON schema files
2. Bulk import records from exported data
3. Establish relationships between imported tables
4. Validate data integrity with custom API calls
Example file: example_upload.json
3. Analytics and Reporting
Generate monthly sales report:
1. Filter orders by date range
2. Join with customer and product data
3. Calculate totals using custom API endpoints
4. Export results in required format
Visual Examples
Bulk Operations Demo
About This Fork
This repository is a TypeScript-based fork of NocoDB-MCP-Server. It retains the core functionality while improving maintainability and compatibility with modern TypeScript development practices.
Setup
Ensure that Node.js and TypeScript are installed, then execute:
npm install
npm run build
Configuration
Define the required environment variables in a .env
file:
NOCODB_URL=https://your-nocodb-instance.com
NOCODB_API_TOKEN=your_api_token_here
NOCODB_BASE_ID=your_base_id_here
Tip: You can copy the template from env.example and fill in your values.
How to Obtain NOCODB_BASE_ID
To find your NOCODB_BASE_ID
, check the URL of your Nocodb instance.
For example:
https://app.nocodb.com/#/wi6evls6/pqmob3ammcknma5/maty9c5xkmf4012
In this URL format:
https://app.nocodb.com/#/{USERNAME}/{NOCODB_BASE_ID}/{TABLE_ID}
Integration with Claude Desktop
Modify claude_desktop_config.json
to include:
{
"mcpServers": {
"nocodb": {
"command": "node",
"args": ["{working_folder}/dist/start.js"],
"env": {
"NOCODB_URL": "https://your-nocodb-instance.com",
"NOCODB_BASE_ID": "your_base_id_here",
"NOCODB_API_TOKEN": "your_api_token_here"
}
}
}
}
Direct call from CLI
You can directly call the MCP server from the command line:
NOCODB_URL, NOCODB_API_TOKEN, and NOCODB_BASE_ID are required parameters.NOCODB_URL=https://app.nocodb.com
if you are using NocoDB cloud.
npx -y nocodb-mcp-server {NOCODB_URL} {NOCODB_BASE_ID} {NOCODB_API_TOKEN}
Testing CLI
To run the tests, execute:
npx -y @wong2/mcp-cli npx nocodb-mcp-server {NOCODB_URL} {NOCODB_BASE_ID} {NOCODB_API_TOKEN}
Comprehensive Tool Suite (13 Tools)
Data Operations
- nocodb-get-records - Advanced record retrieval with filtering, sorting, pagination, and field selection
- nocodb-post-records - Create single records with data validation
- nocodb-post-records-bulk - Efficiently create multiple records in batch
- nocodb-patch-records - Update existing records with partial data
- nocodb-delete-records - Remove individual records safely
- nocodb-delete-records-bulk - Batch delete multiple records
Table Management
- nocodb-get-list-tables - Discover all available tables in your base
- nocodb-get-table-metadata - Inspect table structure, columns, and configurations
- nocodb-create-table - Design and create new tables with custom schemas
- nocodb-alter-table-add-column - Dynamically add columns to existing tables
- nocodb-alter-table-remove-column - Remove unnecessary columns safely
Advanced Features
nocodb-create-table-relation - Establish powerful relationships between tables:
- Has Many (hm): One-to-many relationships
- Many to Many (mm): Many-to-many with junction tables
- Belongs To (bt): Many-to-one relationships
nocodb-custom-api-call - Execute any NocoDB API endpoint for:
- Complex queries beyond standard operations
- Administrative tasks
- Custom integrations
- Direct API access when needed
API Functions
For detailed information about available API functions, please refer to API_FUNCTION.md.
Project Structure
/project-root
├── src/ # TypeScript source files
├── dist/ # Compiled JavaScript output
├── .env # Environment variable configurations
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript settings
Contribution Guidelines
Contributions are encouraged! Feel free to open issues or submit pull requests.
License
This project is distributed under MIT.