pgroonga-mcp
pgroonga-mcp is a read-only MCP server for PostgreSQL/PGroonga search and diagnostics.
Discovers server, extension, Groonga versions, capabilities, and supported search modes.
Lists catalog-resolved PGroonga indexes with validity, readiness, size, targets, reloptions, and normalization profiles.
Runs bounded searches on text/varchar/text[]/jsonb columns using keyword, query, prefix, exact, and regexp modes (similar reserved), with filters, snippets, column selection, and limits.
Returns non-executing EXPLAIN (FORMAT JSON) plans for validated searches.
Performs limited health checks: extension availability, read-only/writable state, potentially broken/lagged indexes, and WAL status.
Discovers normalizer profiles, normalizes text, looks up bounded dictionary variants, and validates dictionary mappings without modifying data.
Provides a setup command to register project-local MCP servers for Codex, Claude Code, OpenCode, and DSH.
Never exposes arbitrary SQL, pgroonga_command, DDL, dictionary mutation, or repair operations.
Provides read-only search and diagnostics for PostgreSQL databases with PGroonga indexes, including full-text search, index exploration, query explanations, health checks, and text normalization.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pgroonga-mcp search the documents table for 'full-text search'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
pgroonga-mcp
Read-only PostgreSQL search and diagnostics over the Model Context Protocol. The server discovers the installed PGroonga schema and capabilities, resolves search targets from PostgreSQL catalogs, and binds query/filter values as parameters.
It does not expose arbitrary SQL, pgroonga_command, DDL, dictionary mutation, or repair operations.
Requirements
Node.js 22 or newer.
PostgreSQL with the PGroonga extension installed.
A dedicated PostgreSQL role that is neither a superuser nor
BYPASSRLS.An MCP host that supports local stdio servers.
The npm package supplies the MCP server and a project setup command. It does not install PostgreSQL or PGroonga.
Related MCP server: PostgreSQL MCP Server
Install
For a project installation:
npm i @askdkc/pgroonga-mcpThe server can start without a database URL, so an MCP host or AI agent can use it for
tool discovery and SQL-generation workflows. Database-backed tools return a structured
database_unavailable error until a PostgreSQL URL is configured.
For a global installation:
npm i --global @askdkc/pgroonga-mcp
pgroonga-mcpThe server communicates over stdin/stdout. Logs go to stderr so they do not corrupt the MCP protocol stream.
Project setup
After installing the package in a project, run the setup command to register a project-local
pgroonga MCP server for the clients you use:
npm i @askdkc/pgroonga-mcp
npx pgroonga-mcp setupThe interactive setup lets you select Codex, Claude Code, OpenCode, and DSH (DeepSeek Harness). It writes only project files and does not modify user-global configuration or add database credentials. The generated server command uses the installed package without downloading at MCP startup:
npx --no-install pgroonga-mcpUse flags when setup must be scripted:
# Configure every supported client.
npx pgroonga-mcp setup --all
# Configure selected clients.
npx pgroonga-mcp setup --clients codex,claude,opencode
# Preview changes without writing files.
npx pgroonga-mcp setup --all --dry-run
# Replace an existing pgroonga entry after reviewing the diff.
npx pgroonga-mcp setup --clients claude --forceThe setup command creates or updates these project-scoped files:
Client | File |
Codex |
|
Claude Code |
|
OpenCode |
|
DSH |
|
Unrelated settings are preserved. If a selected file already contains a different pgroonga
entry, setup stops instead of overwriting it; use --force only after reviewing the existing
configuration. OpenCode JSONC comments may be normalized when an existing opencode.jsonc is
updated. Restart each selected client after setup. Claude Code may also ask you to approve the
project-scoped .mcp.json server.
The command is platform-neutral and uses Node.js filesystem APIs and project-relative paths. It works on macOS, Linux, and Linux environments running under Windows WSL. In WSL, run it with the Node.js and npm installation inside WSL and from the project directory visible to WSL.
Sample
See pgroonga-mcp-sample for an example of using PGroonga MCP.
MCP host configuration
The exact configuration file depends on the MCP host. A generic stdio configuration looks like this:
{
"mcpServers": {
"pgroonga": {
"command": "npx",
"args": ["--yes", "@askdkc/pgroonga-mcp"],
"env": {
"PGROONGA_DATABASE_URL": "postgresql://pgroonga_mcp@127.0.0.1:5432/app",
"PGROONGA_ALLOWED_SCHEMAS": "public",
"PGROONGA_ALLOWED_TABLES": "public.documents"
}
}
}
}The npm package name is @askdkc/pgroonga-mcp, while the installed executable remains pgroonga-mcp. Use that executable instead of npx when the package is installed globally. Do not put database passwords in a committed configuration file; use the MCP host's environment/secret facility. The server loads .env from its current working directory when present, without overriding existing process environment variables. Set PGROONGA_ENV_FILE when the project env file is elsewhere.
Database grants
Use a least-privilege role. Replace the schema, tables, and PGroonga extension schema with the names from your deployment:
CREATE ROLE pgroonga_mcp LOGIN PASSWORD 'use-a-secret-manager';
GRANT CONNECT ON DATABASE app TO pgroonga_mcp;
GRANT USAGE ON SCHEMA public, extensions TO pgroonga_mcp;
GRANT SELECT ON TABLE public.documents TO pgroonga_mcp;Grant SELECT on any NormalizerTable dictionary tables used by the configured indexes. Do not grant SUPERUSER, BYPASSRLS, or CREATE on application schemas. Keep row-level security policies enabled; each operation runs in a read-only transaction with row_security = on.
Configuration
All settings are environment variables. PGROONGA_DATABASE_URL is optional. If it is absent, a PostgreSQL URL in DATABASE_URL, POSTGRES_URL, or POSTGRESQL_URL is used when available. Non-PostgreSQL values are ignored. The default allowlist is the public schema; an empty PGROONGA_ALLOWED_TABLES allows all tables in the allowed schemas, so set it explicitly in production. Tables may be written as schema.table or as a table name.
Variable | Default | Description |
| — | Optional PostgreSQL connection URL |
|
| Project env file to load |
|
| Comma-separated schema allowlist |
| empty | Comma-separated table allowlist |
|
| PostgreSQL statement timeout |
|
| PostgreSQL lock timeout |
|
| Default search row limit |
|
| Maximum search row limit |
|
| Serialized response limit |
|
| Per-string result limit |
|
| Normalization input limit |
|
| Variant lookup limit |
|
|
|
|
| Only |
A complete development example is in .env.example. The environment example and the compact NormalizerTable fixture under examples/itaiji/ are included in the npm tarball.
Tools
pgroonga_server_info— PostgreSQL, PGroonga, Groonga, and feature capabilities.pgroonga_list_indexes— catalog-resolved PGroonga indexes and supported modes.pgroonga_search— bounded search with structured filters.pgroonga_explain_search— non-executingEXPLAIN (FORMAT JSON)for a validated search.pgroonga_health— available PGroonga health checks.pgroonga_list_normalization_profiles— discovered index normalizer chains.pgroonga_normalize_text— normalize text using a discovered index profile.pgroonga_lookup_variants— bounded NormalizerTable variant lookup.pgroonga_validate_normalization_profile— validate dictionary mappings without modifying them.
Example pgroonga_search input:
{
"target": { "schema": "public", "table": "documents", "column": "body" },
"mode": "keyword",
"query": "PGroonga",
"returnColumns": ["id", "body"],
"limit": 20
}Search supports text, varchar, text[], and jsonb targets when a compatible, valid, ready PGroonga index is discovered. Supported modes are keyword, query, prefix, exact, and regexp. similar is reserved for a later release. Compound, expression, and partial indexes are reported but are discovery-only in this release.
Normalizer profiles are read from trusted index reloptions. NormalizerTable dependencies are resolved through pgroonga_table_name; dictionary changes are reported as requiring REINDEX, and dictionary freshness remains unknown unless a future managed revision table is installed. Highlighting is disabled unless the required source-location and source-offset options are present.
Development and release checks
npm ci
npm run verify
npm pack --dry-runnpm run verify runs formatting, linting, type checking, the unit/contract tests, and the TypeScript build. The package uses prepublishOnly and prepack to repeat the relevant checks/build before publication. Once authenticated with npm and after reviewing npm pack --dry-run, publish the current version with:
npm publishThe repository is askdkc/pgroonga-mcp. The compact NormalizerTable fixture is in examples/itaiji/schema.sql.
Available Tools
9 toolspgroonga_explain_searchB
Return a non-executing EXPLAIN (FORMAT JSON) for a validated search.
Inputs: mode (required), query (required), target (required), limit, +4 more. Returns: plan, warnings, usesExpectedPgroongaIndex
pgroonga_healthA
Report limited PGroonga health checks and explicitly unavailable diagnostics.
Inputs: no named parameters. Returns: writable, walStatus, unavailable, laggedIndexes, +2 more
pgroonga_list_indexesB
List catalog-resolved PGroonga indexes and supported search modes.
Inputs: table, schema. Returns: indexes
pgroonga_list_normalization_profilesA
Discover trusted index-level normalizer chains and NormalizerTable dependencies.
Inputs: no named parameters. Returns: profiles
pgroonga_lookup_variantsC
Normalize text and return bounded dictionary variants for the discovered profile.
Inputs: index (required), input (required). Returns: input, profile, variants, canonical
pgroonga_normalize_textC
Normalize text with a discovered PGroonga index profile.
Inputs: text (required), index (required). Returns: input, changed, profile, normalized
pgroonga_searchC
Execute a bounded, catalog-validated PGroonga search with structured filters.
Inputs: mode (required), query (required), target (required), limit, +4 more. Returns: rows, query, target, rowCount, +7 more
pgroonga_server_infoB
Discover PostgreSQL, PGroonga, Groonga, and feature capabilities.
Inputs: no named parameters. Returns: notes, readOnly, roleName, capabilities, +6 more
pgroonga_validate_normalization_profileA
Validate dictionary mappings and report normalization hazards without modifying data.
Inputs: index (required). Returns: profile, findings
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct operation: server info, index listing, search, explain, normalization profiles, text normalization, variant lookup, normalization validation, and health. No two tools appear to do the same thing, and the descriptions make boundaries clear.
All tools share the pgroonga_ prefix and mostly follow a verb_noun pattern (list_indexes, normalize_text, validate_normalization_profile). A few like 'search' and 'health' are simple nouns/verbs, but the overall convention is consistent and predictable.
Nine tools is well-scoped for a domain-specific MCP focused on PGroonga search and normalization. Each tool serves a clear purpose without redundancy or bloat.
The tool surface covers the full workflow: discovering capabilities and indexes, executing and explaining searches, examining normalization, normalizing text, and validating profiles. It lacks explicit search-history or index-creation tools, but for a read-oriented MCP this is complete.
Maintenance
Related MCP Connectors
Read-only scripture-study engine: complete-or-fail concordance over Greek NT, Hebrew OT, LXX.
Hybrid search, schema introspection and record read/write over FoxNose collections
Read-only U.S. lab-test catalog, collection-site search, and reference-range context.
Read-only semantic search over Vedic scripture verses, commentaries, and recorded lectures.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server providing LLMs read-only access to PostgreSQL databases for inspecting schemas and executing queries.141,976 npm27MIT
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to PostgreSQL databases, enabling users to inspect database schemas and execute read-only queries through a Model Context Protocol server.4MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides AI assistants with secure, read-only access to PostgreSQL databases while offering comprehensive tools for schema exploration, query validation, and performance optimization.MIT
- 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.141,976 npmMIT