PostgreSQL Query MCP Server
MCP Postgres 쿼리 서버
Claude Desktop 및 기타 MCP 클라이언트와 함께 작동하도록 설계된, 읽기 전용 모드에서 PostgreSQL 데이터베이스를 쿼리하기 위한 MCP(Model Context Protocol) 서버 구현입니다.
개요
이 프로젝트는 다음을 제공하는 MCP(Model Context Protocol) 서버를 구현합니다.
PostgreSQL 데이터베이스에 대한 안전하고 읽기 전용 인터페이스
MCP 프로토콜을 통한 Claude Desktop과의 통합
SELECT 쿼리만 실행되도록 하는 SQL 쿼리 검증
쿼리 시간 초과 보호(10초)
Related MCP server: PostgreSQL MCP Server
필수 조건
Node.js(v14 이상)
npm(Node.js와 함께 제공)
PostgreSQL 데이터베이스(명령줄을 통해 제공되는 연결 세부 정보)
설치
지엑스피1
Claude Desktop에 연결
Claude Desktop을 구성하여 MCP 서버를 자동으로 시작하고 연결할 수 있습니다.
Claude Desktop 구성 파일에 접근합니다.
클로드 데스크톱 열기
설정 > 개발자 > 구성 편집으로 이동하세요.
이렇게 하면 기본 텍스트 편집기에서 구성 파일이 열립니다.
claude_desktop_config.json의mcpServers섹션에 postgres-query-server를 추가합니다.
{
"mcpServers": {
"postgres-query": {
"command": "node",
"args": [
"/path/to/your/mcp-postgres-query-server/dist/index.js",
"postgresql://username:password@hostname:port/database"
]
}
}
}/path/to/your/프로젝트 디렉토리의 실제 경로로 바꾸세요.PostgreSQL 연결 문자열을 실제 데이터베이스 자격 증명으로 바꾸세요.
파일을 저장하고 Claude Desktop을 다시 시작하세요. 이제 MCP 서버가 설정의 MCP 서버 선택 드롭다운에 나타납니다.
구성 예
postgres-query를 사용한 구성 파일의 전체 예는 다음과 같습니다.
{
"mcpServers": {
"postgres-query": {
"command": "node",
"args": [
"/Users/darshilrathod/mcp-servers/mcp-postgres-query-server/dist/index.js",
"postgresql://user:password@localhost:5432/mydatabase"
]
}
}
}구성 업데이트
Claude Desktop 구성을 업데이트하려면:
클로드 데스크톱 열기
설정 > 개발자 > 구성 편집으로 이동하세요.
구성 파일을 변경하세요
파일을 저장하세요
변경 사항을 적용하려면 Claude Desktop을 다시 시작하세요.
MCP 서버 코드를 업데이트한 경우 재시작하기 전에
npm run build로 다시 빌드해야 합니다.
특징
읽기 전용 데이터베이스 액세스 : 보안을 위해 SELECT 쿼리만 허용됩니다.
쿼리 검증 : 잠재적으로 유해한 SQL 작업을 방지합니다.
시간 초과 보호 : 10초 이상 실행되는 쿼리는 자동으로 종료됩니다.
MCP 프로토콜 지원 : 모델 컨텍스트 프로토콜의 완전한 구현
JSON 응답 형식 : 쿼리 결과는 구조화된 JSON 형식으로 반환됩니다.
API
도구
쿼리-포스트그레스
구성된 PostgreSQL 데이터베이스에 대해 읽기 전용 SQL 쿼리를 실행합니다.
매개변수:
query(문자열): 실행할 SQL SELECT 쿼리
응답:
JSON 객체에는 다음이 포함됩니다.
rows: 결과 집합 행rowCount: 반환된 행 수fields: 열 메타데이터
예:
query-postgres: SELECT * FROM users LIMIT 5개발
주요 서버 구현은 src/index.ts 에 있습니다. 주요 구성 요소는 다음과 같습니다.
PostgreSQL 연결 풀 설정
쿼리 검증 논리
MCP 서버 구성
도구 및 리소스 정의
서버의 동작을 수정하려면 다음을 수행하세요.
isReadOnlyQuery()에서 쿼리 검증 논리를 편집합니다.MCP 서버에 추가 도구 또는 리소스 추가
쿼리 시간 초과 기간을 수정합니다(현재 10초)
보안 고려 사항
서버는 모든 쿼리를 검증하여 읽기 전용인지 확인합니다.
데이터베이스에 대한 연결은 SSL을 사용합니다.
쿼리 시간 초과로 인해 리소스 고갈이 방지됩니다.
쓰기 작업이 허용되지 않습니다.
데이터베이스 자격 증명은 파일에 저장되지 않고 명령줄 인수를 통해 직접 전달됩니다.
특허
아이에스씨
기여하다
기여를 환영합니다! 풀 리퀘스트를 제출해 주세요.
Available Tools
1 toolquery-postgresD
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
- First observed
query-postgres
TDQS
With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is singular and clear, eliminating any risk of misselection.
A single tool inherently has perfect naming consistency, as there are no other tools to compare it against. The name 'query-postgres' follows a clear verb-noun pattern without any conflicting conventions.
A single tool is too few for a PostgreSQL server's apparent scope, which typically involves multiple operations like querying, inserting, updating, and deleting data. This minimal set severely limits functionality and agent workflows.
The tool surface is severely incomplete for a PostgreSQL domain, covering only querying. Obvious gaps include create, update, delete, schema management, and transaction handling, which will cause frequent agent failures in database interactions.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Related MCP Servers
- -licenseNot gradedqualityAmaintenanceA Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.100,74590,042MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides read-only access to PostgreSQL databases, enabling LLMs to inspect database schemas and execute read-only queries.100,745MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides read-only access to PostgreSQL databases, enabling LLMs to inspect database schemas and execute read-only queries.100,745MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server providing read-only access to PostgreSQL databases, enabling LLMs to inspect database schemas and execute read-only SQL queries.100,745MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/RathodDarshil/mcp-postgres-query-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server