By nu0ma
Read-only Google Cloud Spanner MCP server. Exposes SELECT-only query execution and schema introspection (list_tables, describe_table, list_indexes, execute_query). Write operations are blocked by both a forbidden-keyword regex and a Spanner read-only snapshot.
This plugin requires configuration values that are prompted when the plugin is enabled. Sensitive values are stored in your system keychain.
SPANNER_PROJECTGCP project ID
${user_config.SPANNER_PROJECT}SPANNER_DATABASESpanner database ID
${user_config.SPANNER_DATABASE}SPANNER_INSTANCESpanner instance ID
${user_config.SPANNER_INSTANCE}SPANNER_EMULATOR_HOSTSet to host:port to point at a local Spanner instead of real Cloud Spanner (e.g. 127.0.0.1:15000 for Spanner Omni single-server, or 127.0.0.1:9010 for the legacy emulator). Leave blank for production.
${user_config.SPANNER_EMULATOR_HOST}Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
English | 日本語
A read-only MCP server for Google Cloud Spanner. Lets LLMs safely inspect schemas and run SELECT queries against a Spanner database.
gcloud auth application-default login
The server reads these at runtime (the Claude Code plugin prompts for them on install and persists to settings.json; for other clients, set them in the MCP config's env block).
| Variable | Required | Description |
|---|---|---|
SPANNER_PROJECT | Yes | GCP project ID |
SPANNER_INSTANCE | Yes | Spanner instance ID |
SPANNER_DATABASE | Yes | Spanner database ID |
SPANNER_EMULATOR_HOST | No | host:port to point at a local Spanner (127.0.0.1:15000 for Spanner Omni single-server, 127.0.0.1:9010 for the legacy emulator). Leave unset for production. |
This repo doubles as a Claude Code plugin marketplace. Register it and install the plugin:
/plugin marketplace add nu0ma/spanner-readonly-mcp
/plugin install spanner-readonly-mcp@spanner-readonly-mcp
The plugin launches the server via npx -y spanner-readonly-mcp@latest. Claude Code will prompt for SPANNER_PROJECT, SPANNER_INSTANCE, and SPANNER_DATABASE on install and persist them to settings.json.
Create .mcp.json at your project root:
{
"mcpServers": {
"spanner-readonly-mcp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "spanner-readonly-mcp@latest"],
"env": {
"SPANNER_PROJECT": "my-project",
"SPANNER_INSTANCE": "my-instance",
"SPANNER_DATABASE": "my-database"
}
}
}
}
Claude Code picks this up on session start and prompts to approve the server on first launch.
| Tool | Description |
|---|---|
list_tables | List all user tables in the database |
describe_table | Get column definitions (type, nullability, ordinal position) for a table |
list_indexes | List indexes, optionally filtered by table |
execute_query | Execute an arbitrary SELECT query |
Writes are blocked even if your IAM credentials have write permissions. Two layers enforce this:
database.getSnapshot()). The Snapshot class does not expose DML methods, and the Spanner backend rejects any mutation attempt within a read-only transaction. This is the real guarantee.All snapshot queries (including the metadata tools) run with a 30-second gaxOptions.timeout to bound worst-case latency.
Error messages returned to clients are sanitized (first line only, prefixed REGEX_BLOCKED: or SPANNER_ERROR:) to avoid leaking stack traces or internal paths.
execute_query accepts arbitrary SELECT statements, including queries against information_schema and spanner_sys. To bound the read surface, grant only roles/spanner.databaseReader to the service account — do not rely on application-level filtering alone.
pnpm install
pnpm build # compile to dist/
pnpm dev # run from source without building
pnpm test # vitest, starts Spanner Omni via docker compose
Direct execution against a real Spanner instance (build first, then run):
pnpm build
SPANNER_PROJECT=my-project \
SPANNER_INSTANCE=my-instance \
SPANNER_DATABASE=my-database \
pnpm start
MIT
npx claudepluginhub nu0ma/spanner-readonly-mcp --plugin spanner-readonly-mcpGive your AI a memory — mine projects and conversations into a searchable palace. 33 MCP tools, auto-save hooks, and guided setup.
MCP server that saves 98% of your context window with session continuity. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and automatic state restore across compactions.
Write SQL, explore datasets, and generate insights faster. Build visualizations and dashboards, and turn raw data into clear stories for stakeholders.
A Model Context Protocol (MCP) server for Grafana providing access to dashboards, datasources, and querying capabilities
Open-source, local-first Claude Code plugin for token reduction, context compression, and cost optimization using hybrid RAG retrieval (BM25 + vector search), reranking, AST-aware chunking, and compact context packets.
Agent Skills for AI/ML tasks including dataset creation, model training, evaluation, and research paper publishing on Hugging Face Hub