datasette-mcp
Adds a /-/mcp MCP server to any Datasette instance
Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-mcp
Usage
Start Datasette as normal, then configure an MCP client to connect to:
http://localhost:8001/-/mcp
The endpoint uses MCP Streamable HTTP and exposes three read-only tools by default:
list_databaseslists the databases available to the current Datasette actor.get_database_schemareturns the complete SQL schema for a database, including tables, indexes, views, and triggers.execute_sqlexecutes one read-only SQL statement and returns structured columns, column-keyed row objects, and a truncation indicator.
Datasette database visibility and execute-sql permissions are enforced for
every tool call. SQL uses the same validate_sql_select() and read-only
Database.execute() path as Datasette's custom SQL interface.
Registering additional MCP tools
Other Datasette plugins can add tools to this MCP server by implementing the
register_mcp_tools(datasette, mcp) plugin hook. The mcp argument is the
MCPServer for that Datasette instance, so implementations use the MCP Python
SDK's normal @mcp.tool() decorator:
from datasette import hookimpl
@hookimpl
def register_mcp_tools(datasette, mcp):
@mcp.tool()
async def database_count() -> int:
"""Return the number of user-facing databases."""
return len(
[name for name in datasette.databases if name != "_internal"]
)
The hook itself is synchronous because tools are registered while the MCP server is being constructed. Tool functions can be synchronous or asynchronous and can use all of the input, output, context, and annotation features provided by the MCP Python SDK.
Datasette-mcp registers list_databases, get_database_schema, and
execute_sql through this same hook.
Development
To set up this plugin locally, first checkout the code. You can confirm it is available like this:
cd datasette-mcp
# Confirm the plugin is visible
uv run datasette plugins
To run the tests:
uv run pytest
Release files for datasette-mcp 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| datasette_mcp-0.2.tar.gz | 12.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datasette_mcp-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:22.6 kB
Release files / datasette_mcp-0.2.tar.gz
| Download URL | datasette_mcp-0.2.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
caf0a4054289766066fdf5d1f667bd00bb178d63c0d87cacf409c69e71a1f325
|
|
BLAKE2b-256 checksum How to use checksums |
ce6fa32a7473a9ef5b2c7dd964911b496b069bfdee229df8c0345f8d1366850f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / datasette_mcp-0.2-py3-none-any.whl
| Download URL | datasette_mcp-0.2-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9184d83bd8b82bdc0d276a3b95363a4d5b849680ce945586012132fc09e57ed0
|
|
BLAKE2b-256 checksum How to use checksums |
702692b88af931b00b7ca5c0faaa590d60cfd307890cfbc5f7ab5cebd799eb69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency log