Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"dependencies": {
"@modelcontextprotocol/sdk": "1.9.0",
"mssql": "11.0.1",
"mysql2": "^3.14.1",
"pg": "^8.11.3",
"sqlite3": "5.1.7"
},
Expand Down
44 changes: 43 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# MCP Database Server

This MCP (Model Context Protocol) server provides database access capabilities to Claude, supporting SQLite, SQL Server, and PostgreSQL databases.
This MCP (Model Context Protocol) server provides database access capabilities to Claude, supporting SQLite, SQL Server, PostgreSQL, and MySQL databases.

## Installation

Expand Down Expand Up @@ -92,6 +92,25 @@ Optional parameters:
- `--ssl`: Enable SSL connection (true/false)
- `--connection-timeout`: Connection timeout in milliseconds (default: 30000)

### MySQL Database

To use with a MySQL database:

```
node dist/src/index.js --mysql --host <host-name> --database <database-name> [--user <username> --password <password>]
```

Required parameters:
- `--host`: MySQL host name or IP address
- `--database`: Name of the database

Optional parameters:
- `--user`: Username for MySQL authentication
- `--password`: Password for MySQL authentication
- `--port`: Port number (default: 3306)
- `--ssl`: Enable SSL connection (true/false or object)
- `--connection-timeout`: Connection timeout in milliseconds (default: 30000)

## Configuring Claude Desktop

### Direct Usage Configuration
Expand Down Expand Up @@ -132,6 +151,18 @@ If you installed the package globally, configure Claude Desktop with:
"--user", "your-username",
"--password", "your-password"
]
},
"mysql": {
"command": "npx",
"args": [
"-y",
"@executeautomation/database-server",
"--mysql",
"--host", "your-host-name",
"--database", "your-database-name",
"--user", "your-username",
"--password", "your-password"
]
}
}
}
Expand Down Expand Up @@ -172,6 +203,17 @@ For local development, configure Claude Desktop to use your locally built versio
"--user", "your-username",
"--password", "your-password"
]
},
"mysql": {
"command": "node",
"args": [
"/absolute/path/to/mcp-database-server/dist/src/index.js",
"--mysql",
"--host", "your-host-name",
"--database", "your-database-name",
"--user", "your-username",
"--password", "your-password"
]
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/db/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export interface DbAdapter {
import { SqliteAdapter } from './sqlite-adapter.js';
import { SqlServerAdapter } from './sqlserver-adapter.js';
import { PostgresqlAdapter } from './postgresql-adapter.js';
import { MysqlAdapter } from './mysql-adapter.js';

/**
* Factory function to create the appropriate database adapter
Expand All @@ -72,6 +73,8 @@ export function createDbAdapter(type: string, connectionInfo: any): DbAdapter {
case 'postgresql':
case 'postgres':
return new PostgresqlAdapter(connectionInfo);
case 'mysql':
return new MysqlAdapter(connectionInfo);
default:
throw new Error(`Unsupported database type: ${type}`);
}
Expand Down
Loading