@chaprola/mcp-server 1.1.0 → 1.3.0
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 +77 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -489,6 +489,46 @@ server.tool("chaprola_merge", "Merge two sorted data files into one. Both must s
|
|
|
489
489
|
const res = await authedFetch("/merge", { userid: username, project, file_a, file_b, output, key });
|
|
490
490
|
return textResult(res);
|
|
491
491
|
}));
|
|
492
|
+
// --- Schema: Format + Alter ---
|
|
493
|
+
server.tool("chaprola_format", "Inspect a data file's schema — returns field names, positions, lengths, types, and PHI flags", {
|
|
494
|
+
project: z.string().describe("Project name"),
|
|
495
|
+
name: z.string().describe("Data file name (without .F extension)"),
|
|
496
|
+
}, async ({ project, name }) => withBaaCheck(async () => {
|
|
497
|
+
const { username } = getCredentials();
|
|
498
|
+
const res = await authedFetch("/format", { userid: username, project, name });
|
|
499
|
+
return textResult(res);
|
|
500
|
+
}));
|
|
501
|
+
server.tool("chaprola_alter", "Modify a data file's schema: widen/narrow/rename fields, add new fields, drop fields. Transforms existing data to match the new schema.", {
|
|
502
|
+
project: z.string().describe("Project name"),
|
|
503
|
+
name: z.string().describe("Data file name (without extension)"),
|
|
504
|
+
alter: z.array(z.object({
|
|
505
|
+
field: z.string().describe("Field name to modify"),
|
|
506
|
+
width: z.number().optional().describe("New width (widen or narrow)"),
|
|
507
|
+
rename: z.string().optional().describe("New field name"),
|
|
508
|
+
type: z.enum(["text", "numeric"]).optional().describe("Change field type"),
|
|
509
|
+
})).optional().describe("Fields to alter"),
|
|
510
|
+
add: z.array(z.object({
|
|
511
|
+
name: z.string().describe("New field name"),
|
|
512
|
+
width: z.number().describe("Field width"),
|
|
513
|
+
type: z.enum(["text", "numeric"]).optional().describe("Field type (default: text)"),
|
|
514
|
+
after: z.string().optional().describe("Insert after this field (default: end)"),
|
|
515
|
+
})).optional().describe("Fields to add"),
|
|
516
|
+
drop: z.array(z.string()).optional().describe("Field names to drop"),
|
|
517
|
+
output: z.string().optional().describe("Output file name (default: in-place)"),
|
|
518
|
+
}, async ({ project, name, alter, add, drop, output }) => withBaaCheck(async () => {
|
|
519
|
+
const { username } = getCredentials();
|
|
520
|
+
const body = { userid: username, project, name };
|
|
521
|
+
if (alter)
|
|
522
|
+
body.alter = alter;
|
|
523
|
+
if (add)
|
|
524
|
+
body.add = add;
|
|
525
|
+
if (drop)
|
|
526
|
+
body.drop = drop;
|
|
527
|
+
if (output)
|
|
528
|
+
body.output = output;
|
|
529
|
+
const res = await authedFetch("/alter", body);
|
|
530
|
+
return textResult(res);
|
|
531
|
+
}));
|
|
492
532
|
// --- Optimize (HULDRA) ---
|
|
493
533
|
server.tool("chaprola_optimize", "Run HULDRA nonlinear optimization using a compiled .PR as the objective evaluator", {
|
|
494
534
|
project: z.string().describe("Project name"),
|
|
@@ -625,6 +665,43 @@ server.tool("chaprola_schedule_delete", "Delete a scheduled job by name", {
|
|
|
625
665
|
const res = await authedFetch("/schedule/delete", { name });
|
|
626
666
|
return textResult(res);
|
|
627
667
|
}));
|
|
668
|
+
// --- Record CRUD ---
|
|
669
|
+
server.tool("chaprola_insert_record", "Insert a new record into a data file's merge file (.MRG). The record appears at the end of the file until consolidation.", {
|
|
670
|
+
project: z.string().describe("Project name"),
|
|
671
|
+
file: z.string().describe("Data file name (without extension)"),
|
|
672
|
+
record: z.record(z.string()).describe("Field name → value pairs. Unspecified fields default to blanks."),
|
|
673
|
+
}, async ({ project, file, record }) => withBaaCheck(async () => {
|
|
674
|
+
const { username } = getCredentials();
|
|
675
|
+
const res = await authedFetch("/insert-record", { userid: username, project, file, record });
|
|
676
|
+
return textResult(res);
|
|
677
|
+
}));
|
|
678
|
+
server.tool("chaprola_update_record", "Update fields in a single record matched by a where clause. If no sort-key changes, updates in place; otherwise marks old record ignored and appends to merge file.", {
|
|
679
|
+
project: z.string().describe("Project name"),
|
|
680
|
+
file: z.string().describe("Data file name (without extension)"),
|
|
681
|
+
where: z.record(z.string()).describe("Field name → value pairs to identify exactly one record"),
|
|
682
|
+
set: z.record(z.string()).describe("Field name → new value pairs to update"),
|
|
683
|
+
}, async ({ project, file, where: whereClause, set }) => withBaaCheck(async () => {
|
|
684
|
+
const { username } = getCredentials();
|
|
685
|
+
const res = await authedFetch("/update-record", { userid: username, project, file, where: whereClause, set });
|
|
686
|
+
return textResult(res);
|
|
687
|
+
}));
|
|
688
|
+
server.tool("chaprola_delete_record", "Delete a single record matched by a where clause. Marks the record as ignored (.IGN). Physically removed on consolidation.", {
|
|
689
|
+
project: z.string().describe("Project name"),
|
|
690
|
+
file: z.string().describe("Data file name (without extension)"),
|
|
691
|
+
where: z.record(z.string()).describe("Field name → value pairs to identify exactly one record"),
|
|
692
|
+
}, async ({ project, file, where: whereClause }) => withBaaCheck(async () => {
|
|
693
|
+
const { username } = getCredentials();
|
|
694
|
+
const res = await authedFetch("/delete-record", { userid: username, project, file, where: whereClause });
|
|
695
|
+
return textResult(res);
|
|
696
|
+
}));
|
|
697
|
+
server.tool("chaprola_consolidate", "Merge a .MRG file into its parent .DA, producing a clean sorted data file. Deletes .MRG and .IGN after success. Aborts if .MRG was modified during the operation.", {
|
|
698
|
+
project: z.string().describe("Project name"),
|
|
699
|
+
file: z.string().describe("Data file name (without extension)"),
|
|
700
|
+
}, async ({ project, file }) => withBaaCheck(async () => {
|
|
701
|
+
const { username } = getCredentials();
|
|
702
|
+
const res = await authedFetch("/consolidate", { userid: username, project, file });
|
|
703
|
+
return textResult(res);
|
|
704
|
+
}));
|
|
628
705
|
// --- Start server ---
|
|
629
706
|
async function main() {
|
|
630
707
|
const transport = new StdioServerTransport();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaprola/mcp-server",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "MCP server for Chaprola — agent-first data platform. Gives AI agents
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "MCP server for Chaprola — agent-first data platform. Gives AI agents 46 tools for structured data storage, record CRUD, querying, schema inspection, web search, URL fetching, scheduled jobs, and execution via plain HTTP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|