# Data API Builder — REST/GraphQL + MCP Tools > Data API Builder (DAB) generates secure REST and GraphQL endpoints for databases, and the repo notes MCP tools support for agent-ready integrations. ## Install Copy the content below into your project: ## Quick Use ```bash dotnet --version dotnet tool install microsoft.dataapibuilder -g dab --version dab init --database-type mssql --connection-string "@env('my-connection-string')" --host-mode development dab add Todo --source "dbo.Todo" --permissions "anonymous:*" dab start ``` ## Intro Data API Builder (DAB) generates secure REST and GraphQL endpoints for databases, and the repo notes MCP tools support for agent-ready integrations. - **Best for:** Turning a database into an API surface with guardrails and reproducible config - **Works with:** .NET 8+; `dab` CLI; JSON config (`dab-config.json`) and env vars (per README) - **Setup time:** 15–40 minutes ## Practical Notes - GitHub: 1,404 stars · 337 forks; pushed 2026-05-12 (verified via GitHub API). - README installs the CLI via `dotnet tool install ... -g`, then uses `dab init`, `dab add`, and `dab start` for a working API. - README notes REST + GraphQL defaults, plus endpoints like `/health`, `/swagger`, and `/graphql` for local validation. ## Main What makes DAB useful for agents is **structure**: - Put your connection string in env vars and keep `.env` out of git. - Keep your `dab-config.json` under version control so changes are reviewed. - Start with least-privilege permissions (even in examples) and expand only when your API surface is stable. Once the API is stable, you can let an agent generate client code or queries against the REST/GraphQL endpoints without giving it raw DB credentials. ### FAQ **Q: Do I need containers?** A: Not for development—README runs locally with `dab start`; production commonly uses containers. **Q: Is the config required?** A: Yes—README says DAB requires a JSON configuration file and generates `dab-config.json`. **Q: How should I secure it?** A: Use env vars for secrets, version control configs, and keep permissions least-privilege by default. ## Source & Thanks > Source: https://github.com/Azure/data-api-builder > License: MIT > GitHub stars: 1,404 · forks: 337 --- ## 快速使用 ```bash dotnet --version dotnet tool install microsoft.dataapibuilder -g dab --version dab init --database-type mssql --connection-string "@env('my-connection-string')" --host-mode development dab add Todo --source "dbo.Todo" --permissions "anonymous:*" dab start ``` ## 简介 Data API Builder(DAB)是一款开源的无代码数据 API 引擎:为数据库生成 REST/GraphQL 端点,并在仓库说明中提供 MCP tools 支持,便于 agent 以更可控方式访问数据。 - **适合谁:** 把数据库变成可控 API 面,同时保持可复现配置与权限边界 - **可搭配:** .NET 8+;`dab` CLI;JSON 配置(`dab-config.json`)+ 环境变量(见 README) - **准备时间:** 15–40 分钟 ## 实战建议 - GitHub:1,404 stars · 337 forks;最近更新 2026-05-12(GitHub API 验证)。 - README 用 `dotnet tool install ... -g` 安装 CLI,并通过 `dab init`/`dab add`/`dab start` 跑起完整 API。 - README 提到默认启用 REST + GraphQL,并给出 `/health`、`/swagger`、`/graphql` 等本地验证入口。 ## 主要内容 让 DAB 对 agent 更友好的关键是 **结构化与可审计**: - 连接串放环境变量,`.env` 不进 git。 - `dab-config.json` 进版本控制,所有变更可 review。 - 权限从最小开始(即便是 demo),等 API 面稳定再逐步放开。 当 API 稳定后,你可以让 agent 基于 REST/GraphQL 写查询与生成代码,而不必把原始 DB 凭据交给它。 ### FAQ **一定要用容器吗?** 答:开发阶段不需要。README 直接 `dab start` 本地运行;生产常用容器化部署。 **必须要配置文件吗?** 答:必须。README 表示需要 JSON 配置,并生成 `dab-config.json`。 **怎么做安全加固?** 答:密钥走环境变量、配置走版本控制、默认最小权限再逐步放开。 ## 来源与感谢 > Source: https://github.com/Azure/data-api-builder > License: MIT > GitHub stars: 1,404 · forks: 337 --- Source: https://tokrepo.com/en/workflows/data-api-builder-rest-graphql-mcp-tools Author: MCP Hub