nxmcp - NexusDB MCP Server
An MCP (Model Context Protocol) server that enables AI assistants to interact with NexusDB databases. Built with Delphi, this server exposes NexusDB operations as MCP tools and resources.
Features
- Query Execution - Run SELECT queries and retrieve results as JSON
- Data Manipulation - Insert, update, and delete records
- Schema Management - Create tables, add columns, manage indexes
- Discovery - List tables, view schemas, get table structures, list indexes
- Utility - Count records, show query execution plan
Requirements
- Delphi (RAD Studio 13) with NexusDB Komponente
- NexusDB NXserver running and accessible
- https://github.com/GDKsoftware/Delphi-MCP-Server (may have additional depencies)
- https://github.com/viniciussanchez/dataset-serialize
- Windows OS
Configuration
Edit Source/nxconfig.ini and put it next to the executable before running:
[Connection]
ServerHost=localhost
ServerPort=16000
[Database]
AliasName=YourDatabaseAlias
TablePassword=optional_table_password
[Authentication]
Username=your_username
Password=your_password
[Options]
AutoConnect=1
Timeout=30000
Edit Source/settings.ini and put it next to the executable before running:
; for a detailed example check https://github.com/GDKsoftware/Delphi-MCP-Server
[Server]
Port=3000
Host=localhost
Name=nxmcp
Version=1.0.0
Endpoint=/mcp
; Server configuration=
[CORS]
Enabled=1
AllowedOrigins=http://localhost,http://127.0.0.1,https://localhost,https://127.0.0.1
; Comma-separated list of allowed origins=
; Cross-Origin Resource Sharing configuration=
[SSL]
Enabled=0
CertFile=
KeyFile=
RootCertFile=
Building
- Open
Source/nxmcp.dprin Delphi - Ensure NexusDB components and the MCP library are in your search path
- Build the project (Ctrl+F9)
Running
nxmcp.exe
The server starts on http://localhost:3000/mcp by default.
Available Tools
Query & Discovery
| Tool | Description | Parameters |
|---|---|---|
execute_query | Run SELECT queries | sql |
get_table_schema | Get table structure | tableName |
Data Manipulation
| Tool | Description | Parameters |
|---|---|---|
get_table_data | Read table data with pagination | tableName, maxRows?, offset?, orderBy? |
insert_record | Insert a new record | tableName, data (JSON string) |
update_records | Update matching records | tableName, data (JSON string), whereClause |
delete_records | Delete matching records | tableName, whereClause |
execute_sql | Run INSERT/UPDATE/DELETE | sql |
Schema Management
| Tool | Description | Parameters |
|---|---|---|
create_table | Create a new table | tableName, columns (JSON array) |
drop_table | Delete a table | tableName |
copy_table | Clone a table | sourceTable, targetTable, copyData? |
rename_table | Rename a table | oldName, newName |
add_column | Add a column | tableName, columnName, columnType, size?, defaultValueType? |
drop_column | Remove a column | tableName, columnName |
modify_column | Modify a column | tableName, columnName, newType?, newSize?, newName? |
create_index | Create an index | tableName, indexName, columns, unique? |
drop_index | Remove an index | tableName, indexName |
Table Maintenance
| Tool | Description | Parameters |
|---|---|---|
empty_table | Delete all records (keeps structure) | tableName |
pack_table | Compact table, reclaim deleted space | tableName |
reindex_table | Rebuild an index | tableName, indexName |
recover_table | Recover records from broken table | tableName |
change_password | Change table password | tableName, oldPassword, newPassword |
get_autoinc_value | Get next auto-increment value | tableName |
Transactions
| Tool | Description | Parameters |
|---|---|---|
batch_execute | Execute multiple SQL in one transaction | statements (JSON array), snapshot? |
Utility
| Tool | Description | Parameters |
|---|---|---|
count_records | Fast record count via metadata | tableName |
list_indexes | List all indexes on a table | tableName |
explain_query | Show query execution plan | sql |
Available Resources
| URI | Description |
|---|---|
nexusdb://server | Connection status and server info |
nexusdb://tables | List of all tables |
nexusdb://schema | Schema overview with record counts |
Column Types
For create_table and add_column:
AutoInc- Auto-incrementing integerShortString- ANSI string (specify size)WideString- Unicode string (specify size)Integer- 32-bit integerInt64- 64-bit integerWord- 16-bit unsignedByte- 8-bit unsignedBoolean- True/FalseFloat- Double precisionCurrency- Currency typeDateTime- Date and timeDate- Date onlyTime- Time onlyBlob- Binary dataMemo- Large text
Default Value Types
For add_column:
CurrentDateTime- Auto-populate with current timestampCurrentUser- Auto-populate with current user
Statement Switches
Prefix SQL statements with switches to control execution:
| Switch | Syntax | Purpose |
|---|---|---|
#T | #T 5000 | Timeout in milliseconds |
#I | #I- | Disable index optimization |
#S | #S- | Disable query simplification |
#L | #L+ | Enable query logging (used by explain\_query) |
#B | #B+ | Force BLOB copying |
Example: #T 10000 SELECT * FROM LargeTable WHERE Status = 'Active'
Example Usage
Create a table
{
"name": "create_table",
"arguments": {
"tableName": "Customers",
"columns": "[{"name":"ID","type":"AutoInc"},{"name":"Name","type":"ShortString","size":100},{"name":"Email","type":"ShortString","size":255}]"
}
}
Insert a record
{
"name": "insert_record",
"arguments": {
"tableName": "Customers",
"data": "{"Name":"John Doe","Email":"john@example.com"}"
}
}
Query data
{
"name": "execute_query",
"arguments": {
"sql": "SELECT * FROM Customers WHERE Name LIKE 'J%'"
}
}
Integration with Claude Code
Simply run
claude mcp add --transport http nxmcp http://localhost:3000/mcp
Integration with Claude Desktop
Claude Desktop (currently?) does not support localhost URLs. You can try a proxy like node mcp-remote.
License
The MIT License (MIT)
Copyright (c) 2025 Dr. Pfau Fernwirktechnik GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.