drio
Open app

MCP 数据库服务器 (TypeScript)

Source

Catalog onlyCatalog onlySTDIO

Overview

MCP 数据库服务器是一个基于 Model Context Protocol (MCP) 的数据库查询服务器,使用 TypeScript 实现,允许 AI 模型安全地查询关系型数据库,如 MySQL 和 PostgreSQL.

To use the MCP 数据库服务器, clone the repository, install dependencies using cnpm, configure the database connection in the .env file, and then run the server.

  • Supports MySQL and PostgreSQL databases - Provides table structure information as resources - Supports read-only SQL query execution - Ensures query safety using transactions
  1. Allowing AI models to perform safe database queries.
  2. Providing structured data access for applications.
  3. Facilitating database management and interaction through a secure API.

Add to your AI client

Use these steps to connect MCP 数据库服务器 (TypeScript) in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.

Cursor

Add this to your .cursor/mcp.json file in your project root, then restart Cursor.

.cursor/mcp.json

{
  "mcpServers": {
    "mcp-server-db-ts-cherl": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-db-ts-cherl"
      ]
    }
  }
}

Claude Desktop

Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.

~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)

{
  "mcpServers": {
    "mcp-server-db-ts-cherl": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-db-ts-cherl"
      ]
    }
  }
}

Claude Code

Add this to your project's .mcp.json file. Claude Code will detect it automatically.

.mcp.json (project root)

{
  "mcpServers": {
    "mcp-server-db-ts-cherl": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-db-ts-cherl"
      ]
    }
  }
}

VS Code (Copilot)

Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.

.vscode/mcp.json

{
  "servers": {
    "mcp-server-db-ts-cherl": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-db-ts-cherl"
      ]
    }
  }
}

Windsurf

Add this to your Windsurf MCP config file, then restart Windsurf.

~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "mcp-server-db-ts-cherl": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-db-ts-cherl"
      ]
    }
  }
}

Cline

Open Cline settings, navigate to MCP Servers, and add this server configuration.

Cline MCP Settings (via UI)

{
  "mcpServers": {
    "mcp-server-db-ts-cherl": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-db-ts-cherl"
      ]
    }
  }
}

FAQ

What databases are supported?

The server supports both MySQL and PostgreSQL databases.

How do I install the server?

You can install it by cloning the repository and running `cnpm install`.

Is it safe to execute queries?

Yes, the server uses transactions to ensure the safety of query execution.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":3379,"uuid":"b0604713-07bf-4f4c-8305-b49b885238ad","name":"mcp-server-db-ts","title":"MCP 数据库服务器 (TypeScript)","description":"","avatar_url":"https://avatars.githubusercontent.com/u/13915638?v=4","created_at":"2025-03-19T06:38:51.989+00:00","updated_at":"2025-03-19T06:52:32.662+00:00","status":"created","author_name":"cherl","author_avatar_url":"https://avatars.githubusercontent.com/u/13915638?v=4","tags":"mcp-server-db-ts,database-server,typescript","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/cherl/mcp-server-db-ts","target":"_self","content":"$29","summary":"$2a","img_url":null,"type":null,"metadata":"{\"star\":\"0\",\"license\":\"\",\"language\":\"TypeScript\",\"is_official\":false,\"latest_commit_time\":\"2025-03-19 14:03:58\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]