@cencori/mcp 0.2.0 → 0.4.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/README.md +16 -7
- package/dist/index.js +261 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +261 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -217,6 +217,12 @@ var WRITE_ANNOTATIONS = {
|
|
|
217
217
|
destructiveHint: false,
|
|
218
218
|
openWorldHint: false
|
|
219
219
|
};
|
|
220
|
+
var DESTRUCTIVE_ANNOTATIONS = {
|
|
221
|
+
title: "Destructive",
|
|
222
|
+
readOnlyHint: false,
|
|
223
|
+
destructiveHint: true,
|
|
224
|
+
openWorldHint: false
|
|
225
|
+
};
|
|
220
226
|
function jsonResult(data) {
|
|
221
227
|
return {
|
|
222
228
|
content: [
|
|
@@ -338,7 +344,13 @@ function registerGatewayTools(server, client) {
|
|
|
338
344
|
|
|
339
345
|
// src/tools/agents.ts
|
|
340
346
|
import { z as z3 } from "zod";
|
|
341
|
-
|
|
347
|
+
var agentConfigShape = z3.object({
|
|
348
|
+
model: z3.string().optional(),
|
|
349
|
+
system_prompt: z3.string().optional(),
|
|
350
|
+
tools: z3.array(z3.string()).optional(),
|
|
351
|
+
temperature: z3.number().min(0).max(2).optional()
|
|
352
|
+
}).optional().describe("Agent runtime config: model, system_prompt, tools, temperature.");
|
|
353
|
+
function registerAgentsTools(server, client, caps) {
|
|
342
354
|
server.registerTool(
|
|
343
355
|
"list_agents",
|
|
344
356
|
{
|
|
@@ -377,6 +389,60 @@ function registerAgentsTools(server, client) {
|
|
|
377
389
|
},
|
|
378
390
|
async () => jsonResult(await client.get("/v1/agent/actions/poll"))
|
|
379
391
|
);
|
|
392
|
+
if (caps.write) {
|
|
393
|
+
server.registerTool(
|
|
394
|
+
"create_agent",
|
|
395
|
+
{
|
|
396
|
+
title: "Create an agent",
|
|
397
|
+
description: "Create a new agent in a project.",
|
|
398
|
+
inputSchema: {
|
|
399
|
+
project_id: z3.string().min(1).describe("The project id to create the agent in."),
|
|
400
|
+
name: z3.string().min(1).describe("Agent name."),
|
|
401
|
+
description: z3.string().optional(),
|
|
402
|
+
config: agentConfigShape
|
|
403
|
+
},
|
|
404
|
+
annotations: WRITE_ANNOTATIONS
|
|
405
|
+
},
|
|
406
|
+
async ({ project_id, name, description, config }) => jsonResult(await client.post("/v1/agents", { project_id, name, description, config }))
|
|
407
|
+
);
|
|
408
|
+
server.registerTool(
|
|
409
|
+
"update_agent",
|
|
410
|
+
{
|
|
411
|
+
title: "Update an agent",
|
|
412
|
+
description: "Update an agent\u2019s name, description, status, shadow mode, or config.",
|
|
413
|
+
inputSchema: {
|
|
414
|
+
agent_id: z3.string().min(1).describe("The agent id to update."),
|
|
415
|
+
name: z3.string().optional(),
|
|
416
|
+
description: z3.string().optional(),
|
|
417
|
+
is_active: z3.boolean().optional(),
|
|
418
|
+
shadow_mode: z3.boolean().optional(),
|
|
419
|
+
config: agentConfigShape
|
|
420
|
+
},
|
|
421
|
+
annotations: WRITE_ANNOTATIONS
|
|
422
|
+
},
|
|
423
|
+
async ({ agent_id, name, description, is_active, shadow_mode, config }) => jsonResult(
|
|
424
|
+
await client.patch(`/v1/agents/${agent_id}`, {
|
|
425
|
+
name,
|
|
426
|
+
description,
|
|
427
|
+
is_active,
|
|
428
|
+
shadow_mode,
|
|
429
|
+
config
|
|
430
|
+
})
|
|
431
|
+
)
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
if (caps.destructive) {
|
|
435
|
+
server.registerTool(
|
|
436
|
+
"delete_agent",
|
|
437
|
+
{
|
|
438
|
+
title: "Delete an agent",
|
|
439
|
+
description: "Permanently delete an agent by id. This cannot be undone.",
|
|
440
|
+
inputSchema: { agent_id: z3.string().min(1).describe("The agent id to delete.") },
|
|
441
|
+
annotations: DESTRUCTIVE_ANNOTATIONS
|
|
442
|
+
},
|
|
443
|
+
async ({ agent_id }) => jsonResult(await client.del(`/v1/agents/${agent_id}`))
|
|
444
|
+
);
|
|
445
|
+
}
|
|
380
446
|
}
|
|
381
447
|
|
|
382
448
|
// src/tools/memory.ts
|
|
@@ -387,7 +453,7 @@ var scopeShape = {
|
|
|
387
453
|
user_id: z4.string().optional().describe("Scope to a specific end-user id."),
|
|
388
454
|
session_id: z4.string().optional().describe("Scope to a specific session id.")
|
|
389
455
|
};
|
|
390
|
-
function registerMemoryTools(server, client) {
|
|
456
|
+
function registerMemoryTools(server, client, caps) {
|
|
391
457
|
server.registerTool(
|
|
392
458
|
"list_memories",
|
|
393
459
|
{
|
|
@@ -503,11 +569,93 @@ function registerMemoryTools(server, client) {
|
|
|
503
569
|
})
|
|
504
570
|
)
|
|
505
571
|
);
|
|
572
|
+
if (caps.write) {
|
|
573
|
+
server.registerTool(
|
|
574
|
+
"remember_memory",
|
|
575
|
+
{
|
|
576
|
+
title: "Remember a conversation turn",
|
|
577
|
+
description: "Store a user/assistant exchange as memory for later retrieval.",
|
|
578
|
+
inputSchema: {
|
|
579
|
+
user: z4.string().min(1).describe("The user message."),
|
|
580
|
+
assistant: z4.string().min(1).describe("The assistant response."),
|
|
581
|
+
...scopeShape
|
|
582
|
+
},
|
|
583
|
+
annotations: WRITE_ANNOTATIONS
|
|
584
|
+
},
|
|
585
|
+
async ({ user, assistant, namespace, scope, user_id, session_id }) => jsonResult(
|
|
586
|
+
await client.post("/v1/memory/remember", {
|
|
587
|
+
user,
|
|
588
|
+
assistant,
|
|
589
|
+
namespace,
|
|
590
|
+
scope,
|
|
591
|
+
userId: user_id,
|
|
592
|
+
sessionId: session_id
|
|
593
|
+
})
|
|
594
|
+
)
|
|
595
|
+
);
|
|
596
|
+
server.registerTool(
|
|
597
|
+
"write_memory",
|
|
598
|
+
{
|
|
599
|
+
title: "Write a memory",
|
|
600
|
+
description: "Store a single memory (a fact/note) directly.",
|
|
601
|
+
inputSchema: {
|
|
602
|
+
content: z4.string().min(1).describe("The memory content to store."),
|
|
603
|
+
importance: z4.number().min(0).max(1).optional().describe("Importance weight 0\u20131."),
|
|
604
|
+
...scopeShape
|
|
605
|
+
},
|
|
606
|
+
annotations: WRITE_ANNOTATIONS
|
|
607
|
+
},
|
|
608
|
+
async ({ content, importance, namespace, scope, user_id, session_id }) => jsonResult(
|
|
609
|
+
await client.post("/v1/memory/write", {
|
|
610
|
+
content,
|
|
611
|
+
importance,
|
|
612
|
+
namespace,
|
|
613
|
+
scope,
|
|
614
|
+
userId: user_id,
|
|
615
|
+
sessionId: session_id
|
|
616
|
+
})
|
|
617
|
+
)
|
|
618
|
+
);
|
|
619
|
+
server.registerTool(
|
|
620
|
+
"create_namespace",
|
|
621
|
+
{
|
|
622
|
+
title: "Create a memory namespace",
|
|
623
|
+
description: "Create a new memory namespace.",
|
|
624
|
+
inputSchema: {
|
|
625
|
+
name: z4.string().min(1).describe("Namespace name."),
|
|
626
|
+
description: z4.string().optional(),
|
|
627
|
+
embedding_model: z4.string().optional().describe("Embedding model for this namespace."),
|
|
628
|
+
dimensions: z4.number().int().positive().optional()
|
|
629
|
+
},
|
|
630
|
+
annotations: WRITE_ANNOTATIONS
|
|
631
|
+
},
|
|
632
|
+
async ({ name, description, embedding_model, dimensions }) => jsonResult(
|
|
633
|
+
await client.post("/memory/namespaces", {
|
|
634
|
+
name,
|
|
635
|
+
description,
|
|
636
|
+
embeddingModel: embedding_model,
|
|
637
|
+
dimensions
|
|
638
|
+
})
|
|
639
|
+
)
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
if (caps.destructive) {
|
|
643
|
+
server.registerTool(
|
|
644
|
+
"delete_memory",
|
|
645
|
+
{
|
|
646
|
+
title: "Delete a memory",
|
|
647
|
+
description: "Permanently delete a memory by id. This cannot be undone.",
|
|
648
|
+
inputSchema: { memory_id: z4.string().min(1).describe("The memory id to delete.") },
|
|
649
|
+
annotations: DESTRUCTIVE_ANNOTATIONS
|
|
650
|
+
},
|
|
651
|
+
async ({ memory_id }) => jsonResult(await client.del(`/v1/memory/${memory_id}`))
|
|
652
|
+
);
|
|
653
|
+
}
|
|
506
654
|
}
|
|
507
655
|
|
|
508
656
|
// src/tools/sessions.ts
|
|
509
657
|
import { z as z5 } from "zod";
|
|
510
|
-
function registerSessionsTools(server, client) {
|
|
658
|
+
function registerSessionsTools(server, client, caps) {
|
|
511
659
|
server.registerTool(
|
|
512
660
|
"list_sessions",
|
|
513
661
|
{
|
|
@@ -550,11 +698,87 @@ function registerSessionsTools(server, client) {
|
|
|
550
698
|
},
|
|
551
699
|
async ({ session_id }) => jsonResult(await client.get(`/v1/sessions/${session_id}/events`))
|
|
552
700
|
);
|
|
701
|
+
if (caps.write) {
|
|
702
|
+
server.registerTool(
|
|
703
|
+
"create_session",
|
|
704
|
+
{
|
|
705
|
+
title: "Create an agent session",
|
|
706
|
+
description: "Start a new session for an agent.",
|
|
707
|
+
inputSchema: {
|
|
708
|
+
agent_id: z5.string().min(1).describe("The agent id to start a session for."),
|
|
709
|
+
metadata: z5.record(z5.string(), z5.unknown()).optional().describe("Optional session metadata.")
|
|
710
|
+
},
|
|
711
|
+
annotations: WRITE_ANNOTATIONS
|
|
712
|
+
},
|
|
713
|
+
async ({ agent_id, metadata }) => jsonResult(await client.post("/v1/sessions", { agent_id, metadata }))
|
|
714
|
+
);
|
|
715
|
+
server.registerTool(
|
|
716
|
+
"add_session_turn",
|
|
717
|
+
{
|
|
718
|
+
title: "Add a turn to a session",
|
|
719
|
+
description: "Run a turn in an agent session. Incurs usage/cost.",
|
|
720
|
+
inputSchema: {
|
|
721
|
+
session_id: z5.string().min(1).describe("The session id."),
|
|
722
|
+
model: z5.string().min(1).describe("Model id for the turn."),
|
|
723
|
+
input: z5.string().min(1).describe("The user input for this turn."),
|
|
724
|
+
instructions: z5.string().optional().describe("Optional system instructions."),
|
|
725
|
+
temperature: z5.number().min(0).max(2).optional()
|
|
726
|
+
},
|
|
727
|
+
annotations: WRITE_ANNOTATIONS
|
|
728
|
+
},
|
|
729
|
+
async ({ session_id, model, input, instructions, temperature }) => jsonResult(
|
|
730
|
+
await client.post(`/v1/sessions/${session_id}/turns`, {
|
|
731
|
+
model,
|
|
732
|
+
input,
|
|
733
|
+
instructions,
|
|
734
|
+
temperature
|
|
735
|
+
})
|
|
736
|
+
)
|
|
737
|
+
);
|
|
738
|
+
}
|
|
739
|
+
if (caps.destructive) {
|
|
740
|
+
server.registerTool(
|
|
741
|
+
"delete_session",
|
|
742
|
+
{
|
|
743
|
+
title: "Delete an agent session",
|
|
744
|
+
description: "Permanently delete an agent session by id. This cannot be undone.",
|
|
745
|
+
inputSchema: { session_id: z5.string().min(1).describe("The session id to delete.") },
|
|
746
|
+
annotations: DESTRUCTIVE_ANNOTATIONS
|
|
747
|
+
},
|
|
748
|
+
async ({ session_id }) => jsonResult(await client.del(`/v1/sessions/${session_id}`))
|
|
749
|
+
);
|
|
750
|
+
server.registerTool(
|
|
751
|
+
"approve_session",
|
|
752
|
+
{
|
|
753
|
+
title: "Approve a pending session action",
|
|
754
|
+
description: "Approve a pending action in an agent session (human-in-the-loop).",
|
|
755
|
+
inputSchema: {
|
|
756
|
+
session_id: z5.string().min(1).describe("The session id."),
|
|
757
|
+
action_id: z5.string().optional().describe("Specific pending action id, if any.")
|
|
758
|
+
},
|
|
759
|
+
annotations: DESTRUCTIVE_ANNOTATIONS
|
|
760
|
+
},
|
|
761
|
+
async ({ session_id, action_id }) => jsonResult(await client.post(`/v1/sessions/${session_id}/approve`, { action_id }))
|
|
762
|
+
);
|
|
763
|
+
server.registerTool(
|
|
764
|
+
"reject_session",
|
|
765
|
+
{
|
|
766
|
+
title: "Reject a pending session action",
|
|
767
|
+
description: "Reject a pending action in an agent session (human-in-the-loop).",
|
|
768
|
+
inputSchema: {
|
|
769
|
+
session_id: z5.string().min(1).describe("The session id."),
|
|
770
|
+
action_id: z5.string().optional().describe("Specific pending action id, if any.")
|
|
771
|
+
},
|
|
772
|
+
annotations: DESTRUCTIVE_ANNOTATIONS
|
|
773
|
+
},
|
|
774
|
+
async ({ session_id, action_id }) => jsonResult(await client.post(`/v1/sessions/${session_id}/reject`, { action_id }))
|
|
775
|
+
);
|
|
776
|
+
}
|
|
553
777
|
}
|
|
554
778
|
|
|
555
779
|
// src/tools/governance.ts
|
|
556
780
|
import { z as z6 } from "zod";
|
|
557
|
-
function registerGovernanceTools(server, client) {
|
|
781
|
+
function registerGovernanceTools(server, client, caps) {
|
|
558
782
|
server.registerTool(
|
|
559
783
|
"list_policies",
|
|
560
784
|
{
|
|
@@ -617,6 +841,34 @@ function registerGovernanceTools(server, client) {
|
|
|
617
841
|
},
|
|
618
842
|
async () => jsonResult(await client.get("/v1/governance/templates"))
|
|
619
843
|
);
|
|
844
|
+
if (caps.write) {
|
|
845
|
+
server.registerTool(
|
|
846
|
+
"create_policy",
|
|
847
|
+
{
|
|
848
|
+
title: "Draft a governance policy",
|
|
849
|
+
description: "Create a governance policy as a DRAFT. It is not enforced until a human activates it (see how_to_activate_policy).",
|
|
850
|
+
inputSchema: {
|
|
851
|
+
name: z6.string().min(1).describe("Policy name (unique per org)."),
|
|
852
|
+
spec: z6.record(z6.string(), z6.unknown()).describe("Policy spec object: match + rules + defaults + controls.")
|
|
853
|
+
},
|
|
854
|
+
annotations: WRITE_ANNOTATIONS
|
|
855
|
+
},
|
|
856
|
+
async ({ name, spec }) => jsonResult(await client.post("/v1/governance/policies", { name, spec }))
|
|
857
|
+
);
|
|
858
|
+
server.registerTool(
|
|
859
|
+
"install_template",
|
|
860
|
+
{
|
|
861
|
+
title: "Install a governance policy template",
|
|
862
|
+
description: "Install a policy template as a new DRAFT policy. Activation remains a manual human step (see how_to_activate_policy).",
|
|
863
|
+
inputSchema: {
|
|
864
|
+
template_id: z6.string().min(1).describe("The template id to install."),
|
|
865
|
+
name: z6.string().min(1).describe("Name for the new draft policy.")
|
|
866
|
+
},
|
|
867
|
+
annotations: WRITE_ANNOTATIONS
|
|
868
|
+
},
|
|
869
|
+
async ({ template_id, name }) => jsonResult(await client.post(`/v1/governance/templates/${template_id}/install`, { name }))
|
|
870
|
+
);
|
|
871
|
+
}
|
|
620
872
|
}
|
|
621
873
|
|
|
622
874
|
// src/tools/multimodal.ts
|
|
@@ -899,7 +1151,7 @@ function registerGuidanceTools(server, baseUrl) {
|
|
|
899
1151
|
|
|
900
1152
|
// src/server.ts
|
|
901
1153
|
var SERVER_NAME = "cencori";
|
|
902
|
-
var SERVER_VERSION = "0.
|
|
1154
|
+
var SERVER_VERSION = "0.4.0";
|
|
903
1155
|
function createServer(config) {
|
|
904
1156
|
const server = new McpServer(
|
|
905
1157
|
{
|
|
@@ -924,10 +1176,10 @@ function createServer(config) {
|
|
|
924
1176
|
if (config.apiKey) {
|
|
925
1177
|
const client = new PlatformClient(config.baseUrl, config.apiKey);
|
|
926
1178
|
if (features.gateway) registerGatewayTools(server, client);
|
|
927
|
-
if (features.agents) registerAgentsTools(server, client);
|
|
928
|
-
if (features.memory) registerMemoryTools(server, client);
|
|
929
|
-
if (features.sessions) registerSessionsTools(server, client);
|
|
930
|
-
if (features.governance) registerGovernanceTools(server, client);
|
|
1179
|
+
if (features.agents) registerAgentsTools(server, client, capabilities);
|
|
1180
|
+
if (features.memory) registerMemoryTools(server, client, capabilities);
|
|
1181
|
+
if (features.sessions) registerSessionsTools(server, client, capabilities);
|
|
1182
|
+
if (features.governance) registerGovernanceTools(server, client, capabilities);
|
|
931
1183
|
if (features.multimodal && capabilities.write) {
|
|
932
1184
|
registerMultimodalTools(server, client);
|
|
933
1185
|
}
|