sql-template-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| SUPABASE_URL | Yes | 你的 Supabase 项目 URL,格式如 https://your-project-ref.supabase.co | |
| NVIDIA_API_KEY | No | NVIDIA 免费 Embedding API 密钥(可选),用于语义检索。未配置时降级为纯关键词检索 | |
| SUPABASE_SERVICE_ROLE_KEY | Yes | Supabase 服务角色密钥,拥有绕过 RLS 的完整权限,仅限服务端/本地 MCP 使用 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| save_sql_templateA | 将一次生成的 SQL 步骤沉淀为模板,存入模板库(Supabase)。 参数:
返回:保存结果(含模板 id)或相似模板提示。 |
| search_sql_templateA | 在模板库中检索可复用的 SQL 模板(生成 SQL 前先调用,形成闭环)。 采用混合检索:语义向量召回(NVIDIA Embedding) + 关键词模糊匹配,按相似度/使用次数综合排序。 若未配置 NVIDIA_API_KEY,自动降级为纯关键词检索,不影响原有能力。 参数:
返回:匹配模板的 Markdown 列表(含 SQL 与验证状态,语义命中会标注相似度)。 |
| semantic_search_sql_templateA | 用语义向量召回模板,适合自然语言/口语化描述(如同义改写、业务意图)。 底层调用 schema.sql 的 match_sql_templates RPC(pgvector 余弦距离)。 需配置 NVIDIA_API_KEY;未配置或调用失败时返回降级提示。 参数:
返回:按语义相似度排序的模板 Markdown 列表(含相似度分值)。 |
| get_sql_templateA | 按 id 获取单个模板的完整内容。 |
| list_sql_templatesA | 列出模板库中的模板(可按分类/单据类型/验证状态过滤),用于总览。 |
| update_sql_templateB | 更新已有模板的字段(如补充验证标记、修正 SQL、补充执行过程伪代码)。
|
| delete_sql_templateB | 删除指定模板(清理错误/过期模板)。 |
| record_template_usageA | 记录某模板被实际使用一次(使用次数 +1,刷新最近使用时间)。 在技能复用模板生成最终 SQL 后调用,用于评估模板价值、优化检索排序。 |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 8 tools
The tools are mostly distinct: save/get/search/list/update/delete/record cover different CRUD and search operations. However, search_sql_template and semantic_search_sql_template overlap in purpose (both retrieve templates), though the descriptions clarify the semantic variant is for natural language queries. This slight overlap prevents a perfect score.
All tool names follow a consistent verb_noun pattern: save_sql_template, get_sql_template, search_sql_template, semantic_search_sql_template, list_sql_templates, update_sql_template, delete_sql_template, record_template_usage. The pattern is uniform and predictable, with clear verbs and the domain noun 'sql_template' (or plural in list).
With 8 tools, the server is well-scoped for a template management system. Each tool serves a distinct function: CRUD operations, two search modes, and usage tracking. This is within the ideal 3-15 range and feels complete without being bloated.
The tool surface covers the full lifecycle of SQL templates: create (save), read (get, search, list), update, delete, and usage tracking. The two search modes (keyword and semantic) address different retrieval needs. No obvious gaps exist for the stated purpose of managing a template library.