@centrali-io/centrali-mcp 9.6.0 → 9.8.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.
@@ -588,7 +588,7 @@ function registerServiceAccountTools(server, sdk, centraliUrl, workspaceId, curr
588
588
  };
589
589
  }
590
590
  }));
591
- (0, _register_js_1.registerTool)(server, "get_role", "Get details of a role including its permissions.", {
591
+ (0, _register_js_1.registerTool)(server, "get_role", "Get a role's name and description. Roles are labels; permissions bind resources and actions to policies that can match role names.", {
592
592
  roleId: zod_1.z.string().describe("The role ID (UUID)"),
593
593
  }, (_a) => __awaiter(this, [_a], void 0, function* ({ roleId }) {
594
594
  try {
@@ -604,7 +604,7 @@ function registerServiceAccountTools(server, sdk, centraliUrl, workspaceId, curr
604
604
  };
605
605
  }
606
606
  }));
607
- (0, _register_js_1.registerTool)(server, "create_role", "Create a new role. Roles are named labels assigned to users and service accounts. They do NOT contain permissions directly — to grant access, create a policy that targets the role as a principal. Role names are immutable after creation.", {
607
+ (0, _register_js_1.registerTool)(server, "create_role", "Create a new role. Roles are named labels assigned to users and service accounts. They do NOT contain permission IDs. To grant narrow access, assign the role to the service account, create_policy with an in_list condition on the roles attribute matching the role name, then create_permission binding that policyId to a resourceId and only the required actions (e.g. files + ['create']). Role names are immutable after creation.", {
608
608
  name: zod_1.z.string().describe("Role name (e.g., 'Data Reader', 'Compute Admin'). Cannot be changed after creation."),
609
609
  description: zod_1.z.string().optional().describe("Optional description of the role's purpose"),
610
610
  }, (_a) => __awaiter(this, [_a], void 0, function* ({ name, description }) {
@@ -888,8 +888,8 @@ function registerServiceAccountTools(server, sdk, centraliUrl, workspaceId, curr
888
888
  return { content: [{ type: "text", text: (0, _register_js_1.formatError)(error, `getting policy '${policyId}'`) }], isError: true };
889
889
  }
890
890
  }));
891
- (0, _register_js_1.registerTool)(server, "create_policy", "Create an access control policy. Policies grant or deny actions on resources to principals (users, service accounts, groups, roles).", {
892
- policy: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).describe("The policy definition object. Must include: name, effect ('allow'|'deny'), principals, resources, actions. May include conditions."),
891
+ (0, _register_js_1.registerTool)(server, "create_policy", "Create a policy with name and specification. A policy matches identity attributes; create_permission binds its policyId to a resourceId and actions. For a role, use {\"name\":\"upload-only\",\"specification\":{\"rules\":[{\"rule_id\":\"allow-upload-role\",\"effect\":\"Allow\",\"conditions\":[{\"function\":\"in_list\",\"attribute\":\"roles\",\"value\":\"file_uploaders\"}]}],\"default\":{\"rule_id\":\"default-deny\",\"effect\":\"Deny\"}}}. Match the role NAME, not its UUID. A policy alone grants no access.", {
892
+ policy: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).describe("Required: {name: string, specification: {rules: [{rule_id: string, effect: 'Allow'|'Deny', conditions: [{function: string, attribute: string, value?: any}]}], default: {rule_id: string, effect: 'Allow'|'Deny'}}}. Optional: description. Use distinct rule IDs. Resources and actions belong in create_permission, not here."),
893
893
  }, (_a) => __awaiter(this, [_a], void 0, function* ({ policy }) {
894
894
  try {
895
895
  const result = yield getPoliciesClient().post("/", policy);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centrali-io/centrali-mcp",
3
- "version": "9.6.0",
3
+ "version": "9.8.0",
4
4
  "description": "Centrali MCP Server - AI assistant integration for Centrali workspaces",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
@@ -26,7 +26,7 @@
26
26
  "author": "Blueinit",
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
- "@centrali-io/centrali-sdk": "^9.6.0",
29
+ "@centrali-io/centrali-sdk": "^9.8.0",
30
30
  "@modelcontextprotocol/sdk": "^1.28.0"
31
31
  },
32
32
  "devDependencies": {
@@ -734,7 +734,7 @@ export function registerServiceAccountTools(
734
734
 
735
735
  registerTool<any>(server,
736
736
  "get_role",
737
- "Get details of a role including its permissions.",
737
+ "Get a role's name and description. Roles are labels; permissions bind resources and actions to policies that can match role names.",
738
738
  {
739
739
  roleId: z.string().describe("The role ID (UUID)"),
740
740
  },
@@ -755,7 +755,7 @@ export function registerServiceAccountTools(
755
755
 
756
756
  registerTool<any>(server,
757
757
  "create_role",
758
- "Create a new role. Roles are named labels assigned to users and service accounts. They do NOT contain permissions directly — to grant access, create a policy that targets the role as a principal. Role names are immutable after creation.",
758
+ "Create a new role. Roles are named labels assigned to users and service accounts. They do NOT contain permission IDs. To grant narrow access, assign the role to the service account, create_policy with an in_list condition on the roles attribute matching the role name, then create_permission binding that policyId to a resourceId and only the required actions (e.g. files + ['create']). Role names are immutable after creation.",
759
759
  {
760
760
  name: z.string().describe("Role name (e.g., 'Data Reader', 'Compute Admin'). Cannot be changed after creation."),
761
761
  description: z.string().optional().describe("Optional description of the role's purpose"),
@@ -1114,9 +1114,9 @@ export function registerServiceAccountTools(
1114
1114
 
1115
1115
  registerTool<any>(server,
1116
1116
  "create_policy",
1117
- "Create an access control policy. Policies grant or deny actions on resources to principals (users, service accounts, groups, roles).",
1117
+ "Create a policy with name and specification. A policy matches identity attributes; create_permission binds its policyId to a resourceId and actions. For a role, use {\"name\":\"upload-only\",\"specification\":{\"rules\":[{\"rule_id\":\"allow-upload-role\",\"effect\":\"Allow\",\"conditions\":[{\"function\":\"in_list\",\"attribute\":\"roles\",\"value\":\"file_uploaders\"}]}],\"default\":{\"rule_id\":\"default-deny\",\"effect\":\"Deny\"}}}. Match the role NAME, not its UUID. A policy alone grants no access.",
1118
1118
  {
1119
- policy: z.record(z.string(), z.any()).describe("The policy definition object. Must include: name, effect ('allow'|'deny'), principals, resources, actions. May include conditions."),
1119
+ policy: z.record(z.string(), z.any()).describe("Required: {name: string, specification: {rules: [{rule_id: string, effect: 'Allow'|'Deny', conditions: [{function: string, attribute: string, value?: any}]}], default: {rule_id: string, effect: 'Allow'|'Deny'}}}. Optional: description. Use distinct rule IDs. Resources and actions belong in create_permission, not here."),
1120
1120
  },
1121
1121
  async ({ policy }) => {
1122
1122
  try {
@@ -92,3 +92,23 @@ test('delete description permits already-revoked accounts', () => {
92
92
  assert.doesNotMatch(description, /must not be revoked|revoke prevents deletion/);
93
93
  } finally { restore(); }
94
94
  });
95
+
96
+ test('policy guidance supplies the IAM specification format and keeps actions in permissions', async () => {
97
+ const { calls, tools, restore } = setup();
98
+ try {
99
+ const tool = tools.get('create_policy');
100
+ // Execute the exact example advertised to agents, rather than inventing a second fixture.
101
+ const example = tool.description.match(/use (\{.*\})\. Match/)[1];
102
+ const policy = JSON.parse(example);
103
+ assert.equal(policy.specification.rules[0].effect, 'Allow');
104
+ assert.equal(policy.specification.rules[0].conditions[0].attribute, 'roles');
105
+ assert.equal(policy.specification.rules[0].conditions[0].value, 'file_uploaders');
106
+ assert.equal(policy.specification.default.effect, 'Deny');
107
+ assert.match(tool.schema.policy.description, /specification/);
108
+ assert.doesNotMatch(tool.schema.policy.description, /principals/);
109
+ assert.match(tools.get('create_role').description, /create_permission.*required actions/);
110
+ await tool.handler({ policy });
111
+ assert.equal(calls[0].method, 'post');
112
+ assert.equal(calls[0].body, policy);
113
+ } finally { restore(); }
114
+ });