PRS is a powerful dotnet CLI tool designed to bridge the gap between SQL Server databases and developers (or AI agents). It allows you to dump database schemas into local, human-readable Markdown files. These schemas can then be queried through a rich Command-Line Interface (CLI) or exposed to AI coding assistants (like Cursor, Claude Desktop, or Windsurf) via a Model Context Protocol (MCP) server.
- Local First: Your database schema is stored locally in
%APPDATA%\.prs\schemas\as Markdown files. - AI-Enhanced: Provide structured database context to LLMs without exposing your production database.
- Multi-Format Output: Query results in
table,ddl,json, ortextformat — optimized for both humans and LLMs. - Rich CLI: A comprehensive set of commands to search and explore your schemas.
- MCP Server: Seamless integration with any AI tool that supports the Model Context Protocol.
- Fast & Lightweight: Built on .NET 10.0 with minimal dependencies.
- .NET 10.0 SDK
- Access to a Microsoft SQL Server
You can install PRS as a .NET global tool:
dotnet tool install wooly905.prs -gOr run it directly from the source:
dotnet run --project src/PRS.csproj -- [command]Set your SQL Server connection string (this is stored securely on your local machine):
prs wcs "Server=your_server;Database=your_db;User Id=your_user;Password=your_password;TrustServerCertificate=True"Export your database schema to local Markdown files:
prs dds my_db_nameUsage: prs <command> [arguments] [-f <format>]
Setup:
scs Show saved connection string
wcs <connection-string> Save connection string
dds <schema-name> Dump database schema to local file
Schema Management:
ls List all saved schemas (* = active)
use <schema-name> Switch active schema
rm <schema-name> Remove a saved schema
Query (partial match, case-insensitive):
ft <keyword> Find tables by name
fc <keyword> Find columns by name across all tables
ftc <table> <column> Find columns in matching tables
sc <table-name> Show all columns in a table (exact match)
fsp <keyword> Find stored procedures by name
Query commands support an optional -f flag to control output format:
| Format | Flag | Available for | Description |
|---|---|---|---|
table |
-f table |
All query commands (default) | Formatted table with borders |
json |
-f json |
All query commands | JSON structured format |
text |
-f text |
All query commands | Plain text format |
ddl |
-f ddl |
sc only |
SQL DDL (CREATE TABLE) statement |
-
Find Tables (
ft): Search for tables or views by name.prs ft Orders
Output:
┌────────────────────┬────────────┐ │ TableName │ TableType │ ├────────────────────┼────────────┤ │ Orders │ BASE TABLE │ │ OrdersTransactions │ BASE TABLE │ │ PrintOrders │ BASE TABLE │ │ VDPOrders │ BASE TABLE │ └────────────────────┴────────────┘ -
Find Columns (
fc): Search for a specific column across the entire database.prs fc OrderIDOutput:
┌───────────────────────┬──────────────┬─────┬─────────┬──────────┬──────────┬─────┬────────┬────────────┬─────┬─────────────┬──────────────┐ │ Table │ Column │ Pos │ Default │ Nullable │ DataType │ PK │ Unique │ Identity │ FK │ FK.Table │ FK.Column │ ├───────────────────────┼──────────────┼─────┼─────────┼──────────┼──────────┼─────┼────────┼────────────┼─────┼─────────────┼──────────────┤ │ OrderAddresses │ OrderId │ 2 │ │ NO │ bigint │ NO │ NO │ NO │ YES │ Orders │ OrderId │ │ OrderEmails │ OrderId │ 2 │ │ NO │ int │ NO │ NO │ NO │ YES │ Orders │ OrderId │ │ Orders │ OrderId │ 1 │ │ NO │ bigint │ YES │ YES │ YES (1, 1) │ NO │ │ │ └───────────────────────┴──────────────┴─────┴─────────┴──────────┴──────────┴─────┴────────┴────────────┴─────┴─────────────┴──────────────┘ -
Find Columns in Table (
ftc): Search for specific columns within a single table.prs ftc Orders Total
Output:
┌────────┬─────────────────┬─────┬─────────┬──────────┬──────────┬────┬────────┬──────────┬────┬──────────┬───────────┐ │ Table │ Column │ Pos │ Default │ Nullable │ DataType │ PK │ Unique │ Identity │ FK │ FK.Table │ FK.Column │ ├────────┼─────────────────┼─────┼─────────┼──────────┼──────────┼────┼────────┼──────────┼────┼──────────┼───────────┤ │ Orders │ TotalItemsPrice │ 8 │ │ NO │ money │ NO │ NO │ NO │ NO │ │ │ │ Orders │ TotalShipping │ 9 │ │ NO │ money │ NO │ NO │ NO │ NO │ │ │ │ Orders │ TotalTaxAmount │ 23 │ │ NO │ money │ NO │ NO │ NO │ NO │ │ │ │ Orders │ OrderTotal │ 25 │ │ NO │ money │ NO │ NO │ NO │ NO │ │ │ └────────┴─────────────────┴─────┴─────────┴──────────┴──────────┴────┴────────┴──────────┴────┴──────────┴───────────┘ -
Show Table Details (
sc): List all columns and their properties for a specific table.prs sc Orders
Output (Partial):
┌────────┬──────────────────┬─────┬─────────┬──────────┬─────────────┬─────┬────────┬────────────┬─────┬────────────────┬────────────────┐ │ Table │ Column │ Pos │ Default │ Nullable │ DataType │ PK │ Unique │ Identity │ FK │ FK.Table │ FK.Column │ ├────────┼──────────────────┼─────┼─────────┼──────────┼─────────────┼─────┼────────┼────────────┼─────┼────────────────┼────────────────┤ │ Orders │ OrderId │ 1 │ │ NO │ bigint │ YES │ YES │ YES (1, 1) │ NO │ │ │ │ Orders │ Created │ 6 │ │ NO │ datetime │ NO │ NO │ NO │ NO │ │ │ │ Orders │ TotalTaxAmount │ 23 │ │ NO │ money │ NO │ NO │ NO │ NO │ │ │ │ Orders │ BillingAddressId │ 11 │ │ YES │ bigint │ NO │ NO │ NO │ YES │ OrderAddresses │ OrderAddressId │ └────────┴──────────────────┴─────┴─────────┴──────────┴─────────────┴─────┴────────┴────────────┴─────┴────────────────┴────────────────┘ -
DDL Output Format: Get results in SQL DDL format, ideal for LLMs.
prs sc Orders -f ddl
Output:
CREATE TABLE Orders ( OrderId bigint NOT NULL IDENTITY(1,1), Created datetime NOT NULL, TotalTaxAmount money NOT NULL, BillingAddressId bigint NULL, CONSTRAINT PK_Orders PRIMARY KEY (OrderId), CONSTRAINT FK_Orders_BillingAddressId FOREIGN KEY (BillingAddressId) REFERENCES OrderAddresses(OrderAddressId) );
-
Find Stored Procedures (
fsp): Search for stored procedures by name.prs fsp Search
PRS includes an MCP server that allows AI agents to "see" your database schema.
Add this configuration to your mcpServers settings:
{
"mcpServers": {
"prs": {
"command": "dotnet",
"args": [
"run",
"--project",
"C:\\path\\to\\PRS\\src-mcp\\PRS.McpServer.csproj"
]
}
}
}Once configured, you can simply ask your AI:
- "Explain the relationship between the
UsersandOrderstables." - "What columns are in the
Productstable?" - "Find any stored procedures related to user registration."
The MCP server defaults to DDL output format, which is the most token-efficient and natural representation for LLMs. See src-mcp/README.md for full MCP tool documentation.
PRS ships with two ready-made Claude Code skills that teach Claude how to query your database schema effectively. Choose the one that matches your setup:
| Skill | File | How Claude queries schema |
|---|---|---|
| CLI | query-schema-cli.md |
Runs prs commands in terminal (prs ft, prs sc -f ddl, etc.) |
| MCP | query-schema-mcp.md |
Calls PRS MCP tools directly (find_table, get_table_schema, etc.) |
Use CLI if you have prs installed as a dotnet global tool. Use MCP if you have the PRS MCP server configured in your AI tool.
Install:
# CLI version — works anywhere prs is installed
cp skills/claude-code/query-schema-cli.md /path/to/your-project/.claude/commands/
# MCP version — requires PRS MCP server configured
cp skills/claude-code/query-schema-mcp.md /path/to/your-project/.claude/commands/Then use in Claude Code:
/query-schema-cli Show me all columns in the Orders table
/query-schema-mcp How are Users and Orders related?
Both skills guide Claude to verify the active schema, use DDL format for understanding, trace foreign key relationships, and ground SQL queries in actual schema definitions.
src/: Core logic and CLI tool.src-mcp/: MCP Server implementation.tests/: Extensive test suite for all components.
We maintain high code quality with comprehensive tests.
dotnet test