@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 CHANGED
@@ -57,11 +57,19 @@ Docs + `how_to_*` guidance tools work with **no API key**. Add `CENCORI_API_KEY`
57
57
  | Sessions | `list_sessions`, `get_session`, `get_session_events` |
58
58
  | Governance | `list_policies`, `list_roles`, `list_change_requests`, `get_governance_ledger`, `get_governance_evidence`, `list_governance_templates` |
59
59
 
60
- ### Inference (Write-tier) — requires `CENCORI_MCP_WRITE=1`
60
+ ### Write — requires `CENCORI_MCP_WRITE=1`
61
61
 
62
- `generate_text`, `generate_rag`, `create_embeddings`, `moderate_content`, `generate_image`, `describe_image`, `ocr_image`, `classify_image`, `extract_document`, `summarize_document`, `query_document`.
62
+ - **Inference:** `generate_text`, `generate_rag`, `create_embeddings`, `moderate_content`, `generate_image`, `describe_image`, `ocr_image`, `classify_image`, `extract_document`, `summarize_document`, `query_document`.
63
+ - **Memory:** `remember_memory`, `write_memory`, `create_namespace`.
64
+ - **Agents:** `create_agent`, `update_agent`.
65
+ - **Sessions:** `create_session`, `add_session_turn`.
66
+ - **Governance (draft only):** `create_policy`, `install_template`. Policies are created as **drafts** — activation stays a manual human step (`how_to_activate_policy`).
63
67
 
64
- > Roadmap: Phase 2 adds memory/agent/session write + destructive tools; Phase 3 adds governance policy *drafting*. Audio (TTS/STT) is planned once binary/multipart transport lands.
68
+ ### Destructive requires `CENCORI_MCP_DESTRUCTIVE=1` (implies write)
69
+
70
+ `delete_memory`, `delete_agent`, `delete_session`, `approve_session`, `reject_session`. All carry `destructiveHint` so clients can confirm.
71
+
72
+ > Roadmap: audio (TTS/STT) once binary/multipart transport lands.
65
73
 
66
74
  ---
67
75
 
@@ -122,11 +130,12 @@ See [`mcp.example.json`](./mcp.example.json) for a copy-paste template.
122
130
 
123
131
  ### Behavior
124
132
 
125
- | `CENCORI_API_KEY` | `CENCORI_MCP_WRITE` | Registered |
126
- |-------------------|---------------------|-----------|
133
+ | `CENCORI_API_KEY` | Flag | Registered |
134
+ |-------------------|------|-----------|
127
135
  | unset | — | docs + `how_to_*` guidance only |
128
- | set | unset | guidance + all **reads** |
129
- | set | `1` | guidance + reads + **inference** |
136
+ | set | | guidance + all **reads** |
137
+ | set | `CENCORI_MCP_WRITE=1` | + **writes** (inference, memory, agents, sessions) |
138
+ | set | `CENCORI_MCP_DESTRUCTIVE=1` | + **destructive** (delete/approve/reject); implies write |
130
139
 
131
140
  Restart the MCP server after changing env vars.
132
141
 
package/dist/index.js CHANGED
@@ -218,6 +218,12 @@ var WRITE_ANNOTATIONS = {
218
218
  destructiveHint: false,
219
219
  openWorldHint: false
220
220
  };
221
+ var DESTRUCTIVE_ANNOTATIONS = {
222
+ title: "Destructive",
223
+ readOnlyHint: false,
224
+ destructiveHint: true,
225
+ openWorldHint: false
226
+ };
221
227
  function jsonResult(data) {
222
228
  return {
223
229
  content: [
@@ -339,7 +345,13 @@ function registerGatewayTools(server, client) {
339
345
 
340
346
  // src/tools/agents.ts
341
347
  var import_zod3 = require("zod");
342
- function registerAgentsTools(server, client) {
348
+ var agentConfigShape = import_zod3.z.object({
349
+ model: import_zod3.z.string().optional(),
350
+ system_prompt: import_zod3.z.string().optional(),
351
+ tools: import_zod3.z.array(import_zod3.z.string()).optional(),
352
+ temperature: import_zod3.z.number().min(0).max(2).optional()
353
+ }).optional().describe("Agent runtime config: model, system_prompt, tools, temperature.");
354
+ function registerAgentsTools(server, client, caps) {
343
355
  server.registerTool(
344
356
  "list_agents",
345
357
  {
@@ -378,6 +390,60 @@ function registerAgentsTools(server, client) {
378
390
  },
379
391
  async () => jsonResult(await client.get("/v1/agent/actions/poll"))
380
392
  );
393
+ if (caps.write) {
394
+ server.registerTool(
395
+ "create_agent",
396
+ {
397
+ title: "Create an agent",
398
+ description: "Create a new agent in a project.",
399
+ inputSchema: {
400
+ project_id: import_zod3.z.string().min(1).describe("The project id to create the agent in."),
401
+ name: import_zod3.z.string().min(1).describe("Agent name."),
402
+ description: import_zod3.z.string().optional(),
403
+ config: agentConfigShape
404
+ },
405
+ annotations: WRITE_ANNOTATIONS
406
+ },
407
+ async ({ project_id, name, description, config }) => jsonResult(await client.post("/v1/agents", { project_id, name, description, config }))
408
+ );
409
+ server.registerTool(
410
+ "update_agent",
411
+ {
412
+ title: "Update an agent",
413
+ description: "Update an agent\u2019s name, description, status, shadow mode, or config.",
414
+ inputSchema: {
415
+ agent_id: import_zod3.z.string().min(1).describe("The agent id to update."),
416
+ name: import_zod3.z.string().optional(),
417
+ description: import_zod3.z.string().optional(),
418
+ is_active: import_zod3.z.boolean().optional(),
419
+ shadow_mode: import_zod3.z.boolean().optional(),
420
+ config: agentConfigShape
421
+ },
422
+ annotations: WRITE_ANNOTATIONS
423
+ },
424
+ async ({ agent_id, name, description, is_active, shadow_mode, config }) => jsonResult(
425
+ await client.patch(`/v1/agents/${agent_id}`, {
426
+ name,
427
+ description,
428
+ is_active,
429
+ shadow_mode,
430
+ config
431
+ })
432
+ )
433
+ );
434
+ }
435
+ if (caps.destructive) {
436
+ server.registerTool(
437
+ "delete_agent",
438
+ {
439
+ title: "Delete an agent",
440
+ description: "Permanently delete an agent by id. This cannot be undone.",
441
+ inputSchema: { agent_id: import_zod3.z.string().min(1).describe("The agent id to delete.") },
442
+ annotations: DESTRUCTIVE_ANNOTATIONS
443
+ },
444
+ async ({ agent_id }) => jsonResult(await client.del(`/v1/agents/${agent_id}`))
445
+ );
446
+ }
381
447
  }
382
448
 
383
449
  // src/tools/memory.ts
@@ -388,7 +454,7 @@ var scopeShape = {
388
454
  user_id: import_zod4.z.string().optional().describe("Scope to a specific end-user id."),
389
455
  session_id: import_zod4.z.string().optional().describe("Scope to a specific session id.")
390
456
  };
391
- function registerMemoryTools(server, client) {
457
+ function registerMemoryTools(server, client, caps) {
392
458
  server.registerTool(
393
459
  "list_memories",
394
460
  {
@@ -504,11 +570,93 @@ function registerMemoryTools(server, client) {
504
570
  })
505
571
  )
506
572
  );
573
+ if (caps.write) {
574
+ server.registerTool(
575
+ "remember_memory",
576
+ {
577
+ title: "Remember a conversation turn",
578
+ description: "Store a user/assistant exchange as memory for later retrieval.",
579
+ inputSchema: {
580
+ user: import_zod4.z.string().min(1).describe("The user message."),
581
+ assistant: import_zod4.z.string().min(1).describe("The assistant response."),
582
+ ...scopeShape
583
+ },
584
+ annotations: WRITE_ANNOTATIONS
585
+ },
586
+ async ({ user, assistant, namespace, scope, user_id, session_id }) => jsonResult(
587
+ await client.post("/v1/memory/remember", {
588
+ user,
589
+ assistant,
590
+ namespace,
591
+ scope,
592
+ userId: user_id,
593
+ sessionId: session_id
594
+ })
595
+ )
596
+ );
597
+ server.registerTool(
598
+ "write_memory",
599
+ {
600
+ title: "Write a memory",
601
+ description: "Store a single memory (a fact/note) directly.",
602
+ inputSchema: {
603
+ content: import_zod4.z.string().min(1).describe("The memory content to store."),
604
+ importance: import_zod4.z.number().min(0).max(1).optional().describe("Importance weight 0\u20131."),
605
+ ...scopeShape
606
+ },
607
+ annotations: WRITE_ANNOTATIONS
608
+ },
609
+ async ({ content, importance, namespace, scope, user_id, session_id }) => jsonResult(
610
+ await client.post("/v1/memory/write", {
611
+ content,
612
+ importance,
613
+ namespace,
614
+ scope,
615
+ userId: user_id,
616
+ sessionId: session_id
617
+ })
618
+ )
619
+ );
620
+ server.registerTool(
621
+ "create_namespace",
622
+ {
623
+ title: "Create a memory namespace",
624
+ description: "Create a new memory namespace.",
625
+ inputSchema: {
626
+ name: import_zod4.z.string().min(1).describe("Namespace name."),
627
+ description: import_zod4.z.string().optional(),
628
+ embedding_model: import_zod4.z.string().optional().describe("Embedding model for this namespace."),
629
+ dimensions: import_zod4.z.number().int().positive().optional()
630
+ },
631
+ annotations: WRITE_ANNOTATIONS
632
+ },
633
+ async ({ name, description, embedding_model, dimensions }) => jsonResult(
634
+ await client.post("/memory/namespaces", {
635
+ name,
636
+ description,
637
+ embeddingModel: embedding_model,
638
+ dimensions
639
+ })
640
+ )
641
+ );
642
+ }
643
+ if (caps.destructive) {
644
+ server.registerTool(
645
+ "delete_memory",
646
+ {
647
+ title: "Delete a memory",
648
+ description: "Permanently delete a memory by id. This cannot be undone.",
649
+ inputSchema: { memory_id: import_zod4.z.string().min(1).describe("The memory id to delete.") },
650
+ annotations: DESTRUCTIVE_ANNOTATIONS
651
+ },
652
+ async ({ memory_id }) => jsonResult(await client.del(`/v1/memory/${memory_id}`))
653
+ );
654
+ }
507
655
  }
508
656
 
509
657
  // src/tools/sessions.ts
510
658
  var import_zod5 = require("zod");
511
- function registerSessionsTools(server, client) {
659
+ function registerSessionsTools(server, client, caps) {
512
660
  server.registerTool(
513
661
  "list_sessions",
514
662
  {
@@ -551,11 +699,87 @@ function registerSessionsTools(server, client) {
551
699
  },
552
700
  async ({ session_id }) => jsonResult(await client.get(`/v1/sessions/${session_id}/events`))
553
701
  );
702
+ if (caps.write) {
703
+ server.registerTool(
704
+ "create_session",
705
+ {
706
+ title: "Create an agent session",
707
+ description: "Start a new session for an agent.",
708
+ inputSchema: {
709
+ agent_id: import_zod5.z.string().min(1).describe("The agent id to start a session for."),
710
+ metadata: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown()).optional().describe("Optional session metadata.")
711
+ },
712
+ annotations: WRITE_ANNOTATIONS
713
+ },
714
+ async ({ agent_id, metadata }) => jsonResult(await client.post("/v1/sessions", { agent_id, metadata }))
715
+ );
716
+ server.registerTool(
717
+ "add_session_turn",
718
+ {
719
+ title: "Add a turn to a session",
720
+ description: "Run a turn in an agent session. Incurs usage/cost.",
721
+ inputSchema: {
722
+ session_id: import_zod5.z.string().min(1).describe("The session id."),
723
+ model: import_zod5.z.string().min(1).describe("Model id for the turn."),
724
+ input: import_zod5.z.string().min(1).describe("The user input for this turn."),
725
+ instructions: import_zod5.z.string().optional().describe("Optional system instructions."),
726
+ temperature: import_zod5.z.number().min(0).max(2).optional()
727
+ },
728
+ annotations: WRITE_ANNOTATIONS
729
+ },
730
+ async ({ session_id, model, input, instructions, temperature }) => jsonResult(
731
+ await client.post(`/v1/sessions/${session_id}/turns`, {
732
+ model,
733
+ input,
734
+ instructions,
735
+ temperature
736
+ })
737
+ )
738
+ );
739
+ }
740
+ if (caps.destructive) {
741
+ server.registerTool(
742
+ "delete_session",
743
+ {
744
+ title: "Delete an agent session",
745
+ description: "Permanently delete an agent session by id. This cannot be undone.",
746
+ inputSchema: { session_id: import_zod5.z.string().min(1).describe("The session id to delete.") },
747
+ annotations: DESTRUCTIVE_ANNOTATIONS
748
+ },
749
+ async ({ session_id }) => jsonResult(await client.del(`/v1/sessions/${session_id}`))
750
+ );
751
+ server.registerTool(
752
+ "approve_session",
753
+ {
754
+ title: "Approve a pending session action",
755
+ description: "Approve a pending action in an agent session (human-in-the-loop).",
756
+ inputSchema: {
757
+ session_id: import_zod5.z.string().min(1).describe("The session id."),
758
+ action_id: import_zod5.z.string().optional().describe("Specific pending action id, if any.")
759
+ },
760
+ annotations: DESTRUCTIVE_ANNOTATIONS
761
+ },
762
+ async ({ session_id, action_id }) => jsonResult(await client.post(`/v1/sessions/${session_id}/approve`, { action_id }))
763
+ );
764
+ server.registerTool(
765
+ "reject_session",
766
+ {
767
+ title: "Reject a pending session action",
768
+ description: "Reject a pending action in an agent session (human-in-the-loop).",
769
+ inputSchema: {
770
+ session_id: import_zod5.z.string().min(1).describe("The session id."),
771
+ action_id: import_zod5.z.string().optional().describe("Specific pending action id, if any.")
772
+ },
773
+ annotations: DESTRUCTIVE_ANNOTATIONS
774
+ },
775
+ async ({ session_id, action_id }) => jsonResult(await client.post(`/v1/sessions/${session_id}/reject`, { action_id }))
776
+ );
777
+ }
554
778
  }
555
779
 
556
780
  // src/tools/governance.ts
557
781
  var import_zod6 = require("zod");
558
- function registerGovernanceTools(server, client) {
782
+ function registerGovernanceTools(server, client, caps) {
559
783
  server.registerTool(
560
784
  "list_policies",
561
785
  {
@@ -618,6 +842,34 @@ function registerGovernanceTools(server, client) {
618
842
  },
619
843
  async () => jsonResult(await client.get("/v1/governance/templates"))
620
844
  );
845
+ if (caps.write) {
846
+ server.registerTool(
847
+ "create_policy",
848
+ {
849
+ title: "Draft a governance policy",
850
+ description: "Create a governance policy as a DRAFT. It is not enforced until a human activates it (see how_to_activate_policy).",
851
+ inputSchema: {
852
+ name: import_zod6.z.string().min(1).describe("Policy name (unique per org)."),
853
+ spec: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).describe("Policy spec object: match + rules + defaults + controls.")
854
+ },
855
+ annotations: WRITE_ANNOTATIONS
856
+ },
857
+ async ({ name, spec }) => jsonResult(await client.post("/v1/governance/policies", { name, spec }))
858
+ );
859
+ server.registerTool(
860
+ "install_template",
861
+ {
862
+ title: "Install a governance policy template",
863
+ description: "Install a policy template as a new DRAFT policy. Activation remains a manual human step (see how_to_activate_policy).",
864
+ inputSchema: {
865
+ template_id: import_zod6.z.string().min(1).describe("The template id to install."),
866
+ name: import_zod6.z.string().min(1).describe("Name for the new draft policy.")
867
+ },
868
+ annotations: WRITE_ANNOTATIONS
869
+ },
870
+ async ({ template_id, name }) => jsonResult(await client.post(`/v1/governance/templates/${template_id}/install`, { name }))
871
+ );
872
+ }
621
873
  }
622
874
 
623
875
  // src/tools/multimodal.ts
@@ -900,7 +1152,7 @@ function registerGuidanceTools(server, baseUrl) {
900
1152
 
901
1153
  // src/server.ts
902
1154
  var SERVER_NAME = "cencori";
903
- var SERVER_VERSION = "0.2.0";
1155
+ var SERVER_VERSION = "0.4.0";
904
1156
  function createServer(config) {
905
1157
  const server = new import_mcp.McpServer(
906
1158
  {
@@ -925,10 +1177,10 @@ function createServer(config) {
925
1177
  if (config.apiKey) {
926
1178
  const client = new PlatformClient(config.baseUrl, config.apiKey);
927
1179
  if (features.gateway) registerGatewayTools(server, client);
928
- if (features.agents) registerAgentsTools(server, client);
929
- if (features.memory) registerMemoryTools(server, client);
930
- if (features.sessions) registerSessionsTools(server, client);
931
- if (features.governance) registerGovernanceTools(server, client);
1180
+ if (features.agents) registerAgentsTools(server, client, capabilities);
1181
+ if (features.memory) registerMemoryTools(server, client, capabilities);
1182
+ if (features.sessions) registerSessionsTools(server, client, capabilities);
1183
+ if (features.governance) registerGovernanceTools(server, client, capabilities);
932
1184
  if (features.multimodal && capabilities.write) {
933
1185
  registerMultimodalTools(server, client);
934
1186
  }