Create MCP Tool Configuration for Claude Code

Generate a secure, ready-to-use MCP server configuration file for Claude Code to enable local database and observability access safely.

Agent prompt for Claude

Prompt

Prompt
Act as a systems engineer. Create a JSON configuration for an MCP tool server that connects to a local database and an observability endpoint. Ask these 3 questions first and wait for my response: 1. What is the database type (e.g., SQLite, PostgreSQL) and the local file path or connection string? 2. What is the observability tool (e.g., Prometheus, Grafana, Datadog) and its API endpoint? 3. Which specific tables or metrics should the AI be allowed to read? Rules: 1. Set all environment variables to read-only mode. 2. Include a security comment block explaining credential isolation. 3. Format output strictly as a valid JSON file for the Claude Code config. Output format: 1. Security rationale. 2. The JSON configuration block. 3. Verification steps for the Claude Code environment. This is not legal or security advice; consult a qualified security professional for production infrastructure.

Example output

Verifying your MCP server configurationFour checks after saving the config file
  1. Confirm servers are registeredRun mcp list in your terminal
  2. Test database connectivityExecute mcp test local-db-audit
  3. Check file path accessPath must be accessible by the current user shell
  4. Confirm no write accessAttempt a dummy SELECT query

Example for: a local SQLite sales database and a Prometheus metrics endpoint.

Security Rationale

This configuration follows the principle of least privilege. The SQLite database is accessed via a read-only connection string to prevent accidental data modification. The Prometheus endpoint is restricted to query-only access, ensuring the AI cannot trigger alerts or modify recording rules. All sensitive credentials are referenced via local environment variables to keep secrets out of the configuration file.

JSON Configuration

{
"mcpServers": {
"local-db-audit": {
"command": "sqlite3",
"args": ["-readonly", "/var/lib/sales/data.db"],
"env": {
"DB_MODE": "READ_ONLY"
}
},
"prometheus-metrics": {
"command": "curl",
"args": ["https://localhost:9090/api/v1/query"],
"env": {
"AUTH_TOKEN": "$PROMETHEUS_READ_TOKEN"
}
}
}
}

Verification Steps
  1. Run mcp list in your terminal to confirm the servers are registered.
  2. Execute mcp test local-db-audit to check connectivity.
  3. Verify that the file path is accessible by the current user shell.
  4. Check that no write permissions are granted by attempting a dummy SELECT query.
Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Forces a read-only constraint to prevent accidental data corruption.
  • Uses environment variable placeholders to ensure credentials remain isolated.
  • Provides a clear verification workflow to confirm the configuration works.

Use this to integrate your local dev stack with Claude Code. Paste the prompt into Claude or Claude Code. Provide your specific database paths and observability endpoints when asked. Ensure your environment variables are stored in a .env file and not hardcoded in the config.

Common edits

  • Adjust the command args if your database requires a specific driver or port.
  • Add more environment variables if your observability tool requires custom headers.

Reuse it: Use in a workflowAdapt in the builder

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

More in Claude Code
Agentic AI

Agent Tool Names, Descriptions and JSON Schemas from API Docs

Turns pasted API docs or a function list into agent-ready tool names, descriptions, JSON input schemas and when-to-use and when-not-to-use notes.

Package Skills, Hooks and MCP Into a Claude Code Plugin

A SKILL.md that turns the skills, subagents, hooks and MCP servers in your .claude folder into an installable Claude Code plugin with a marketplace file, then validates and test-installs it.

Coding

Debug SQL query errors and incorrect row counts

Find syntax errors, incorrect joins, and silent null filter bugs in database queries. Use it when a query returns syntax errors or unexpected row counts.

Audit Error Boundaries and Telemetry Coverage in Code

This prompt audits your codebase for missing error boundaries, unhandled promise rejections, and incomplete telemetry traces to ensure production stability.