Cover image
Try Now
2025-04-14

A NL2SQL plugin based on FocusSearch keyword parsing, offering greater accuracy, higher speed, and more reliability!

3 years

Works with Finder

2

Github Watches

1

Github Forks

11

Github Stars

FOCUS DATA MCP Server [中文]

A Model Context Protocol (MCP) server enables artificial intelligence assistants to convert natural language into SQL statements.

There are already so many Text-to-SQL frameworks. Why do we still need another one?

In 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.

Below is the comparison table between focus_mcp_sql and others:

Comparison Analysis Table

Here’s a side-by-side comparison of focus_mcp_sql with other LLM-based frameworks:

Feature Traditional LLM Frameworks focus_mcp_sql
Generation Process Black box, direct SQL generation Transparent, two-step (keywords + SQL)
Hallucination Risk High, depends on model quality Low, controllable (keyword verification)
Speed Slow, relies on large model inference Fast, deterministic keyword-to-SQL
Cost High, requires advanced models Low, reduces reliance on large models
Non-Technical User Friendliness Low, hard to verify results High, easy keyword checking

Features

-Initialize the model -Convert natural language to SQL statements

Prerequisites

  • jdk 23 or higher. Download jdk
  • gradle 8.12 or higher. Download gradle
  • register Datafocus to obtain bearer token:
    1. Register an account in Datafocus
    2. Create an application
    3. Enter the application
    4. Admin -> Interface authentication -> Bearer Token -> New Bearer Token bearer token

Installation

  1. Clone this repository:
git clone https://github.com/FocusSearch/focus_mcp_sql.git
cd focus_mcp_sql
  1. Build the server:
gradle clean
gradle bootJar

The jar path: build/libs/focus_mcp_sql.jar

MCP Configuration

Add the server to your MCP settings file:

{
  "mcpServers": {
    "focus_mcp_data": {
      "command": "java",
      "args": [
        "-jar",
        "path/to/focus_mcp_sql/focus_mcp_sql.jar"
      ],
      "autoApprove": [
        "gptText2sqlStart",
        "gptText2sqlChat"
      ]
    }
  }
}

Available Tools

1. gptText2sqlStart

initial model.

Parameters:

  • model (required): table model
  • bearer (required): bearer token
  • language (optional): language ['english','chinese']

Example:

{
  "model": {
    "tables": [
      {
        "columns": [
          {
            "columnDisplayName": "name",
            "dataType": "string",
            "aggregation": "",
            "columnName": "name"
          },
          {
            "columnDisplayName": "address",
            "dataType": "string",
            "aggregation": "",
            "columnName": "address"
          },
          {
            "columnDisplayName": "age",
            "dataType": "int",
            "aggregation": "SUM",
            "columnName": "age"
          },
          {
            "columnDisplayName": "date",
            "dataType": "timestamp",
            "aggregation": "",
            "columnName": "date"
          }
        ],
        "tableDisplayName": "test",
        "tableName": "test"
      }
    ],
    "relations": [

    ],
    "type": "mysql",
    "version": "8.0"
  },
  "bearer": "ZTllYzAzZjM2YzA3NDA0ZGE3ZjguNDJhNDjNGU4NzkyYjY1OTY0YzUxYWU5NmU="
}

model 参数说明:

名称 位置 类型 必选 说明
model body object none
» type body string 数据库类型
» version body string 数据库版本
» tables body [object] 表结构列表
»» tableDisplayName body string 表显示名
»» tableName body string 表原始名
»» columns body [object] 表列列表
»»» columnDisplayName body string 列显示名
»»» columnName body string 列原始名
»»» dataType body string 列数据类型
»»» aggregation body string 列聚合方式
» relations body [object] 表关联关系列表
»» conditions body [object] 关联条件
»»» dstColName body string dimension 表关联列原始名
»»» srcColName body string fact 表关联列原始名
»» dimensionTable body string dimension 表原始名
»» factTable body string fact 表原始名
»» joinType body string 关联类型

2. gptText2sqlChat

Convert natural language to SQL.

Parameters:

  • chatId (required): chat id
  • input (required): Natural language
  • bearer (required): bearer token

Example:

{
  "chatId": "03975af5de4b4562938a985403f206d4",
  "input": "what is the max age",
  "bearer": "ZTllYzAzZjM2YzA3NDA0ZGE3ZjguNDJhNDjNGU4NzkyYjY1OTY0YzUxYWU5NmU="
}

Response Format

All tools return responses in the following format:

{
  "errCode": 0,
  "exception": "",
  "msgParams": null,
  "promptMsg": null,
  "success": true,
  "data": {
  }
}

Visual Studio Code Cline Sample

  1. vsCode install cline plugin
  2. mcp server config config mcp server
  3. use
    1. initial model initial model1 initial model2
    2. transfer: what is the max age chat

Contact:

https://discord.gg/mFa3yeq9 Datafocus

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • https://tovuti.be
  • Oede knorrepot die vasthoudt an de goeie ouwe tied van 't boerenleven

  • Gil kaminski
  • Make sure you are post-ready before you post on social media

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • momi
  • Provides initial medical assessments and advice.

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • Daren White
  • A supportive coach for mastering all Spanish tenses.

  • WILLIAM JOEL FOTEPING
  • Friendly music guide for 60s-2000s songs, with links to listen online.

  • huahuayu
  • A unified API gateway for integrating multiple etherscan-like blockchain explorer APIs with Model Context Protocol (MCP) support for AI assistants.

  • deemkeen
  • control your mbot2 with a power combo: mqtt+mcp+llm

  • zhaoyunxing92
  • 本项目是一个钉钉MCP(Message Connector Protocol)服务,提供了与钉钉企业应用交互的API接口。项目基于Go语言开发,支持员工信息查询和消息发送等功能。

  • ShrimpingIt
  • Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx

  • justmywyw
  • Short and sweet example MCP server / client implementation for Tools, Resources and Prompts.

    Reviews

    4.3 (4)
    Avatar
    user_OkHG1c1z
    2025-04-17

    As a loyal user of focus_mcp_sql by FocusSearch, I am amazed by its robust performance and user-friendly interface. It has significantly streamlined my database management tasks and improved overall efficiency. I highly recommend it to anyone looking for a reliable SQL solution. Check it out at https://github.com/FocusSearch/focus_mcp_sql.

    Avatar
    user_f3WNrgUU
    2025-04-17

    I have been using focus_mcp_sql for my SQL management needs, and it has significantly improved my workflow. Its robust features and user-friendly interface make database handling a breeze. Kudos to FocusSearch for creating such an effective tool. Highly recommended for anyone working with SQL!

    Avatar
    user_Wq0qBbqm
    2025-04-17

    I've been using focus_mcp_sql for a while now, and it has significantly improved my SQL experience. The interface is user-friendly, and the performance is impressive. Kudos to FocusSearch for developing such a robust tool. Highly recommend for anyone looking to optimize their SQL querying! Check it out at https://github.com/FocusSearch/focus_mcp_sql.

    Avatar
    user_t5qz8AIb
    2025-04-17

    I've been using focus_mcp_sql from FocusSearch and it has been a game-changer for my database management tasks. The tool is intuitive and powerful, making SQL querying and manipulation a breeze. Highly recommend to anyone in need of an efficient and reliable SQL application! Check it out at https://github.com/FocusSearch/focus_mcp_sql.