Chinook MCP Server
Provides read-only exploration and querying of SQLite databases, including listing tables, describing schemas, sampling rows, and running SQL queries with safety limits.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Chinook MCP ServerWhich five artists earned the most revenue?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Chinook MCP Server
A Model Context Protocol server, written in Python, that lets AI assistants such as Cursor and Claude Desktop explore and query a SQLite database in plain English. The database is read-only, so the assistant can't change your data.
It ships with the Chinook sample database, a digital music store with artists, albums, tracks, customers, employees and invoices. Point it at any other SQLite file with one environment variable.
Ask things like:
"Which five artists earned the most revenue, and in which countries do their customers live?"
"Which sales agent had the highest sales in 2013?"
"Show me the schema and explain how invoices link to tracks."
The assistant reads the schema, writes the SQL, runs it through this server and explains the result.
Tools
Tool | What it does |
| Lists every table with its row count. |
| Shows columns, types, primary key, foreign keys and row count. |
| Returns the first few rows of a table. |
| Runs one read-only SQL query and returns columns and rows (up to 1,000). |
The chinook://schema resource holds the full CREATE statements. All tools return structured JSON output and are marked read-only for MCP clients.
Related MCP server: MCP Database Bridge
How it stays read-only
Safety is enforced by SQLite itself, not by matching keywords in the SQL:
The file is opened in read-only mode (
mode=ro) withPRAGMA query_only.Every query runs under a SQLite authorizer that allows reads only.
INSERT,UPDATE,DELETE, DDL,PRAGMAandATTACHare refused, even when hidden inside aWITHclause.Only one statement is allowed per call.
Results are capped by a row limit, and a time limit (5 seconds by default) stops runaway queries.
Table names passed to
describe_tableandsample_rowsare checked against the real table list.
Setup
Requires Python 3.10 or newer.
git clone https://github.com/arslanmunawar0/chinook-mcp-server.git
cd chinook-mcp-server
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytestConnect it to an assistant
Use the absolute path to the chinook-mcp-server command inside your virtual environment.
Cursor: add this to .cursor/mcp.json in your project, or to ~/.cursor/mcp.json to use it everywhere.
{
"mcpServers": {
"chinook": {
"command": "/absolute/path/to/chinook-mcp-server/.venv/bin/chinook-mcp-server"
}
}
}Claude Desktop: add the same mcpServers block to claude_desktop_config.json and restart the app.
MCP Inspector: to try the tools in a browser:
npx @modelcontextprotocol/inspector .venv/bin/chinook-mcp-serverUsing your own database
Set CHINOOK_DB_PATH to any SQLite file:
{
"mcpServers": {
"my-data": {
"command": "/absolute/path/to/chinook-mcp-server/.venv/bin/chinook-mcp-server",
"env": { "CHINOOK_DB_PATH": "/absolute/path/to/your.db" }
}
}
}Project layout
src/chinook_mcp/database.py read-only SQLite access (authorizer, limits, schema)
src/chinook_mcp/server.py MCP tools and resource
tests/ database tests, plus end-to-end tests over the MCP protocol and stdio
chinook.db Chinook sample database, v1.4.5Built with the official MCP Python SDK (v2).
Credits and licence
chinook.db is the Chinook Database by Luis Rocha, file Chinook_Sqlite.sqlite from release v1.4.5. It is used under the MIT licence, included unchanged in LICENSE-CHINOOK.md.
The server code is MIT-licensed; see LICENSE.
Available Tools
4 toolsdescribe_tableBRead-onlyIdempotent
Show a table's columns, primary key, foreign keys and row count.
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| name | Yes | |
| columns | Yes | |
| row_count | Yes | |
| foreign_keys | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true and openWorldHint=false, so the safety profile is covered. The description adds what information is surfaced (keys and row count), but says nothing about cost, latency, or behavior on a missing table, so credit is limited.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One sentence, front-loaded with the verb and resource, listing only substantive output fields. Every word earns its place with no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return values need not be re-explained, and the annotations cover the safety profile. For a single-parameter read tool the description is nearly sufficient, with only parameter format and error behavior left unstated.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% and the single 'table' parameter is documented nowhere in the schema. The description refers only to 'a table' and provides no format guidance (qualified name, quoting, case sensitivity), so it fails to compensate for the coverage gap.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description gives a specific verb ('Show') and resource ('a table') and enumerates the exact output it produces (columns, primary key, foreign keys, row count), which cleanly distinguishes it from siblings like list_tables and sample_rows. It stops short of explicitly naming those alternatives, so it is clear but not sibling-differentiating.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no statement of when to use this tool versus run_query, list_tables, or sample_rows, and no prerequisites or exclusions. The purpose is implied by the content list, but no routing guidance is given.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_tablesARead-onlyIdempotent
List every table in the database with its row count.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint, idempotentHint, and openWorldHint=false, so the safety and determinism profile is covered. The description adds only that row counts are included in the listing, which is modest additional context; with an output schema present, return details need not be repeated.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler; the resource and the returned attribute are both stated immediately.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter discovery tool with a full output schema and annotations covering safety, the description supplies everything needed to invoke it correctly. It could go further by noting scope caveats (e.g., only accessible tables), but nothing essential is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool takes zero parameters, so there is nothing to document and the baseline of 4 applies. The description correctly implies no input is needed, though it never explicitly says the listing is unfiltered/unpaginated.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb (list) and resource (every table in the database) and adds the returned detail (row count), so an agent knows this is a discovery/inventory tool. It does not explicitly differentiate itself from siblings like describe_table or sample_rows, but the resource is distinct enough to distinguish them in practice.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is only implied: a zero-parameter listing tool that obviously serves as an entry point for schema exploration. It never states when to prefer this over run_query or describe_table, nor any prerequisite such as connection/permission requirements.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
run_queryARead-onlyIdempotent
Run one read-only SQL query (SQLite dialect) and return the rows.
Only SELECT and WITH ... SELECT statements are accepted. At most limit
rows are returned (1 to 1000); truncated is true when more rows
matched, in which case narrow the query or aggregate instead.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| limit | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| rows | Yes | |
| columns | Yes | |
| row_count | Yes | |
| truncated | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already cover readOnlyHint, idempotentHint, and openWorldHint=false, so the safety profile is free. The description adds genuinely new behavior: statement-type enforcement, the 1–1000 limit bound, and the truncation contract with `truncated`. It does not state what happens to a rejected non-SELECT statement (error vs. empty result).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three tight sentences with zero filler, front-loading what the tool is before the constraints and the truncation fallback. Nothing repeats structured fields.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a two-parameter read-only tool with an output schema and full annotation coverage, this covers everything an agent needs: input contract, dialect, limit bounds, and truncation semantics. Return shape is delegated correctly to the output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must carry both parameters — and it largely does, specifying the SQLite dialect, the accepted statement forms for `sql`, and the 1–1000 range for `limit`. The default of 100 exists only in the schema and is never restated in prose.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb+resource ('Run one read-only SQL query (SQLite dialect) and return the rows') with scope qualifiers that make it immediately distinguishable from the schema-inspection siblings. An agent knows exactly what this tool does without opening the schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives clear operating context (read-only, only SELECT/WITH...SELECT accepted) and a recovery path when output is truncated ('narrow the query or aggregate instead'). It never names the sibling tools, however, so the choice between run_query, sample_rows, or list_tables is left to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
sample_rowsBRead-onlyIdempotent
Return the first few rows of a table to show what its data looks like.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| table | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| rows | Yes | |
| columns | Yes | |
| row_count | Yes | |
| truncated | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true, and openWorldHint=false, so the safety profile is covered structurally. The description adds that output is a small sample ('first few rows') rather than full data, which is useful, but says nothing about the size cap, failure modes, or behavior on empty tables.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single tight sentence with the return value front-loaded and no filler. It is efficient, though arguably too sparse to carry the parameter burden.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return-shape explanation is unnecessary, and the tool is simple with one required parameter. The description is adequate for a preview tool, with the only real gap being the undocumented limit semantics.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% for two parameters. The description only implicitly references 'table' and gestures at 'first few rows' for 'limit', without clarifying that limit controls row count, its default of 5, or valid ranges.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb ('Return') and resource ('first few rows of a table') with the intent ('show what its data looks like'), so the operation is unambiguous. It does not, however, distinguish itself from siblings like run_query or describe_table, which could also produce row data.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'to show what its data looks like' implies a preview/inspection use case, which is a reasonable usage hint. But it names no alternatives and gives no when-not guidance versus run_query or describe_table, leaving routing to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.0- First observed
describe_table - First observed
list_tables - First observed
run_query - First observed
sample_rows
TDQS
Scored across 4 tools
list_tables (inventory), describe_table (schema detail), and sample_rows (data preview) are clearly distinct discovery tools. run_query overlaps somewhat with sample_rows since a preview could be achieved via a limited SELECT, but the read-only arbitrary-query purpose is still recognizable.
All four names follow a consistent verb_noun snake_case pattern (run_query, list_tables, describe_table, sample_rows). The convention is uniform and immediately readable.
Four tools is a tight, well-scoped set for a read-only database explorer, and each tool serves a distinct discovery or query step. It is on the lean side, but nothing feels redundant or missing for the stated scope.
For a read-only exploration surface, discovery (list, describe, sample) plus arbitrary querying covers the main lifecycle. Writes are intentionally excluded, though there is no way to search for a table/column by name or inspect indexes, which would be minor conveniences.
Maintenance
Related MCP Connectors
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables natural language interaction with local SQLite databases through Claude Desktop, translating plain English queries into SQL for data analysis and exploration.3MIT
- FlicenseNot gradedqualityCmaintenanceA secure, read-only MCP server that empowers Claude Desktop and AI agents to safely query and inspect local SQLite databases.-
- FlicenseNot gradedqualityCmaintenanceQuery SQLite databases via AI — safe read-only mode-
- FlicenseNot gradedqualityDmaintenanceQuery databases in plain English using Claude. Supports SQLite, CSV, PostgreSQL, and MySQL.1-