프로토타입 · 미리 보기: 공식 레지스트리의 모든 서버를 담고 있으며 30분마다 동기화해요. 리뷰와 계정 기능은 다음 단계에서 열려요.
PopNx MCPAI를 쓰는 사람을 위한 MCP 서버 · 쉬운 말로 설명해요

PostgreSQL Performance (read-only)

제작자: gouranshul버전 0.1.0i★ –i내 컴퓨터에서 실행
레지스트리 이름io.github.gouranshul/pg-perf-mcp

설치

개요

제작자가 쓴 설명(영어 원문)

Read-only PostgreSQL performance diagnostics: slow queries, EXPLAIN, index advice, locks, functions

PopNx MCP의 세 기둥

이 세 가지는 절대 하나의 점수로 합치지 않아요. 의견, 측정, 인기는 서로 다른 것이니까요.

할 수 있는 일

이 서버는 아직 쉬운 말로 된 요약을 쓰지 못했어요. 아래는 레지스트리에서 읽어 온 사실이에요.

  • 연결 방식: 내 컴퓨터에서 실행
  • 전송 방식: Streamable HTTP
  • 카테고리: 데이터베이스 및 데이터셋
  • 입력해야 할 값: PGPERF_DB_URL, PGPERF_DB_USER, PGPERF_DB_PASSWORD, MCP_API_KEY

설치

쓰고 있는 AI 앱을 고른 다음 설정을 복사하세요.

설치하기 전에

  • 기본 점검: 1개 중 1개 통과
  • 내 컴퓨터에서 내 사용자 계정의 권한(파일, 네트워크, 앱)으로 실행돼요.
  • 직접 입력할 값: PGPERF_DB_URL, PGPERF_DB_USER, PGPERF_DB_PASSWORD, MCP_API_KEY

비밀로 표시된 값은 내 계정의 열쇠예요. 절대 다른 사람과 공유하거나 채팅에 붙여 넣지 마세요.

필요한 것

어떤 앱을 쓰세요?

위에서 앱을 고르세요. 기억해 두었다가 다음부터는 버튼에 “…에 설치”라고 표시해요.

Claude Desktop → Settings → Developer → Edit Config를 열고 claude_desktop_config.json에 이 내용을 붙여 넣으세요

{
  "mcpServers": {
    "pg-perf": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PGPERF_DB_URL",
        "-e",
        "PGPERF_DB_USER",
        "-e",
        "PGPERF_DB_PASSWORD",
        "-e",
        "MCP_API_KEY",
        "ghcr.io/gouranshul/pg-perf-mcp:0.1.0"
      ],
      "env": {
        "PGPERF_DB_URL": "your-value",
        "PGPERF_DB_USER": "your-value",
        "PGPERF_DB_PASSWORD": "your-value",
        "MCP_API_KEY": "your-value"
      }
    }
  }
}

터미널에서 이 명령어를 실행하세요

claude mcp add pg-perf --env PGPERF_DB_URL=your-value --env PGPERF_DB_USER=your-value --env PGPERF_DB_PASSWORD=your-value --env MCP_API_KEY=your-value -- docker run -i --rm -e PGPERF_DB_URL -e PGPERF_DB_USER -e PGPERF_DB_PASSWORD -e MCP_API_KEY ghcr.io/gouranshul/pg-perf-mcp:0.1.0

실행하기 전에 빈 값을 채워 주세요.

Cursor에서 열기

또는 설정을 직접 복사하기

프로젝트의 .cursor/mcp.json 또는 ~/.cursor/mcp.json에 붙여 넣으세요

{
  "mcpServers": {
    "pg-perf": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PGPERF_DB_URL",
        "-e",
        "PGPERF_DB_USER",
        "-e",
        "PGPERF_DB_PASSWORD",
        "-e",
        "MCP_API_KEY",
        "ghcr.io/gouranshul/pg-perf-mcp:0.1.0"
      ],
      "env": {
        "PGPERF_DB_URL": "your-value",
        "PGPERF_DB_USER": "your-value",
        "PGPERF_DB_PASSWORD": "your-value",
        "MCP_API_KEY": "your-value"
      }
    }
  }
}

브라우저가 앱을 열지 물어본 다음, 앱이 설정을 보여 주고 확인을 요청해요. 키 값은 비워 두니 직접 입력하세요.

VS Code에서 열기

또는 설정을 직접 복사하기

프로젝트의 .vscode/mcp.json에 붙여 넣으세요

{
  "servers": {
    "pg-perf": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PGPERF_DB_URL",
        "-e",
        "PGPERF_DB_USER",
        "-e",
        "PGPERF_DB_PASSWORD",
        "-e",
        "MCP_API_KEY",
        "ghcr.io/gouranshul/pg-perf-mcp:0.1.0"
      ],
      "env": {
        "PGPERF_DB_URL": "your-value",
        "PGPERF_DB_USER": "your-value",
        "PGPERF_DB_PASSWORD": "your-value",
        "MCP_API_KEY": "your-value"
      }
    }
  }
}

브라우저가 앱을 열지 물어본 다음, 앱이 설정을 보여 주고 확인을 요청해요. 키 값은 비워 두니 직접 입력하세요.

이 서버는 내 컴퓨터에서 실행되는데, ChatGPT는 인터넷에 있는 서버에만 연결할 수 있어요. 다른 앱을 고르세요.

선택한 앱은 이 기기의 쿠키에만 저장돼요. 계정은 필요 없어요.

직접 입력할 값

  • PGPERF_DB_URL 필수 env
    JDBC URL of the database to diagnose. From inside the container, use host.docker.internal for a database on your machine, e.g. jdbc:postgresql://host.docker.internal:5432/mydb
  • PGPERF_DB_USER 필수 env
    A read-only role with pg_read_all_stats and pg_monitor (see docker/init.sql)
  • PGPERF_DB_PASSWORD 비밀 필수 env
    Password of that role
  • MCP_API_KEY 비밀 필수 env
    Bearer token clients must send, at least 16 characters (32+ random recommended)

이 설정은 제작자의 레지스트리 정보로 만들었어요. README와 다르면 README를 따르세요.

할 수 있는 일

내 컴퓨터에서 실행돼요. 설치하면 AI 앱에 도구 목록이 나타나요.

기본 점검i

누구나 볼 수 있는 정보를 점검했고, 코드는 읽지 않았어요. 해당하지 않는 항목은 개수에서 뺐어요. · 2026년 11월 8일 점검

  • ✓ 통과

    제작자와 저장소 일치

    레지스트리 이름이 GitHub 계정 gouranshul 기준으로 확인되었고, 이 계정이 저장소를 소유하고 있어요

  • … 아직 점검 안 함

    계속 관리되고 있음

    아직 GitHub에서 이 저장소를 읽어 오지 않았어요

  • … 아직 점검 안 함

    라이선스 있음

    아직 GitHub에서 이 저장소를 읽어 오지 않았어요

  • – 해당 없음

    엔드포인트 응답

    내 컴퓨터에서 실행되는 서버라 인터넷 엔드포인트가 없어요

  • – 해당 없음

    OAuth로 로그인

    내 컴퓨터에서 실행되며, 대신 로컬 설정을 사용해요

  • … 아직 점검 안 함

    도구 설명에 숨겨진 지시 없음

    내 컴퓨터에서 실행돼요. 도구 목록은 인터넷 엔드포인트가 있는 서버에서만 읽을 수 있어요

데이터베이스 및 데이터셋 카테고리의 다른 서버와 비교i

  • 이 카테고리의 다른 서버 1144개 중 0%보다 스타가 많아요
  • 이 카테고리의 다른 서버 1144개 중 63%보다 최근에 레지스트리에 공개됐어요
  • 기본 점검 결과가 이 카테고리의 다른 서버 1144개 중 100%와 같거나 더 좋아요

레지스트리에서 이 카테고리의 활성 서버 전체와 비교했어요. 스타는 게시자가 저장소를 소유한 경우에만 세요.

자주 묻는 질문

PostgreSQL Performance (read-only), 안전한가요?

해당하는 기본 점검 1개 중 1개를 통과했어요. 코드는 읽지 않았어요. 키나 토큰을 넣기 전에 서버가 어떤 권한을 요구하는지 확인하고, 꼭 필요한 권한만 있는 키를 쓰세요.

어떤 키나 코드가 필요한가요?

입력해야 할 값: PGPERF_DB_URL, PGPERF_DB_USER, PGPERF_DB_PASSWORD, MCP_API_KEY

내 컴퓨터에서 실행되나요, 클라우드에서 실행되나요?

내 컴퓨터에서 실행돼요. AI 앱이 필요할 때 실행하고, 데이터는 제작자의 서버를 거치지 않아요(서버 자체가 온라인 서비스를 호출하는 경우는 제외).

아직 관리되고 있나요?

GitHub 저장소는 마지막으로 – 변경됐고, 최신 버전(0.1.0)은 28일 전 레지스트리에 올라왔어요.

어떤 앱에서 쓸 수 있나요?

Claude Desktop, Claude Code, Cursor, VS Code처럼 MCP를 지원하는 앱에서 쓸 수 있어요. 내 컴퓨터에 Docker도 있어야 해요.

대신 쓸 수 있는 건 뭐가 있나요?

같은 카테고리에는: Supabase, MongoDB MCP Server, Elasticsearch MCP Server

대안

같은 카테고리에서 다른 제작자가 만든 서버예요. 스타 순으로 정렬했어요.

카드 보는 법:★ GitHub 스타i세 기둥: 리뷰 · 점검 · 사용 정도i업데이트 = 최신 버전을 레지스트리에 공개한 날i

Supabase

제작자: supabase

MCP server for interacting with the Supabase platform

컴퓨터 또는 클라우드★ 2,993Apache-2.0어제 업데이트
설치

MongoDB MCP Server

제작자: mongodb-js

MongoDB Model Context Protocol Server

내 컴퓨터에서 실행★ 1,157Apache-2.03일 전 업데이트
설치

Elasticsearch MCP Server

제작자: cr7258

MCP server for interacting with Elasticsearch

내 컴퓨터에서 실행★ 315Apache-2.014개월 전 업데이트
설치

제작자의 README

README 열기

제작자의 저장소에서 쓰인 그대로 가져왔어요. PopNx MCP가 검토하거나 보증한 내용이 아니에요. HTML, 이미지, 스크립트는 제거했어요. 링크를 누르면 이 사이트를 벗어나요.

pg-perf-mcp

An MCP server that lets AI assistants diagnose PostgreSQL performance problems safely: slow queries, EXPLAIN plans, index suggestions, table health and lock contention. It is read-only by design.

*A real Claude Code session against the demo shop, sped up. First it finds which database functions are slow and why. Then it explains a slow catalog query and estimates the fix with a hypothetical index. Asked to create the index, it says it can't: every tool is read-only.*

Why

When a page is slow, developers paste a query into a chat and ask "why is this slow?". The assistant then guesses, because it cannot see the plan, the table sizes, the existing indexes or which queries actually dominate the load.

pg-perf-mcp gives the assistant real numbers from `pg_stat_statements`, `EXPLAIN` and the catalogs, through a narrow, audited, read-only interface. It cannot change data, cannot run DDL, and never creates the indexes it recommends.

Demo

A condensed, illustrative session against the demo shop (docker compose up, then ./demo/workload.sh). Exact numbers vary from run to run:

You:    The shop database feels slow. What's going on?

Claude: [top_slow_queries orderBy=total_time] The top statement by total time is SELECT id, status, total, created_at FROM shop.orders WHERE customer_id = $1 ORDER BY created_at DESC (thousands of calls, the largest share of total execution time).

[explain_query sql="... WHERE customer_id = 42 ORDER BY created_at DESC"] HIGH SEQ_SCAN_ON_LARGE_TABLE Seq Scan on shop.orders reads all ~1.0M rows of shop.orders to apply filter (customer_id = 42); only a handful match.

[suggest_indexes] CREATE INDEX CONCURRENTLY idx_orders_customer_id ON shop.orders (customer_id); hypopg: the planner would use it; estimated cost drops by well over 90%. Not executed. Review it and run it yourself, ideally off-peak.

[table_health table=shop.orders] Autovacuum is disabled on shop.orders and ~20% of rows are dead. Re-enable autovacuum and VACUUM.

Prioritized actions: 1) add the index above (orders.customer_id is a foreign key with no index),

  1. re-enable autovacuum on shop.orders, 3) ...

Architecture

flowchart LR

A["AI assistant (Claude Code, Claude Desktop, ...)"] -- "MCP over streamable HTTP Authorization: Bearer key" --> F["API key filter (constant-time)"] F --> M["MCP tools / resources / prompt Spring AI 2.0 annotations"] M --> R["ToolRunner audit log · metrics · safe errors"] R --> G["SqlGuard PG lexer + JSqlParser"] G --> E["ReadOnlyExecutor READ ONLY tx · always rollback statement/lock timeout · row cap"] R --> AN["analysis PlanAnalyzer · IndexAdvisor (pure functions)"] E --> P[("PostgreSQL 18 role mcp_readonly pg_stat_statements · hypopg")]

Tools

ToolWhat it doesSafety notes
top_slow_queriesMost expensive statements from pg_stat_statements: normalized text, calls, total/mean/max ms, rows, cache hit ratio, share of total time. Order by total_time, mean_time, calls or rows.Fixed SQL; sort column chosen from an enum. Excludes the server's own statements.
explain_querySummarized plan: 5 costliest nodes, seq scans on large tables, 10x row misestimates, disk sorts/hash spills, nested loops with many iterations. analyze=true adds real timings. $1 placeholders get a generic plan.SQL guard first. ANALYZE runs in a read-only transaction that is rolled back and cancelled after the timeout.
suggest_indexesCREATE INDEX CONCURRENTLY candidates from filtered seq scans, join keys and ORDER BY ... LIMIT, each with a reason; validated with hypothetical indexes when hypopg is installed.Never executed. Hypothetical indexes are reset in a savepoint so they cannot leak to other calls.
unused_indexesIndexes with idx_scan = 0, largest first, excluding primary key, unique and constraint indexes; includes size, definition and a DROP INDEX CONCURRENTLY to review.Nothing is dropped. Reports when stats were last reset.
table_healthLive/dead tuples, dead ratio, last (auto)vacuum/analyze, rows changed since analyze, seq vs index scans, sizes, with plain-language warnings.Catalog reads only.
blocking_sessionsBlocked/blocking pairs via pg_blocking_pids, truncated query texts, wait time, lock type/mode/table, blocker state, root blockers.Never cancels or terminates anything.
slow_functionsUser-defined functions (PL/pgSQL, SQL, ...) ranked by total, self or mean time or calls, from pg_stat_user_functions, with language and volatility.Catalog reads only. Needs track_functions.
explain_functionLooks inside the functions a query calls: time per function, every statement executed inside them with calls, time and its own analyzed plan, and findings such as a seq scan inside a function, a function called once per row, or a read-only function left VOLATILE. Includes the function source.SQL guard first; runs in the same rolled-back read-only transaction as explain_query, so functions that write fail. auto_explain is switched on for that transaction only, with generic plans so no data values appear.

Resources: pg://schema/overview (tables, row estimates, sizes, indexes) and pg://schema/{table} (columns, indexes with scan counts, foreign keys flagged when unindexed). Prompt: diagnose_slow_database, a guided workflow: slow queries, then explain, suggest indexes, table health, functions, then a prioritized summary.

Why a separate tool for database functions

EXPLAIN shows a function call as one opaque expression, and charges its time to whichever plan node evaluates it. On the demo catalog page (20 products, each calling shop.product_rating), explain_query blames the index scan on products (184 ms self time) and finds nothing else serious. explain_function on the same query, against the full demo data:

shop.product_rating          plpgsql  20 calls  99% of execution time

SELECT avg(rating) FROM shop.reviews WHERE product_id = p_product_id 20 calls 175 ms 96% of execution time HIGH FUNCTION_DOMINATES_QUERY shop.product_rating takes 99% of the query's execution time HIGH FUNCTION_CALLED_PER_ROW ran 20 times for one query (9.0 ms per call) HIGH SEQ_SCAN_ON_LARGE_TABLE inside shop.product_rating: Seq Scan on shop.reviews reads all ~250k rows to apply filter (reviews.product_id = $1)

How it works (ADR 0006): the query runs once with auto_explain enabled for that transaction only, so the plan of each nested statement comes back as a notice; per-function time comes from pg_stat_xact_user_functions and per-statement calls from pg_stat_statements, both as before/after differences.

Security model

Five independent layers stand between the assistant and a write (details in ADR 0001):

  1. SQL guard: exactly one plain SELECT. It is checked by a PostgreSQL-faithful lexer *and* JSqlParser, and both must agree. Blocks DML/DDL, multiple statements, data-modifying CTEs, SELECT INTO, FOR UPDATE/SHARE, COPY, DO, and dangerous functions (pg_sleep*, *_file, lo_*, dblink*, set_config, pg_terminate_backend, query_to_xml, ...). It fails closed.
  2. Read-only role: mcp_readonly has SELECT plus pg_read_all_stats/pg_monitor, with default_transaction_read_only = on and statement_timeout = 5s set on the role.
  3. Read-only connections: Hikari readOnly=true and a read-only session default.
  4. One rolled-back read-only transaction per call: statement_timeout/lock_timeout set locally, standard_conforming_strings forced on, always rolled back.
  5. Row cap: every result is capped (default 200 rows).

Around those layers: a bearer API key (constant-time comparison; only /actuator/health is open), a JSON audit line per call (SQL stored as a SHA-256 hash plus an 80-character preview), error messages with no stack traces or connection details, and metrics mcp.tool.duration and mcp.guard.rejections.

Quickstart

Requirements: Docker. There are two ways to start:

  • [Use it on your database](#use-it-on-your-database): pull the published image. No clone or build.
  • [Try the demo shop](#try-the-demo-shop): clone the repo and get a seeded database with realistic problems to diagnose.

Either way, finish with connecting your AI client.

Use it on your database

1. Pull the image (public on GHCR, built for amd64 and arm64):

docker pull ghcr.io/gouranshul/pg-perf-mcp:0.1.0

2. Prepare the database (once). Create a read-only role like mcp_readonly (see docker/init.sql) and make sure pg_stat_statements is in shared_preload_libraries. Prefer a replica or staging database: analyze=true and explain_function execute the query. For the function tools, also enable function tracking.

3. Run it. Put the settings in a file so secrets stay out of your shell history:

cat > pg-perf.env <<'EOF'

PGPERF_DB_URL=jdbc:postgresql://host.docker.internal:5432/mydb PGPERF_DB_USER=mcp_readonly PGPERF_DB_PASSWORD= MCP_API_KEY=<32+ random characters> EOF

docker run --rm --env-file pg-perf.env -p 127.0.0.1:8080:8080 ghcr.io/gouranshul/pg-perf-mcp:0.1.0

host.docker.internal reaches a database on your machine (Docker Desktop; on Linux add --add-host=host.docker.internal:host-gateway). The MCP endpoint is now http://localhost:8080/mcp.

4. Connect your AI client: see below.

Try the demo shop

To build and test from source you also need Java 25.

git clone https://github.com/gouranshul/pg-perf-mcp && cd pg-perf-mcp

cp .env.example .env # then replace the placeholder secrets docker compose up --build # Postgres 18 + seeded demo shop (~4.5M rows) + the MCP server on :8080

Generate some slow-query statistics (optional, but makes top_slow_queries interesting):

./demo/workload.sh          # 60s of deliberately bad queries via pgbench

./demo/lock-scenario.sh # holds a row lock for 2 minutes so blocking_sessions has something to show ./demo/smoke-test.sh # curl-based end-to-end check of health, auth and two tool calls

Connect from Claude Code
claude mcp add --transport http pg-perf http://localhost:8080/mcp --header "Authorization: Bearer $MCP_API_KEY"

In PowerShell, set the key first, or the header goes out empty and the server answers 401:

$env:MCP_API_KEY = "<your MCP_API_KEY>"

claude mcp add --transport http pg-perf http://localhost:8080/mcp --header "Authorization: Bearer $env:MCP_API_KEY"

Or install it as a Claude Code plugin. Claude Code asks for the endpoint (default http://localhost:8080/mcp) and your MCP_API_KEY, which it keeps in secure storage:

/plugin install pg-perf --marketplace gouranshul/pg-perf-mcp

On Claude Code versions before 2.1.275, add the marketplace first: `/plu

앞부분만 보여 드려요. 나머지는 저장소에서 읽어 보세요

PopNx에게 묻기