{"id":29114076,"url":"https://github.com/focussearch/focus_mcp_sql","last_synced_at":"2025-06-29T11:08:02.098Z","repository":{"id":278359000,"uuid":"935347654","full_name":"FocusSearch/focus_mcp_sql","owner":"FocusSearch","description":"A NL2SQL plugin based on FocusSearch keyword parsing, offering greater accuracy, higher speed, and more reliability!","archived":false,"fork":false,"pushed_at":"2025-04-14T06:59:23.000Z","size":855,"stargazers_count":27,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-17T13:15:46.100Z","etag":null,"topics":["nl2sql","text2sql"],"latest_commit_sha":null,"homepage":"https://www.datafocus.ai","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FocusSearch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-19T09:51:26.000Z","updated_at":"2025-06-14T02:31:09.000Z","dependencies_parsed_at":"2025-04-14T07:33:59.818Z","dependency_job_id":"34068d29-8a53-431b-8b0f-310bb3a39a04","html_url":"https://github.com/FocusSearch/focus_mcp_sql","commit_stats":null,"previous_names":["focussearch/focus_mcp_sql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FocusSearch/focus_mcp_sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FocusSearch%2Ffocus_mcp_sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FocusSearch%2Ffocus_mcp_sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FocusSearch%2Ffocus_mcp_sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FocusSearch%2Ffocus_mcp_sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FocusSearch","download_url":"https://codeload.github.com/FocusSearch/focus_mcp_sql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FocusSearch%2Ffocus_mcp_sql/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262581395,"owners_count":23331914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nl2sql","text2sql"],"created_at":"2025-06-29T11:06:04.226Z","updated_at":"2025-06-29T11:08:02.082Z","avatar_url":"https://github.com/FocusSearch.png","language":"Java","readme":"# FOCUS DATA MCP Server [[中文](./README_CN.md)]\n\nA Model Context Protocol (MCP) server enables artificial intelligence assistants to convert natural language into SQL statements.\n\n# There are already so many Text-to-SQL frameworks. Why do we still need another one?\n\nIn simple terms, focus_mcp_sql adopts a two-step SQL generation solution, which enables control over the hallucinations of LLM and truly builds the trust of non-technical users in the generated SQL results.\n\nBelow is the comparison table between focus_mcp_sql and others:\n\n#### Comparison Analysis Table  \nHere’s a side-by-side comparison of focus_mcp_sql with other LLM-based frameworks:\n\n| Feature            | Traditional LLM Frameworks | focus_mcp_sql              |\n|--------------------|----------------------------|----------------------------|\n| Generation Process | Black box, direct SQL generation | Transparent, two-step (keywords + SQL) |\n| Hallucination Risk | High, depends on model quality | Low, controllable (keyword verification) |\n| Speed              | Slow, relies on large model inference | Fast, deterministic keyword-to-SQL |\n| Cost               | High, requires advanced models | Low, reduces reliance on large models |\n| Non-Technical User Friendliness | Low, hard to verify results | High, easy keyword checking |\n\n## Features\n\n-Initialize the model\n-Convert natural language to SQL statements\n\n## Prerequisites\n\n- jdk 23 or higher. Download [jdk](https://www.oracle.com/java/technologies/downloads/)\n- gradle 8.12 or higher. Download [gradle](https://gradle.org/install/)\n- register [Datafocus](https://www.datafocus.ai/) to obtain bearer token: \n    1. Register an account in [Datafocus](https://www.datafocus.ai/)\n    2. Create an application\n    3. Enter the application\n    4. Admin -\u003e Interface authentication -\u003e Bearer Token -\u003e New Bearer Token\n       ![bearer token](bearer_token.png)\n\n## Installation\n\n1. Clone this repository:\n\n```bash\ngit clone https://github.com/FocusSearch/focus_mcp_sql.git\ncd focus_mcp_sql\n```\n\n2. Build the server:\n\n```bash\ngradle clean\ngradle bootJar\n\nThe jar path: build/libs/focus_mcp_sql.jar\n```\n\n## MCP Configuration\n\nAdd the server to your MCP settings file:\n\n```json\n{\n  \"mcpServers\": {\n    \"focus_mcp_data\": {\n      \"command\": \"java\",\n      \"args\": [\n        \"-jar\",\n        \"path/to/focus_mcp_sql/focus_mcp_sql.jar\"\n      ],\n      \"autoApprove\": [\n        \"gptText2sqlStart\",\n        \"gptText2sqlChat\"\n      ]\n    }\n  }\n}\n```\n\n## Available Tools\n\n### 1. gptText2sqlStart\n\ninitial model.\n\n**Parameters:**\n\n- `model` (required): table model\n- `bearer` (required): bearer token\n- `language` (optional): language ['english','chinese']\n\n**Example:**\n\n```json\n{\n  \"model\": {\n    \"tables\": [\n      {\n        \"columns\": [\n          {\n            \"columnDisplayName\": \"name\",\n            \"dataType\": \"string\",\n            \"aggregation\": \"\",\n            \"columnName\": \"name\"\n          },\n          {\n            \"columnDisplayName\": \"address\",\n            \"dataType\": \"string\",\n            \"aggregation\": \"\",\n            \"columnName\": \"address\"\n          },\n          {\n            \"columnDisplayName\": \"age\",\n            \"dataType\": \"int\",\n            \"aggregation\": \"SUM\",\n            \"columnName\": \"age\"\n          },\n          {\n            \"columnDisplayName\": \"date\",\n            \"dataType\": \"timestamp\",\n            \"aggregation\": \"\",\n            \"columnName\": \"date\"\n          }\n        ],\n        \"tableDisplayName\": \"test\",\n        \"tableName\": \"test\"\n      }\n    ],\n    \"relations\": [\n\n    ],\n    \"type\": \"mysql\",\n    \"version\": \"8.0\"\n  },\n  \"bearer\": \"ZTllYzAzZjM2YzA3NDA0ZGE3ZjguNDJhNDjNGU4NzkyYjY1OTY0YzUxYWU5NmU=\"\n}\n```\n\nmodel 参数说明：\n\n|名称|位置|类型|必选|说明|\n|---|---|---|---|---|\n| model|body|object| 是 |none|\n|» type|body|string| 是 |数据库类型|\n|» version|body|string| 是 |数据库版本|\n|» tables|body|[object]| 是 |表结构列表|\n|»» tableDisplayName|body|string| 否 |表显示名|\n|»» tableName|body|string| 否 |表原始名|\n|»» columns|body|[object]| 否 |表列列表|\n|»»» columnDisplayName|body|string| 是 |列显示名|\n|»»» columnName|body|string| 是 |列原始名|\n|»»» dataType|body|string| 是 |列数据类型|\n|»»» aggregation|body|string| 是 |列聚合方式|\n|» relations|body|[object]| 是 |表关联关系列表|\n|»» conditions|body|[object]| 否 |关联条件|\n|»»» dstColName|body|string| 否 |dimension 表关联列原始名|\n|»»» srcColName|body|string| 否 |fact 表关联列原始名|\n|»» dimensionTable|body|string| 否 |dimension 表原始名|\n|»» factTable|body|string| 否 |fact 表原始名|\n|»» joinType|body|string| 否 |关联类型|\n\n### 2. gptText2sqlChat\n\nConvert natural language to SQL.\n\n**Parameters:**\n\n- `chatId` (required): chat id\n- `input` (required): Natural language\n- `bearer` (required): bearer token\n\n**Example:**\n\n```json\n{\n  \"chatId\": \"03975af5de4b4562938a985403f206d4\",\n  \"input\": \"what is the max age\",\n  \"bearer\": \"ZTllYzAzZjM2YzA3NDA0ZGE3ZjguNDJhNDjNGU4NzkyYjY1OTY0YzUxYWU5NmU=\"\n}\n```\n\n## Response Format\n\nAll tools return responses in the following format:\n\n```json\n{\n  \"errCode\": 0,\n  \"exception\": \"\",\n  \"msgParams\": null,\n  \"promptMsg\": null,\n  \"success\": true,\n  \"data\": {\n  }\n}\n```\n\n## Visual Studio Code Cline Sample\n\n1. vsCode install cline plugin\n2. mcp server config\n   ![config mcp server](./mcp_server_config.png)\n3. use\n    1. initial model\n       ![initial model1](./focus_mcp_sql_init_1.png)\n       ![initial model2](./focus_mcp_sql_init_2.png)\n    2. transfer: what is the max age\n       ![chat](./focus_mcp_sql_chat.png)\n\n## Contact：\n[https://discord.gg/mFa3yeq9](https://discord.gg/AVufPnpaad )\n![Datafocus](./wechat-qrcode.png)\n","funding_links":[],"categories":["Data Science Tools"],"sub_categories":["How to Submit"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffocussearch%2Ffocus_mcp_sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffocussearch%2Ffocus_mcp_sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffocussearch%2Ffocus_mcp_sql/lists"}