@lexq/cli 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +49 -44
- package/dist/index.js.map +1 -1
- package/dist/mcp/register.d.ts +32 -0
- package/dist/mcp/register.js +960 -0
- package/dist/mcp/register.js.map +1 -0
- package/package.json +8 -1
package/dist/index.js
CHANGED
|
@@ -1885,32 +1885,31 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
1885
1885
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
1886
1886
|
|
|
1887
1887
|
// src/mcp/tools/_shared.ts
|
|
1888
|
-
function
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1888
|
+
function createCallApiFromConfig() {
|
|
1889
|
+
return async (method, path, opts) => {
|
|
1890
|
+
try {
|
|
1891
|
+
const config = loadConfig();
|
|
1892
|
+
const clientOpts = {
|
|
1893
|
+
apiKey: config.apiKey,
|
|
1894
|
+
baseUrl: config.baseUrl
|
|
1895
|
+
};
|
|
1896
|
+
const data = await apiRequest(method, path, {
|
|
1897
|
+
...clientOpts,
|
|
1898
|
+
body: opts?.body,
|
|
1899
|
+
params: opts?.params
|
|
1900
|
+
});
|
|
1901
|
+
return {
|
|
1902
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
|
|
1903
|
+
};
|
|
1904
|
+
} catch (error) {
|
|
1905
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1906
|
+
return {
|
|
1907
|
+
content: [{ type: "text", text: JSON.stringify({ error: message }) }],
|
|
1908
|
+
isError: true
|
|
1909
|
+
};
|
|
1910
|
+
}
|
|
1893
1911
|
};
|
|
1894
1912
|
}
|
|
1895
|
-
async function callApi(method, path, opts) {
|
|
1896
|
-
try {
|
|
1897
|
-
const clientOpts = getMcpClientOptions();
|
|
1898
|
-
const data = await apiRequest(method, path, {
|
|
1899
|
-
...clientOpts,
|
|
1900
|
-
body: opts?.body,
|
|
1901
|
-
params: opts?.params
|
|
1902
|
-
});
|
|
1903
|
-
return {
|
|
1904
|
-
content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
|
|
1905
|
-
};
|
|
1906
|
-
} catch (error) {
|
|
1907
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
1908
|
-
return {
|
|
1909
|
-
content: [{ type: "text", text: JSON.stringify({ error: message }) }],
|
|
1910
|
-
isError: true
|
|
1911
|
-
};
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
1913
|
function paginationParams(page, size) {
|
|
1915
1914
|
const params = {};
|
|
1916
1915
|
if (page !== void 0) params.page = String(page);
|
|
@@ -1919,7 +1918,7 @@ function paginationParams(page, size) {
|
|
|
1919
1918
|
}
|
|
1920
1919
|
|
|
1921
1920
|
// src/mcp/tools/status.ts
|
|
1922
|
-
function registerStatusTools(server) {
|
|
1921
|
+
function registerStatusTools(server, callApi) {
|
|
1923
1922
|
server.registerTool(
|
|
1924
1923
|
"lexq_whoami",
|
|
1925
1924
|
{
|
|
@@ -1933,7 +1932,7 @@ function registerStatusTools(server) {
|
|
|
1933
1932
|
|
|
1934
1933
|
// src/mcp/tools/groups.ts
|
|
1935
1934
|
import { z } from "zod";
|
|
1936
|
-
function registerGroupTools(server) {
|
|
1935
|
+
function registerGroupTools(server, callApi) {
|
|
1937
1936
|
server.registerTool(
|
|
1938
1937
|
"lexq_groups_list",
|
|
1939
1938
|
{
|
|
@@ -2068,7 +2067,7 @@ function registerGroupTools(server) {
|
|
|
2068
2067
|
|
|
2069
2068
|
// src/mcp/tools/versions.ts
|
|
2070
2069
|
import { z as z2 } from "zod";
|
|
2071
|
-
function registerVersionTools(server) {
|
|
2070
|
+
function registerVersionTools(server, callApi) {
|
|
2072
2071
|
server.registerTool(
|
|
2073
2072
|
"lexq_versions_list",
|
|
2074
2073
|
{
|
|
@@ -2160,7 +2159,7 @@ function registerVersionTools(server) {
|
|
|
2160
2159
|
|
|
2161
2160
|
// src/mcp/tools/rules.ts
|
|
2162
2161
|
import { z as z3 } from "zod";
|
|
2163
|
-
function registerRuleTools(server) {
|
|
2162
|
+
function registerRuleTools(server, callApi) {
|
|
2164
2163
|
server.registerTool(
|
|
2165
2164
|
"lexq_rules_list",
|
|
2166
2165
|
{
|
|
@@ -2312,7 +2311,7 @@ Types: DISCOUNT, POINT, COUPON_ISSUE, BLOCK, NOTIFICATION, WEBHOOK, SET_FACT, AD
|
|
|
2312
2311
|
|
|
2313
2312
|
// src/mcp/tools/facts.ts
|
|
2314
2313
|
import { z as z4 } from "zod";
|
|
2315
|
-
function registerFactTools(server) {
|
|
2314
|
+
function registerFactTools(server, callApi) {
|
|
2316
2315
|
server.registerTool(
|
|
2317
2316
|
"lexq_facts_list",
|
|
2318
2317
|
{
|
|
@@ -2374,7 +2373,7 @@ function registerFactTools(server) {
|
|
|
2374
2373
|
|
|
2375
2374
|
// src/mcp/tools/deploy.ts
|
|
2376
2375
|
import { z as z5 } from "zod";
|
|
2377
|
-
function registerDeployTools(server) {
|
|
2376
|
+
function registerDeployTools(server, callApi) {
|
|
2378
2377
|
server.registerTool(
|
|
2379
2378
|
"lexq_deploy_publish",
|
|
2380
2379
|
{
|
|
@@ -2478,7 +2477,7 @@ function registerDeployTools(server) {
|
|
|
2478
2477
|
|
|
2479
2478
|
// src/mcp/tools/analytics.ts
|
|
2480
2479
|
import { z as z6 } from "zod";
|
|
2481
|
-
function registerAnalyticsTools(server) {
|
|
2480
|
+
function registerAnalyticsTools(server, callApi) {
|
|
2482
2481
|
server.registerTool(
|
|
2483
2482
|
"lexq_dry_run",
|
|
2484
2483
|
{
|
|
@@ -2617,7 +2616,7 @@ Example body:
|
|
|
2617
2616
|
|
|
2618
2617
|
// src/mcp/tools/history.ts
|
|
2619
2618
|
import { z as z7 } from "zod";
|
|
2620
|
-
function registerHistoryTools(server) {
|
|
2619
|
+
function registerHistoryTools(server, callApi) {
|
|
2621
2620
|
server.registerTool(
|
|
2622
2621
|
"lexq_history_list",
|
|
2623
2622
|
{
|
|
@@ -2679,7 +2678,7 @@ function registerHistoryTools(server) {
|
|
|
2679
2678
|
|
|
2680
2679
|
// src/mcp/tools/integrations.ts
|
|
2681
2680
|
import { z as z8 } from "zod";
|
|
2682
|
-
function registerIntegrationTools(server) {
|
|
2681
|
+
function registerIntegrationTools(server, callApi) {
|
|
2683
2682
|
server.registerTool(
|
|
2684
2683
|
"lexq_integrations_list",
|
|
2685
2684
|
{
|
|
@@ -2752,7 +2751,7 @@ function registerIntegrationTools(server) {
|
|
|
2752
2751
|
|
|
2753
2752
|
// src/mcp/tools/logs.ts
|
|
2754
2753
|
import { z as z9 } from "zod";
|
|
2755
|
-
function registerLogTools(server) {
|
|
2754
|
+
function registerLogTools(server, callApi) {
|
|
2756
2755
|
server.registerTool(
|
|
2757
2756
|
"lexq_logs_list",
|
|
2758
2757
|
{
|
|
@@ -2821,6 +2820,20 @@ function registerLogTools(server) {
|
|
|
2821
2820
|
);
|
|
2822
2821
|
}
|
|
2823
2822
|
|
|
2823
|
+
// src/mcp/register.ts
|
|
2824
|
+
function registerAllTools(server, callApi) {
|
|
2825
|
+
registerStatusTools(server, callApi);
|
|
2826
|
+
registerGroupTools(server, callApi);
|
|
2827
|
+
registerVersionTools(server, callApi);
|
|
2828
|
+
registerRuleTools(server, callApi);
|
|
2829
|
+
registerFactTools(server, callApi);
|
|
2830
|
+
registerDeployTools(server, callApi);
|
|
2831
|
+
registerAnalyticsTools(server, callApi);
|
|
2832
|
+
registerHistoryTools(server, callApi);
|
|
2833
|
+
registerIntegrationTools(server, callApi);
|
|
2834
|
+
registerLogTools(server, callApi);
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2824
2837
|
// src/mcp/server.ts
|
|
2825
2838
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
2826
2839
|
function getVersion() {
|
|
@@ -2838,16 +2851,8 @@ async function startMcpServer() {
|
|
|
2838
2851
|
name: "lexq",
|
|
2839
2852
|
version: getVersion()
|
|
2840
2853
|
});
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
registerVersionTools(server);
|
|
2844
|
-
registerRuleTools(server);
|
|
2845
|
-
registerFactTools(server);
|
|
2846
|
-
registerDeployTools(server);
|
|
2847
|
-
registerAnalyticsTools(server);
|
|
2848
|
-
registerHistoryTools(server);
|
|
2849
|
-
registerIntegrationTools(server);
|
|
2850
|
-
registerLogTools(server);
|
|
2854
|
+
const callApi = createCallApiFromConfig();
|
|
2855
|
+
registerAllTools(server, callApi);
|
|
2851
2856
|
const transport = new StdioServerTransport();
|
|
2852
2857
|
await server.connect(transport);
|
|
2853
2858
|
}
|