Skip to main content
Glama
t3ta
by t3ta

Servidor SQL MCP (TypeScript)

Mecanografiado ConstruirLicencia: MITPlataforma

Este proyecto proporciona una implementación de TypeScript de un servidor de Protocolo de contexto de modelo (MCP) que permite que los modelos de lenguaje y otros clientes compatibles con MCP consulten bases de datos PostgreSQL a través de túneles bastión SSH cuando sea necesario.

Diseñado para brindar flexibilidad y acceso seguro a bases de datos, admite AWS RDS con transacciones de solo lectura y utiliza comunicación basada en stdin/stdout, lo que lo hace adecuado para casos de uso locales, en contenedores o impulsados por IA.

Características

  • 🔒 Compatibilidad con bastión SSH para acceso seguro a instancias privadas de RDS a través de túneles SSH

  • 🐘 Motor de consultas de solo lectura PostgreSQL que utiliza la biblioteca pg

  • Transporte de protocolo MCP basado en STDIO

  • 🧠 Compatible con el servidor mcp del banco de memoria

  • ⚙️ Fácilmente configurable a través de .env o variables de entorno

  • 🧪 Totalmente comprobable con Jest y mocks


Related MCP server: Enhanced PostgreSQL MCP Server

Instalación

Clonar el repositorio e instalar las dependencias:

git clone https://github.com/your-org/sql-mcp-server.git
cd sql-mcp-server
npm install
npm run build

Configuration (Optional .env file)

Create a .env file in the project root:

DB_USER=postgres
DB_PASS=yourpassword
DB_HOST=localhost
DB_PORT=5432
DB_NAME=mydatabase
USE_SSH_TUNNEL=true
SSH_BASTION_HOST=bastion.example.com
SSH_BASTION_USER=ec2-user
SSH_PRIVATE_KEY_PATH=~/.ssh/id_rsa

Usage

Run the server using npx:

npx -y @modelcontextprotocol/server-postgres postgresql://<user>:<pass>@localhost:5433/<dbname>

For direct connection without SSH tunneling, set the appropriate environment variables:

DB_HOST=rds-host.amazonaws.com DB_PORT=5432 npx -y @modelcontextprotocol/server-postgres postgresql://<user>:<pass>@rds-host.amazonaws.com/<dbname>

Sample Input

{
  "type": "call_tool",
  "params": {
    "name": "query",
    "arguments": {
      "sql": "SELECT * FROM users LIMIT 10"
    }
  }
}

Sample Output

{
  "content": [
    {
      "type": "text",
      "text": "[{\"id\":1,\"name\":\"Alice\"}]"
    }
  ],
  "isError": false
}



⸻

Related Docs
	•	Architecture
	•	Domain Models
	•	Glossary
	•	Coding Standards
	•	Tech Stack
	•	User Guide

⸻

License

MIT

⸻

Contribution Guide

We welcome community contributions! Please see CONTRIBUTING.md for details.

⸻

Compatibility

This implementation follows the Model Context Protocol (MCP) and has been tested for compatibility with:
	•	memory-bank-mcp-server
	•	Claude Desktop (via STDIO)
	•	Cursor IDE
	•	Supabase + MCP integration
A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    F
    maintenance
    A Model Context Protocol server providing both read and write access to PostgreSQL databases, enabling LLMs to query data, modify records, and manage database schemas.
    337
    10
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    A Model Context Protocol server providing dual transport (HTTP and Stdio) access to PostgreSQL databases, allowing AI assistants to query databases and fetch schema information through natural language.
    27
    31
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    A TypeScript-based Model Context Protocol server that enables AI assistants to perform secure database operations on PostgreSQL databases through structured tool interfaces.
    8
    18
    MIT

View all related MCP servers

Related MCP Connectors

  • Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.

  • A Model Context Protocol server for Wix AI tools

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

View all MCP Connectors

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/t3ta/sql-mcp-server'

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