Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/kenlan2022/mcp_servers_showcase/database-server-rulesgit clone --depth 1 https://github.com/Kenlan2022/mcp_servers_showcaseWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.03919 |
| Opus 5 | $0.00000 | $0.01959 |
| Sonnet 5 | $0.00000 | $0.00784 |
| Haiku 4.5 | $0.00000 | $0.00392 |
Grade A, and why
database-server-rules 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 2d 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.
How it starts
The opening of the file, as written. The whole thing — 615 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Database Server Specific Development Rules
Core Database Operations
Async Database Operations
import asyncio
import aiosqlite
from typing import Dict, Any, List, Optional
import logging
logger = logging.getLogger(__name__)
class DatabaseConnection:
"""Async database connection manager"""
def __init__(self, db_path: str):
self.db_path = db_path
self.connection: Optional[aiosqlite.Connection] = None
async def connect(self) -> None:
"""Establish database connection"""
try:
self.connection = await aiosqlite.connect(self.db_path)
await self.connection.execute("PRAGMA foreign_keys = ON")
await self.connection.commit()
logger.info(f"Connected to database: {self.db_path}")
except Exception as e:
logger.error(f"Database connection error: {e}")
raise
async def disconnect(self) -> None:
"""Close database connection"""
if self.connection:
await self.connection.close()
self.connection = None
logger.info("Database connection closed")
SQL Query Security
import re
from typing import Dict, Any, List
# Dangerous SQL patterns to detect
DANGEROUS_PATTERNS = [
r'\b(DROP|DELETE|TRUNCATE|ALTER|CREATE|INSERT|UPDATE)\b',
r';\s*--', # SQL injection comments
r'\bUNION\b.*\bSELECT\b',
r'\bEXEC\b|\bEXECUTE\b',
r'\bxp_cmdshell\b',
r'\bsp_\w+\b'
]
def validate_sql_query(query: str, allowed_operations: List[str] = None) -> bool:
"""Validate SQL query for security"""
if not allowed_operations:
allowed_operations = ['SELECT']
# Check for dangerous patterns
for pattern in DANGEROUS_PATTERNS:
if re.search(pattern, query, re.IGNORECASE):
first_word = query.strip().split()[0].upper()
if first_word not in allowed_operations:
raise ValueError(f"Dangerous SQL operation detected: {first_word}")
return True
def sanitize_sql_input(value: Any) -> str:
"""Sanitize SQL input to prevent injection"""
if isinstance(value, str):
# Remove SQL special characters
sanitized = re.sub(r'[^\w\s.-]', '', value)
return sanitized
return str(value)
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.
- 2d ago First seen · 615 lines · 0 tokens per session scan A d51bfe8586dd
database-server-rules is a cursor rule published in the GitHub repository Kenlan2022/mcp_servers_showcase (0 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,919 tokens. 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.
Other cursor rules, from other repositories
database-design
Database design guidelines — relational normalisation, indexing, constraints, NoSQL patterns, query optimisation, migrations, security, and backup strategies. Applied when working with database schemas and queries.
backend-dev
Backend development workflow with Java/Python/Node.js - 后端开发完整工作流.
supabase-migrations
You are a Postgres Expert who loves creating secure database schemas.
database-patterns
Cursor rule "database-patterns" from floriscornel/todo-mcp, covering database development patterns, schema changes, database operations, schema patterns and migration best practices.
database
Cursor rule "database" from ItamarZand88/awesome-agent-conventions, covering database best practices, prisma setup, prisma models, prisma queries and supabase setup.
sqlite
本规范为 SQLite 开发提供全面指导,涵盖架构设计、性能优化、安全性、测试等最佳实践。旨在确保高效、安全和可维护的 SQLite 数据库应用程序。.