Skip to main content
← Q&A
Claude CodeAnswered

Is it safe to connect Claude Code to our internal company DB server?

Anonymous8/10/2026· Views 90
I've been writing queries in Claude Code, and I want to try connecting to our actual production DB, but I'm a bit nervous about it. If I connect a DB through MCP, does the connection info or query results get logged somewhere or sent out externally? I'm also wondering if everyone sets up a separate read-only account for this, or if people just connect directly with their production credentials. If anyone's actually using Claude Code with their company's internal DB, I'd like to know how you set it up.

Answers 1

You need to log in to write an answer.
  • 첫째StaffLv.68/10/2026

    Hello, this is from the admin team. To put it simply: connecting with a read-only account is the right approach, and if you set it up that way, it's safe enough to use. Let me explain the structure: when you connect to a database via MCP, your access details (host, account, password, etc.) are normally stored in your local config file, and a local MCP server process connects directly to the database. However, since Claude needs to see the query results to generate the next response, they get included in the conversation context just like pasting regular text into the chat — and that context is sent to the API. So it's not a setup where results stay completely local. Regarding data storage: with commercial Claude Code (Team, Enterprise, API usage), session data doesn't get used for model training unless you opt in to the Development Partner Program, and it's deleted after the standard 30-day retention period. Enterprise can also enable zero data retention (ZDR) if certain conditions are met. The exact retention period and exceptions can vary by account plan, so we recommend checking the official documentation. Here are the practical setup recommendations: 1. Avoid connecting your admin account directly. Instead, create a separate read-only account with SELECT permissions only. 2. For sensitive columns like personal info or payment details, either mask them with a view or exclude them from access entirely. 3. When possible, restrict network access to company networks/VPN only, and narrow permissions to just the schemas and tables you need. The core MCP security principles are detailed in the guide below. https://usingclaude.com/ko/library/mcps/mcp-connector-security For specific setup instructions for PostgreSQL, check out this post. https://usingclaude.com/ko/claude-code/mcp/postgresql-mcp-server-setup