datafocus-natural-language-access
Facilitates AI agents in performing data result lookups using conversational language by interfacing directly with DataFocus repositories. Permits the setup of data table interactions for semantic data retrieval.
Author

FocusSearch
Quick Info
Actions
Tags
DataFocus Data Interface MCP Module [中文说明]
A Model Context Protocol (MCP) service allows intelligent digital assistants to directly interrogate data outcomes. Users gain access to information stored within DataFocus utilizing standard human language queries.
Core Capabilities
- Provision DataFocus access by establishing an application workspace, then importing (establishing a live link to) the target data sets for analysis.
- Initiate the dedicated dialogue interface for DataFocus data table engagement.
- Retrieval of analytical results derived from natural language instructions.
Necessary Prerequisites
- Java Development Kit (JDK) version 23 or newer. Obtain JDK from here
- Gradle build tool version 8.12 or newer. Installation guide for Gradle
- Secure a credential token from Datafocus via Bearer Token:
- Register an account at Datafocus
- Create a dedicated application instance
- Navigate into the application environment
- Access Admin settings -> Interface Authentication -> Bearer Token management -> Generate a New Bearer Token
Deployment Procedure
- Obtain the source code repository:
git clone https://github.com/FocusSearch/focus_mcp_data.git
cd focus_mcp_data
- Compile and package the server application:
gradle clean
gradle bootJar
Output JAR Location: build/libs/focus_mcp_data.jar
MCP Configuration Setup
Integrate this service into your primary MCP configuration file (commonly located at ~/AppData/Roaming/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json):
{
"mcpServers": {
"datafocus-natural-language-access": {
"command": "java",
"args": [
"-jar",
"path/to/focus_mcp_data/focus_mcp_data.jar"
],
"autoApprove": [
"tableList",
"gptText2DataInit",
"gptText2DataData"
]
}
}
}
Exposed Interface Functions
1. tableList
Retrieves the catalog of available tables within the DataFocus environment.
Input Arguments:
name(Optional): A string used to filter the returned table names.bearer(Mandatory): The authentication bearer token required for access.
Usage Example:
{
"name": "user_records",
"bearer": "ZTllYzAzZjM2YzA3NDA0ZGE3ZjguNDJhNDjNGU4NzkyYjY1OTY0YzUxYWU5NmU="
}
2. gptText2DataInit
Initiates a new conversational context linked to specified data tables.
Input Arguments:
names(Mandatory): An array containing the identifiers of the chosen tables.bearer(Mandatory): The required authentication bearer token.language(Optional): Specifies the preferred language setting ['english','chinese'].
Usage Example:
{
"names": [
"sales_data_q1",
"product_inventory"
],
"bearer": "ZTllYzAzZjM2YzA3NDA0ZGE3ZjguNDJhNDjNGU4NzkyYjY1OTY0YzUxYWU5NmU="
}
3. gptText2DataData
Executes a query against the active data session using a natural language prompt.
Input Arguments:
chatId(Mandatory): The unique identifier for the current interaction session.input(Mandatory): The natural language expression of the desired data operation.bearer(Mandatory): The necessary bearer token for authorization.
Usage Example:
{
"chatId": "03975af5de4b4562938a985403f206d4",
"input": "calculate the average compensation across all employees",
"bearer": "ZTllYzAzZjM2YzA3NDA0ZGE3ZjguNDJhNDjNGU4NzkyYjY1OTY0YzUxYWU5NmU="
}
Standardized Output Structure
All function calls yield responses adhering to the following structured format:
{
"errCode": 0,
"exception": "",
"msgParams": null,
"promptMsg": null,
"success": true,
"data": {
}
}
Example Workflow in VS Code Cline
- Install the Cline extension within VS Code.
-
Configure the MCP service settings (as detailed above).
-
Execute steps sequentially:
-
Request the list of available tables.
-
Establish the interactive dialogue session.
-
Submit a query: 'What is the total payroll expenditure?'
-
Support Channel:
https://discord.gg/mFa3yeq9 WIKIPEDIA REFERENCE: XMLHttpRequest (XHR) defines an API consisting of a JavaScript object. Its methods are used to transmit HTTP requests from a web client (browser) to a remote server. These methods allow a web application to send server requests asynchronously after the initial page load and receive information back without refreshing the entire page. XMLHttpRequest is fundamental to the implementation of Ajax programming patterns. Prior to Ajax, server interaction primarily relied on traditional hyperlinks and form submissions, which typically resulted in a full-page refresh.
== Historical Context ==
The underlying concept for XMLHttpRequest was first proposed in 2000 by the development team behind Microsoft Outlook. This concept was subsequently integrated into Internet Explorer 5 (released in 1999). However, the initial invocation syntax did not use the standardized XMLHttpRequest object name; developers utilized ActiveXObject("Msxml2.XMLHTTP") or ActiveXObject("Microsoft.XMLHTTP") instead. By the release of Internet Explorer 7 (2006), all major browsers had adopted the consistent XMLHttpRequest identifier.
Today, the XMLHttpRequest identifier is the universally accepted standard across leading browser engines, including Mozilla's Gecko (since 2002), Apple's Safari 1.2 (2004), and Opera 8.0 (2005).
=== Standardization Efforts === The World Wide Web Consortium (W3C) issued the first Working Draft specification for the XMLHttpRequest object on April 5, 2006. A subsequent Working Draft, Level 2, was published by the W3C on February 25, 2008. Level 2 introduced enhanced functionality, such as mechanisms to monitor request progress, support for cross-site requests, and capabilities for handling binary byte streams. By the close of 2011, the Level 2 feature set was formally merged back into the main specification. Development responsibilities transitioned to the WHATWG organization at the end of 2012, which now maintains the living document using Web IDL definitions.
== Implementation Steps == Executing a network request using XMLHttpRequest generally involves several distinct programming steps.
- Instantiate an XMLHttpRequest object by invoking its constructor:
- Invoke the "open" method to define the request method (GET/POST, etc.), specify the target URI, and choose between synchronous or asynchronous execution mode:
- For asynchronous operations, attach an event listener function designed to handle notifications when the request state changes:
- Trigger the transmission of the request by calling the "send" method, optionally passing data to be uploaded:
- Process state changes within the registered event handler. Upon successful receipt of response data from the server, it is typically accessible via the "responseText" attribute. When processing concludes, the object transitions to state 4, marking the "done" state. Beyond these core steps, XMLHttpRequest offers numerous controls for fine-tuning request submission and response handling. Custom header fields can be inserted to direct server behavior, and data can be uploaded via the "send" call. Responses arriving in JSON format can be automatically parsed into native JavaScript objects, or they can be processed incrementally as chunks arrive, avoiding waiting for the full payload. Furthermore, requests can be terminated early or configured with a timeout to prevent indefinite blocking.
