mcp-mysql-remote
Provides read-only SQL diagnostic queries to a MySQL database, allowing Claude to run SELECT statements, SHOW, DESC, and EXPLAIN commands for database inspection.
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., "@mcp-mysql-remoteshow me the tables in the database"
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.
mcp-mysql-remote
Servidor MCP remoto, somente-leitura, que expõe consultas SQL de diagnóstico ao MySQL
do EasyJur para o Claude.ai (web) via HTTPS, protegido por OAuth 2.1 restrito ao
Claude. É o porte do MCP stdio local (easyjur/fenix/mcp/mysql) para um serviço
publicável no Railway.
⚠️ Segurança primeiro. Este serviço fica exposto na internet sobre dados jurídicos multi-tenant (LGPD). Ele não deve apontar para produção direta: use réplica de leitura ou homologação, usuário MySQL com
GRANT SELECTapenas, segredos só em Railway Variables, OAuth com PKCE S256 eredirect_urirestrito ao Claude.
Onde está o roadmap (fonte única)
Todo o planejamento vive como uma change OpenSpec (spec-driven). Não duplique detalhes aqui — edite os artefatos:
openspec/changes/bootstrap-remote-mysql-mcp/
├── proposal.md # POR QUÊ + o que muda + capabilities + impacto
├── design.md # COMO: arquitetura, design patterns, diagramas, decisões, riscos
├── specs/ # O QUÊ (requisitos testáveis, WHEN/THEN):
│ ├── read-only-query/spec.md
│ ├── remote-mcp-transport/spec.md
│ └── oauth-authorization/spec.md
└── tasks.md # passo a passo de implementação (setup → deploy → Claude.ai)Comandos úteis:
openspec show bootstrap-remote-mysql-mcp # visão geral da change
openspec status --change bootstrap-remote-mysql-mcp
openspec validate bootstrap-remote-mysql-mcp --strictRelated MCP server: FoxTrove Voice MCP Server
Arquitetura (resumo)
Claude.ai ──HTTPS+Bearer──► Railway: mcp-mysql-remote
│ [Middleware] auth OAuth (JWT/PKCE)
│ [Adapter] Streamable HTTP ⇄ MCP Server (SDK)
│ [Strategy] QueryValidator (somente leitura)
│ [Gateway] DbClient (pool mysql2)
▼
MySQL (réplica, SELECT-only)Detalhes, patterns e fluxo OAuth completo em design.md.
Estrutura implementada:
src/
├── index.js # bootstrap HTTP (Express) + montagem de rotas
├── config.js # env → config, validação fail-fast no boot
├── health.js # GET /health (sem auth, sem DB)
├── mcp/
│ ├── server.js # MCP Server + tool query_mysql
│ └── httpTransport.js # Streamable HTTP (stateless) em POST /mcp
├── db/
│ ├── queryValidator.js # validação read-only por token (fix substring)
│ └── dbClient.js # pool mysql2; SHOW/DESC/EXPLAIN via query(), resto execute()
└── auth/
├── clients.js # cliente único (Claude) + allowlist de redirect_uri
├── discovery.js # RFC 8414 + RFC 9728
├── oauthServer.js # GET /authorize + POST /token (PKCE S256, JWT HS256)
└── middleware.js # Bearer obrigatório em /mcp (401 + WWW-Authenticate)Setup local
Requisitos: Node.js 20+.
npm install
cp .env.example .env # preencha os valores (nunca commite o .env)
npm start # sobe em http://localhost:3000
npm test # testes unitários do validador + E2E OAuth/MCPSegredos podem ser gerados com:
openssl rand -hex 32 # OAUTH_CLIENT_ID / OAUTH_CLIENT_SECRET
openssl rand -hex 64 # JWT_SECRETO boot falha cedo se faltar env obrigatória (DB_PASSWORD, banco, OAUTH_CLIENT_ID,
OAUTH_CLIENT_SECRET, JWT_SECRET).
Deploy no Railway
Banco: provisione réplica de leitura ou homologação (nunca produção direta) e crie um usuário com
GRANT SELECTapenas nos bancos necessários.Serviço: crie um projeto no Railway a partir deste repositório (o
Dockerfileé detectado automaticamente) ou userailway up.Variables: configure em Settings → Variables (nada no repo):
DB_HOST,DB_PORT,DB_USERNAME,DB_PASSWORD,DB_CONNECTION(ouDB_NAME),OAUTH_CLIENT_ID,OAUTH_CLIENT_SECRET,JWT_SECRET,PUBLIC_URL,OAUTH_REDIRECT_ALLOWLIST(opcional; padrão já é o callback do Claude).Domínio + healthcheck: ative o domínio HTTPS do Railway, aponte
PUBLIC_URLpara ele (ex.:https://mcp-mysql-remote.up.railway.app) e configure o healthcheck do serviço paraGET /health.Firewall do MySQL: restrinja o acesso ao IP de saída do Railway (security group).
Verifique:
https://<dominio>/health→ 200 ehttps://<dominio>/.well-known/oauth-authorization-server→ JSON com URLshttps://.
Conexão no Claude.ai
Em Settings → Connectors → Add custom connector, informe a URL do MCP:
https://<dominio-railway>/mcp.Insira o OAuth Client ID e o Client Secret (os mesmos das Railway Variables).
Complete o fluxo OAuth (o callback é
https://claude.ai/api/mcp/auth_callback). O connector deve ficar Connected.No chat, a tool
query_mysqlfica disponível — rode umSELECTde diagnóstico.
Checklist de segurança
Banco alvo é réplica/homologação (host distinto de produção)
Usuário MySQL com
GRANT SELECTapenas (escrita negada pelo banco)Segredos só em Railway Variables;
.envignorado pelo gitredirect_urirestrito ahttps://claude.ai/api/mcp/auth_callbackPKCE S256 obrigatório; tokens JWT com TTL curto
Acesso ao MySQL restrito ao IP de saída do Railway
npm testverde (regressão read-only: escrita/DDL/stacked queries recusadas)
Status
Fase atual: apply concluído localmente — src/ implementado com testes passando.
Pendências para produção (ver tasks.md §5–§7): provisionar banco réplica + usuário
SELECT-only, deploy no Railway e registro do connector no Claude.ai. Após validar de
ponta a ponta: openspec archive bootstrap-remote-mysql-mcp.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
Read-only MCP server for The Quiet Protocol's engines, benchmarks, proof, and business data.
MCP server for Argo RPG Platform — connects AI assistants to campaign data via OAuth2
Related MCP Servers
- AlicenseAqualityCmaintenanceA Node.js MCP server that enables Claude Desktop to securely run read-only SQL queries against MariaDB/MySQL and Microsoft SQL Server databases using OAuth 2.0 PKCE authentication. It provides short-lived, per-user credentials that never touch disk, allowing secure database access through natural language interactions.5MIT
- AlicenseNot gradedqualityDmaintenancePublic read-only MCP server for FoxTrove Voice, enabling LLMs to query call logs, customer records, assistant stats, and analytics via secure OAuth.MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for MySQL/MariaDB/Aurora MySQL that enables executing SQL queries, explaining query plans, inspecting schema, checking health, and running diagnostic playbooks through Claude.Apache 2.0
- FlicenseNot gradedqualityBmaintenanceSelf-hosted MCP connector for querying Brazilian legal jurisprudence via JurisprudenciaIA. Enables natural language legal research using Claude.ai, with tools for consulting, searching, and comparing jurisprudence and legal theses.13-