Skip to main content
Glama
pickstar-2002

MySQL MCP Server

mysql_create_database

Creates a MySQL database with specified name, charset, and collation. Simplifies database setup for efficient management and structured data storage.

Instructions

创建数据库

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
charsetNo字符集(可选)utf8mb4
collationNo排序规则(可选)utf8mb4_unicode_ci
nameYes数据库名称

Implementation Reference

  • Core handler function in DatabaseManager that constructs and executes the CREATE DATABASE SQL statement with optional charset and collation.
    async createDatabase(name: string, charset?: string, collation?: string): Promise<void> { let sql = `CREATE DATABASE \`${name}\``; if (charset) { sql += ` CHARACTER SET ${charset}`; } if (collation) { sql += ` COLLATE ${collation}`; } await this.query(sql); }
  • MCP server handler method that calls DatabaseManager.createDatabase and formats the response.
    private async handleCreateDatabase(args: { name: string; charset?: string; collation?: string }): Promise<any> { await this.dbManager.createDatabase(args.name, args.charset, args.collation); return { content: [ { type: 'text', text: `成功创建数据库: ${args.name}`, }, ], }; }
  • Input schema definition for the mysql_create_database tool, including parameters name (required), charset, and collation.
    name: 'mysql_create_database', description: '创建数据库', inputSchema: { type: 'object', properties: { name: { type: 'string', description: '数据库名称' }, charset: { type: 'string', description: '字符集(可选)', default: 'utf8mb4' }, collation: { type: 'string', description: '排序规则(可选)', default: 'utf8mb4_unicode_ci' }, }, required: ['name'], }, },
  • src/server.ts:239-240 (registration)
    Switch case registration that routes mysql_create_database calls to the handleCreateDatabase method.
    case 'mysql_create_database': return await this.handleCreateDatabase(args as any);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pickstar-2002/mysql-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server