중요합니다
MCP(SQL 모델 컨텍스트 프로토콜) 서버는 Data API Builder 버전 1.7 이상에서 사용할 수 있습니다.
메모
이 섹션에 설명된 SQL MCP Server 2.0 기능은 현재 미리 보기로 제공되며 일반 공급 전에 변경될 수 있습니다. 자세한 내용은 버전 2.0의 새로운 기능입니다.
SQL MCP Server는 제네릭 DML(데이터 조작 언어) 도구를 통해 테이블과 뷰를 노출합니다. 저장 프로시저의 경우 더 나아가서 엔터티에서 설정 custom-tool: true 하여 프로시저가 MCP 도구 목록에 명명된 용도로 작성된 도구로 표시되도록 할 수 있습니다. AI 에이전트는 이름으로 검색하고, 설명을 확인하고, 직접 호출합니다. SQL이 필요하지 않습니다.
중요합니다
사용자 지정 도구 이름은 엔터티 이름에서 파생되지만 snake_case 변환됩니다. 예를 들어 이름이 GetProductById인 엔터티는 MCP 도구 목록에서 get_product_by_id로 변경됩니다. 도구를 호출할 때 snake_case 이름을 사용합니다. PascalCase 엔터티 이름은 도구 이름으로 허용되지 않습니다.
이 문서의 나머지 부분에는 저장 프로시저에서 지원되는 사용자 지정 MCP 도구를 추가, 구성 및 테스트하는 방법이 설명되어 있습니다.
사전 요구 사항
- 데이터 API 작성기 버전 2.0 이상
- 하나 이상의 저장 프로시저가 있는 SQL Server 데이터베이스
- MCP를 사용하도록 설정된 기존
dab-config.json항목 - DAB CLI 설치됨
구성에서 MCP 사용
아직 사용하지 않은 경우 런타임 섹션에서 MCP를 사용하도록 설정합니다.
dab configure --runtime.mcp.enabled true
dab-config.json에 다음이 추가됩니다.
{
"runtime": {
"mcp": {
"enabled": true
}
}
}
저장 프로시저를 사용자 지정 도구로 추가
dab add 및 --source.type stored-procedure 및 --mcp.custom-tool true 사용.
dab add GetProductById \
--source dbo.get_product_by_id \
--source.type "stored-procedure" \
--permissions "anonymous:execute" \
--mcp.custom-tool true
그러면 다음 엔터티가 dab-config.json에서 생성됩니다.
{
"entities": {
"GetProductById": {
"source": {
"object": "dbo.get_product_by_id",
"type": "stored-procedure"
},
"graphql": {
"enabled": true,
"operation": "mutation",
"type": {
"singular": "GetProductById",
"plural": "GetProductByIds"
}
},
"rest": {
"enabled": true,
"methods": [
"post"
]
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "execute"
}
]
}
],
"mcp": {
"custom-tool": true
}
}
}
}
중요합니다
이 custom-tool 속성은 저장 프로시저 엔터티에서만 유효합니다. 테이블 또는 뷰 엔터티에서 설정하면 시작 시 구성 오류가 발생합니다.
에이전트 정확도 향상을 위한 설명 추가
설명이 없으면 에이전트는 기술 이름 GetProductById만 볼 수 있습니다. 설명과 함께, 그들은 그것이 무엇을하고 언제 그것을 사용하는지 이해합니다.
dab update GetProductById \
--description "Returns full product details including pricing and inventory for a given product ID"
{
"entities": {
"GetProductById": {
"description": "Returns full product details including pricing and inventory for a given product ID",
"source": {
"object": "dbo.get_product_by_id",
"type": "stored-procedure"
},
"fields": [],
"graphql": {
"enabled": true,
"operation": "mutation",
"type": {
"singular": "GetProductById",
"plural": "GetProductByIds"
}
},
"rest": {
"enabled": true,
"methods": [
"post"
]
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "execute"
}
]
}
],
"mcp": {
"custom-tool": true
}
}
}
}
도구 목록에 도구가 표시되는지 확인합니다.
DAB를 시작하고 MCP 엔드포인트를 tools/list 호출하여 도구가 등록되어 있는지 확인합니다.
MCP 클라이언트가 호출 tools/list할 때 응답에는 DML 도구와 함께 사용자 지정 도구가 포함됩니다.
{
"tools": [
{
"name": "get_product_by_id",
"description": "Returns full product details including pricing and inventory for a given product ID",
"inputSchema": {
"type": "object",
"properties": {}
}
}
]
}
메모
도구 이름은 snake_case를 사용합니다(예를 들어, get_product_by_id는 GetProductById 엔터티에 사용됩니다).
inputSchema가 현재 빈 properties을(를) 반환합니다. 에이전트는 도구 설명과 describe_entities에 의존하여 올바른 매개 변수를 결정합니다.
여러 사용자 지정 도구 구성
여러 저장 프로시저를 동일한 구성에서 사용자 지정 도구로 등록할 수 있습니다.
dab add SearchProducts \
--source dbo.search_products \
--source.type "stored-procedure" \
--permissions "anonymous:execute" \
--mcp.custom-tool true \
--description "Full-text search across product names and descriptions"
dab add GetOrderSummary \
--source dbo.get_order_summary \
--source.type "stored-procedure" \
--permissions "authenticated:execute" \
--mcp.custom-tool true \
--description "Returns order totals and line item counts for a given customer"
도구를 호출할 수 있는 역할 제어
사용자 지정 도구는 다른 모든 DAB 엔터티와 동일한 RBAC(역할 기반 액세스 제어)를 준수합니다. 엔터티에서 프로시저를 실행할 수 있는 역할을 제한하도록 permissions를 설정합니다.
{
"entities": {
"GetOrderSummary": {
"source": {
"object": "dbo.get_order_summary",
"type": "stored-procedure"
},
"graphql": {
"enabled": true,
"operation": "mutation",
"type": {
"singular": "GetOrderSummary",
"plural": "GetOrderSummarys"
}
},
"rest": {
"enabled": true,
"methods": [
"post"
]
},
"permissions": [
{
"role": "authenticated",
"actions": [
{
"action": "execute"
}
]
}
],
"mcp": {
"custom-tool": true
}
}
}
}
에이전트가 anonymous 역할로 호출할 경우, get_order_summary은 tools/list에 나타나지 않으며, 직접 tools/call 하려 할 때 사용 권한 오류가 반환됩니다.
사용자 지정 도구를 제거하지 않고 사용하지 않도록 설정
custom-tool를 false로 설정하여 엔터티를 삭제하지 않고 에이전트에서 도구를 숨깁니다.
엔터티는 구성에 남아 있으며 --mcp.custom-tool true을(를) 설정하여 나중에 재사용할 수 있도록 설정할 수 있습니다.