Connector guide4-minute read7 languages

Database to MCP: SQL Server, PostgreSQL, MySQL to Claude

Connect SQL Server, PostgreSQL, MySQL, Oracle, SAP HANA or MongoDB to Claude and ChatGPT via MCP. Read-only by default: only SELECT runs. No code.

HCBy HelpCode teamUpdated 4 min read Open-source on GitHub

No credit card · 7-day trial · Self-host alternative available

  • 7-day free trial
    No credit card required
  • GDPR & SOC 2 ready
    EU data residency, audit logs
  • Open-source on GitHub
    Open source · AGPL-3.0
  • Works with ChatGPT, Claude, Gemini
    Any MCP-compatible client

Summary

Connect SQL Server, PostgreSQL, MySQL, Oracle, SAP HANA or MongoDB to Claude and ChatGPT via MCP. Read-only by default: only SELECT runs. No code.

TL;DR: AnythingMCP connects to your database and gives Claude, ChatGPT and Copilot tools to list tables, describe columns and run queries. Only a single SELECT runs: writes and stacked statements are blocked before they reach the database. A five-minute demo with PostgreSQL and MySQL is in sql-to-mcp on GitHub.

Direct Database Access for AI Agents

Instead of building REST APIs on top of your databases, AnythingMCP connects directly to your database and exposes it as MCP tools. AI agents can query data using natural language.

Supported Databases

DatabaseStatusAccess Mode
PostgreSQLSupportedRead-only
MySQLSupportedRead-only
MariaDBSupportedRead-only
Microsoft SQL ServerSupportedRead-only
OracleSupportedRead-only
SAP HANASupportedRead-only
SQLiteSupportedRead-only
MongoDBSupportedRead-only

Important: All database connectors in AnythingMCP are read-only by design. This ensures AI agents cannot accidentally modify or delete data.

Auto-Generated Tools

When you create a database connector, AnythingMCP automatically generates three tools:

ToolDescription
get_database_schemaReturns the database schema (tables, columns, types)
get_example_queriesSuggests example queries based on the schema
execute_queryExecutes a read-only query (SELECT/find only, max 1000 rows)

Step-by-Step Guide

Step 1: Deploy AnythingMCP

curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d

Step 2: Create a Database Connector

Open the AnythingMCP dashboard at http://localhost:3000 and create a new Database connector. Select your database type (PostgreSQL, MySQL, MariaDB, MSSQL, Oracle, SAP HANA, SQLite, or MongoDB) and provide the connection details.

Step 3: Configure Connection

Enter your database host, port, credentials, and database name. For SQL databases (PostgreSQL, MySQL, MariaDB, MSSQL, Oracle, SAP HANA, SQLite), the connector will use SQL SELECT queries only. For MongoDB, only find operations are allowed.

SAP HANA takes a connection string such as hana://host:30015/?databaseName=TENANT&currentSchema=SCHEMA; the session is set read-only in HANA itself and each statement times out. For SAP S/4HANA on HANA, the SAP S/4HANA (HANA SQL) adapter adds tools that read SAP's own data dictionary, so the model knows what the abbreviated table and field names mean.

Step 4: Test the Connection

Use the dashboard to verify the connection and review the auto-discovered schema. The get_database_schema tool will show all available tables and columns.

Step 5: Connect to AI Agents

{
  "mcpServers": {
    "my-database": {
      "url": "http://localhost:4000/mcp"
    }
  }
}

Query Limits

  • SQL databases (PostgreSQL, MySQL, MariaDB, MSSQL, Oracle, SAP HANA, SQLite): Only SELECT statements are allowed
  • MongoDB: Only find operations are allowed
  • Row limit: Maximum 1000 rows per query
  • No write operations: INSERT, UPDATE, DELETE, DROP are blocked

AI Agent Use Cases

  • "Show me all orders from last month with total over $500"
  • "What are the top 10 products by revenue?"
  • "How many new users signed up this week?"
  • "List all customers from Germany"

Security Best Practices

  1. Use a read-only database user — Create a dedicated user with SELECT-only permissions
  2. Restrict accessible tables — Only expose tables that are safe for AI access
  3. SSL connections — Always use encrypted connections in production
  4. Network restrictions — Limit database access to the AnythingMCP server IP

FAQ

Can Claude query my SQL Server, PostgreSQL or MySQL database? Yes, through MCP. AnythingMCP connects to the database and exposes tools to list tables, describe columns and run a query; Claude writes the SQL after reading the schema.

Can the AI change or delete data? No, by default. The query tools accept a single SELECT (or WITH ... SELECT) and block INSERT, UPDATE, DELETE, DROP and stacked statements. Use a SELECT-only database user as well, so the database enforces the same rule.

How many rows does a query return? At most 1,000. Larger results are truncated and the response says so, which keeps the model's context small.

Does my database have to be reachable from the internet? Not with a self-hosted AnythingMCP on the same network: add the database host to SSRF_ALLOWED_HOSTS. AnythingMCP Cloud can only reach databases exposed to the internet.

Which databases are supported? PostgreSQL, MySQL, MariaDB, Microsoft SQL Server, Oracle, SAP HANA, SQLite and MongoDB.

Next Steps

Was this guide helpful?

Ship MCP to your stack in 60 seconds.

Spin up AnythingMCP on managed Cloud or self-host it on your infrastructure. Free for 7 days, no credit card.

Related guides

Connectors

iiko MCP Server: Menus, Orders and Reservations

iiko and Syrve restaurant management through the iikoCloud API (Syrve Cloud API): organizations and terminal groups, menu and external menus, stop lists, delivery and table orders, reservations, couriers, order and payment types, discounts and loyalty customers. API login from the web back office.

Connectors

YCLIENTS MCP Server: Appointments, Clients and Staff

YCLIENTS (Altegio outside the CIS) booking and CRM for salons, clinics and studios: branches, services, staff, schedules and free slots, appointments (list, create, change), clients and their visit history, products and stock, cash registers and financial transactions (read), reviews and analytics. Partner token plus user token.

Connectors

ablefy MCP Server: Products, Invoices and Payments

ablefy (formerly elopage) seller API: products, pricing plans, orders, payments, invoices and credit notes, event e-tickets, affiliates (publishers), funnels and webhook endpoints, plus free orders that grant product access. API key and secret.

Connectors

Action1 MCP Server: Updates, Vulnerabilities and Devices

Action1 patch management and RMM from any AI agent: organizations, managed endpoints with hardware and status, missing Windows and third-party updates, vulnerabilities (CVEs) and the endpoints they affect, installed software, endpoint groups, reports with drill-down, automations and their results, the Software Repository and the audit trail. Read-only apart from renaming an endpoint.

Connectors

Adesk MCP Server: Transactions, Projects and Budgets

Adesk (adesk.ru) management accounting for small business: cash transactions on bank and cash accounts, income and expense categories, counterparties and their obligations, projects and deals with profit figures, legal entities and budgets. Bookkeeping records only, no payments. API token.

Connectors

Appwrite MCP Server: Database Rows, Users and Files

Appwrite backend from any AI agent, Cloud or self-hosted: query and write database rows (TablesDB) or documents (older servers), read the users of your app with their sessions and teams, storage buckets and file descriptions, functions and their execution logs. Project API key. Deleting rows and running functions are switched off.