loading…
Search for a command to run...
loading…
MCP server providing LLMs with safe, read-only access to the Chinook SQLite sample database, including schema exploration and SQL query execution.
MCP server providing LLMs with safe, read-only access to the Chinook SQLite sample database, including schema exploration and SQL query execution.
Example MCP Server to provide LLM MCP access to the example sqlite3 Chinook database
This project provides an MCP (Model Context Protocol) server for the Chinook SQLite database and a sample Agno agent client for interactive querying. It enables LLMs and other MCP-compatible clients to safely explore and query the Chinook database using a standardized protocol.
schema://chinook/tables: Returns the schema for all tables in the database.schema://chinook/table/{table_name}: Returns the schema for a specific table.run_sql_query: Allows execution of read-only (SELECT) SQL queries. Only SELECT statements are permitted for safety.agno_test_client.py) that demonstrates how to connect to the MCP server and interact with it using an LLM agent.curl -LsSf https://astral.sh/uv/install.sh | sh
git clone <your-repo-url>
cd mcp-chinookdb-server
uv sync
Ensure you have Python 3.8+ installed and uv available in your environment.uv run chinook_mcp_server.py
The server will automatically download the Chinook database if needed and start listening for MCP requests (default: stdio transport).Start the interactive client:
uv run agno_test_client.py
This will launch a REPL where you can type natural language queries about the Chinook database. The client will start the MCP server (if not already running) and use an LLM (e.g., OpenAI GPT-4) to interpret your queries and interact with the database via MCP tools.
Example queries:
List all tables.Show the schema for the Album table.How many tracks are there in the database?Who are the top 5 artists by number of tracks?To exit: Type q, quit, or exit at the prompt.
uv run chinook_mcp_server.py for fast startup).run_sql_query tool.chinook_mcp_server.py.The Chinook SQLite database is a sample database that models a digital music store, similar to iTunes. It is widely used for SQL learning and demonstrations. The schema is designed to represent the core entities and relationships found in an online music store, including customers, employees, artists, albums, tracks, invoices, and more.
Artist
ArtistId (INTEGER, PK): Unique artist identifierName (NVARCHAR): Artist nameAlbum
AlbumId (INTEGER, PK): Unique album identifierTitle (NVARCHAR): Album titleArtistId (INTEGER, FK): Reference to the artistTrack
TrackId (INTEGER, PK): Unique track identifierName (NVARCHAR): Track nameAlbumId (INTEGER, FK): Reference to the albumMediaTypeId (INTEGER, FK): Reference to the media typeGenreId (INTEGER, FK): Reference to the genreComposer (NVARCHAR): Composer nameMilliseconds (INTEGER): Track lengthBytes (INTEGER): File sizeUnitPrice (NUMERIC): Price per trackGenre
GenreId (INTEGER, PK): Unique genre identifierName (NVARCHAR): Genre nameMediaType
MediaTypeId (INTEGER, PK): Unique media type identifierName (NVARCHAR): Media type name (e.g., MPEG audio, AAC audio)Customer
CustomerId (INTEGER, PK): Unique customer identifierFirstName, LastName (NVARCHAR): Customer nameCompany, Address, City, State, Country, PostalCode (NVARCHAR): Contact infoPhone, Fax, Email (NVARCHAR): Contact infoSupportRepId (INTEGER, FK): Employee assigned to the customerEmployee
EmployeeId (INTEGER, PK): Unique employee identifierLastName, FirstName (NVARCHAR): Employee nameTitle (NVARCHAR): Job titleReportsTo (INTEGER, FK): ManagerBirthDate, HireDate (DATETIME): DatesAddress, City, State, Country, PostalCode, Phone, Fax, Email (NVARCHAR): Contact infoInvoice
InvoiceId (INTEGER, PK): Unique invoice identifierCustomerId (INTEGER, FK): Customer making the purchaseInvoiceDate (DATETIME): Date of invoiceBillingAddress, BillingCity, BillingState, BillingCountry, BillingPostalCode (NVARCHAR): Billing infoTotal (NUMERIC): Total amountInvoiceLine
InvoiceLineId (INTEGER, PK): Unique line item identifierInvoiceId (INTEGER, FK): Reference to invoiceTrackId (INTEGER, FK): Reference to trackUnitPrice (NUMERIC): Price per trackQuantity (INTEGER): Number of tracks purchasedPlaylist
PlaylistId (INTEGER, PK): Unique playlist identifierName (NVARCHAR): Playlist namePlaylistTrack
PlaylistId (INTEGER, FK): Reference to playlistTrackId (INTEGER, FK): Reference to trackThis schema enables a wide range of queries and analytics, such as finding top artists, most popular genres, customer purchase history, and more.
Выполни в терминале:
claude mcp add mcp-chinookdb-server -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.