An open API service indexing awesome lists of open source software.

https://github.com/annettedorothea/db2ai

db2ai generates MCP tools from SQL queries. It defines curated database queries with AI-facing metadata such as intent, examples, and column documentation, and validates them against a live database using EXPLAIN.
https://github.com/annettedorothea/db2ai

ai-tools code-generation database dsl langium mcp model-context-protocol query-builder sql tool-generation

Last synced: about 22 hours ago
JSON representation

db2ai generates MCP tools from SQL queries. It defines curated database queries with AI-facing metadata such as intent, examples, and column documentation, and validates them against a live database using EXPLAIN.

Awesome Lists containing this project

README

          

# db2ai

> Generate curated MCP tools from relational databases.

> **Pre-release**
> APIs, the DSL, and generated output may change before v1.0.

## Ecosystem

| Repository | Purpose |
| ----------------------------------------------------- | ------------------------------------------------------ |
| [core2ai](https://github.com/annettedorothea/core2ai) | Shared runtime, architecture, and documentation |
| [api2ai](https://github.com/annettedorothea/api2ai) | Generate curated MCP tools from OpenAPI specifications |
| [db2ai](https://github.com/annettedorothea/db2ai) | Generate curated MCP tools from relational databases |

Instead of hand-writing MCP servers, define the SQL queries you want as tools, enrich them in `.db2ai`, and generate executable MCP tooling.

You curate which queries become tools — not every table or statement is exposed automatically.

---

## Quick Start

The easiest way to explore `db2ai` is with the VSIX extension and the bundled demo workspace.

### 1. Install the extension

Download the latest VSIX from the GitHub releases page:

https://github.com/annettedorothea/db2ai/releases

### 2. Create a demo workspace

In Cursor or VS Code, run:

```text
db2ai: Create demo workspace (MCP examples)
```

### 3. Start your first MCP server

Open the generated [Demo Workspace README](packages/extension/demos/README.md) and follow the Quick Start.

The demo workspace includes PostgreSQL, MySQL, MariaDB, SQL Server, and Oracle examples.

---

## How it works

```text
Database Schema


select & enrich


.db2ai


Generated MCP Server


Cursor • ChatGPT • Claude • Open WebUI
```

Example:

```text
database postgres env "PAGILA_POSTGRESQL_DATABASE_URL"

auth

SQL {
toolName: listFilms
access: protected
hooks: {
prepareToolCall: true
}
intent: "list films with pagination"
query: "SELECT * FROM film LIMIT LEAST(:limit, 100) OFFSET :offset"
params: {
limit: { description: "max rows per page" example: "100" type: integer }
offset: { description: "rows to skip" example: "0" type: integer }
}
}
```

---

## Documentation

Looking for architecture, authentication, MCP concepts, integrations, or development guides?

See the shared documentation in [core2ai](https://github.com/annettedorothea/core2ai):

- [Documentation index](https://github.com/annettedorothea/core2ai/blob/main/docs/README.md)
- [db2ai DSL](https://github.com/annettedorothea/core2ai/blob/main/docs/authoring/db2ai-dsl.md)
- [Supported SQL patterns](https://github.com/annettedorothea/core2ai/blob/main/docs/authoring/supported-sql.md)
- [Auth and hooks](https://github.com/annettedorothea/core2ai/blob/main/docs/authoring/auth-and-hooks.md)

See [CHANGELOG.md](CHANGELOG.md) for version history and upgrade notes.

---

## Related Projects

- [core2ai](https://github.com/annettedorothea/core2ai) — Shared runtime, code generation infrastructure, and documentation.
- [api2ai](https://github.com/annettedorothea/api2ai) — Generate curated MCP tools from OpenAPI specifications.

---

## License

MIT — see [LICENSE](LICENSE).

Questions, ideas, bug reports, and feature requests are always welcome through GitHub Discussions or Issues.

---

> _Whatever you do, work heartily, as for the Lord and not for men._
>
> **— Colossians 3:23**
>
> _Created by Annette Pohl_