mcp-database-server: Cursor rule for Cursor

.cursorrules

cursorrules is a cursor rule for Cursor from ahmetbarut/mcp-database-server. It costs 3,262 tokens per session, scanned A, original, MIT.

A project rule describing how to build a Node.js and TypeScript MCP server that runs database queries.

In plain words
What is it for?
Guiding implementation of a multi-database MCP server with unified access, connection pools, parameterized queries, encrypted credentials, and audit logging.
Why use it?
It sets requirements for supporting SQLite, PostgreSQL, and MySQL while addressing connection handling, errors, and SQL injection risks. MCP is a standard way for AI tools to connect to external capabilities.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

This is ahmetbarut/mcp-database-server's own configuration. It tells Cursor how to work on mcp-database-server itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything mcp-database-server configures →

Reuse

Borrowing it

Nothing to install: this file belongs to ahmetbarut/mcp-database-server. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/ahmetbarut/mcp-database-server/main/.cursorrules
Clone the repo
git clone --depth 1 https://github.com/ahmetbarut/mcp-database-server

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cursorrules

README.md
[![agentmods](https://agentmods.dev/badge/rules/ahmetbarut/mcp-database-server/cursorrules/github.svg)](https://agentmods.dev/rules/ahmetbarut/mcp-database-server/cursorrules)
Your own site
<a href="https://agentmods.dev/rules/ahmetbarut/mcp-database-server/cursorrules"><img src="https://agentmods.dev/badge/rules/ahmetbarut/mcp-database-server/cursorrules/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cursorrules

Your own site · 80×15
<a href="https://agentmods.dev/rules/ahmetbarut/mcp-database-server/cursorrules"><img src="https://agentmods.dev/badge/rules/ahmetbarut/mcp-database-server/cursorrules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,262 This file is loaded in full into every session.
When invoked 3,262 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.03262 $0.03262
Opus 5.5 $0.01305 $0.01305
Sonnet 5.5 $0.00652 $0.00652
Haiku 4.5 $0.00326 $0.00326

Measured 2mo ago against content hash c814602f41e0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cursorrules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursorrules · 444 lines

How it starts

The opening of the file, as written. The whole thing — 444 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PROJECT OVERVIEW

You are an expert Node.js developer tasked with building a Model Context Protocol (MCP) server that provides multi-database query execution capabilities. This server should support SQLite, PostgreSQL, and MySQL databases with a focus on security, performance, and extensibility using modern Node.js and TypeScript. Note: This project is mcp-server, not a web app or another app.

CORE REQUIREMENTS

1. MCP Protocol Implementation

  • Implement full MCP server specification compliance
  • Use JSON-RPC for client-server communication
  • Provide proper error handling and response formatting
  • Support async/await patterns with modern ES modules

2. Database Support

  • SQLite: File-based database support with better-sqlite3 or sqlite3
  • PostgreSQL: Production database support with pg (node-postgres)
  • MySQL: Enterprise database support with mysql2
  • Implement connection pooling for each database type
  • Provide unified interface across all database types

3. Security Requirements

  • MANDATORY: Use parameterized queries only (prevent SQL injection)
  • Implement credential encryption for database connections
  • Add query validation and sanitization
  • Include audit logging for all database operations
  • Support rate limiting and timeout controls

4. Architecture Pattern

  • Use dependency injection for database drivers
  • Implement proper connection lifecycle management
  • Follow SOLID principles and clean architecture
  • Use Zod for data validation and schema management
  • Use TypeScript for type safety

PROJECT STRUCTURE

mcp-database-server/ ├── src/ │ ├── index.ts │ ├── server/ │ │ ├── index.ts │ │ ├── mcp-server.ts # Main MCP server implementation │ │ ├── handlers.ts # Request handlers │ │ └── tools/ # MCP tools implementation │ │ ├── index.ts │ │ ├── execute-query.ts │ │ ├── list-databases.ts │ │ ├── describe-table.ts │ │ └── list-tables.ts │ ├── database/ │ │ ├── index.ts │ │ ├── base.ts # Abstract base database interface │ │ ├── factory.ts # Database driver factory │ │ ├── pool.ts # Connection pooling │ │ └── drivers/ │ │ ├── index.ts │ │ ├── sqlite-driver.ts │ │ ├── postgresql-driver.ts │ │ └── mysql-driver.ts │ ├── config/ │ │ ├── index.ts │ │ ├── settings.ts # Configuration schemas │ │ └── database-config.ts # Database configurations │ ├── security/ │ │ ├── index.ts │ │ ├── encryption.ts # Credential encryption │ │ ├── validators.ts # Query validation │ │ └── audit.ts # Audit logging │ ├── utils/ │ │ ├── index.ts │ │ ├── logger.ts # Structured logging │ │ ├── exceptions.ts # Custom exceptions │ │ └── helpers.ts # Utility functions │ └── types/ │ ├── index.ts │ ├── database.ts │ ├── mcp.ts │ └── config.ts ├── tests/ │ ├── unit/ │ ├── integration/ │ └── fixtures/ ├── examples/ │ ├── basic-usage.js │ ├── configuration-examples/ │ └── client-examples/ ├── docs/ ├── package.json ├── package-lock.json ├── tsconfig.json ├── .env.example ├── .gitignore ├── README.md ├── jest.config.js └── LICENSE

Read the full file on GitHub · 444 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 444 lines · 3,262 tokens per session scan A c814602f41e0

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository ahmetbarut/mcp-database-server (6 stars, last pushed 8mo ago), licensed MIT. It adds 3,262 tokens to every session, about $0.0130 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

cursorrules compared with cursor rules from other repositories

cursorrules next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
cursorrulesahmetbarut/mcp-database-serverCursor rule68mo agoMITA3,262Cursor
about-codebaselineai-intelligence/lineai-mcp-serverCursor rule3711d agoMPL-2.0A13Cursor
toc-readmekontent-ai/mcp-serverCursor rule102d agoMITA0Cursor
runwhen-infrastructurerunwhen-contrib/runwhen-platform-mcpCursor rule15d agoApache-2.0A0Cursor
php-client-implementationdalehurley/php-mcp-sdkCursor rule2711mo agoMITA8Cursor
cursor_rulesgiantswarm/mcp-prometheusCursor rule11yesterdayApache-2.0A374Cursor
validate-design-earlyRethunk-AI/clodbridgeCursor rule04mo agoMITA227Cursor