@ory/cline 1.5.3 → 1.7.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
@@ -95,6 +95,26 @@ npx -y -p @ory/cline ory-cline permissions # native allowed/blocked state and
95
95
 
96
96
  Then a denied tool is actually blocked and Cline shows why.
97
97
 
98
+ ### MCP servers
99
+
100
+ Cline 3 names an MCP tool `<server>__<tool>`, replacing runs of characters
101
+ outside `[a-zA-Z0-9_-]` with `_` and truncating names over 128 characters with
102
+ a hash suffix (verified against cline@3.0.29, `@cline/core` 0.0.51
103
+ `defaultMcpToolNameTransform`). The plugin checks such a call as
104
+ `McpServer:<server>` and `McpTool:<server>:<tool>`; Agent Security resolves
105
+ the reported name to a cataloged server. To split server names that contain
106
+ `__`, it reads the server keys (only the keys) from Cline's MCP settings file:
107
+ `CLINE_MCP_SETTINGS_PATH`, else
108
+ `~/.cline/data/settings/cline_mcp_settings.json` (honoring `CLINE_DATA_DIR`
109
+ and `CLINE_DIR`). A tool from a server not listed there, such as one a Cline
110
+ plugin registers, is split at its first `__`. Cline's native tools contain no
111
+ `__` and keep the native check. The legacy `use_mcp_tool` tool is still
112
+ recognized by its `server_name` and `tool_name` arguments.
113
+
114
+ Limits: the hook payload does not say how a server is launched, and the plugin
115
+ reads only server keys from the settings file, so no fingerprints are sent. A
116
+ truncated tool name reports the truncated, hash-suffixed tool part.
117
+
98
118
  ## Connect to Ory Agent Security
99
119
 
100
120
  Copy the connection details from the [Ory Console](https://console.ory.sh) under **Agent Security**:
@@ -115,7 +135,7 @@ npx -y -p @ory/cline ory-cline configure \
115
135
 
116
136
  **Ory Network or OEL.** Either works. For an Ory Network project the URL is `https://<slug>.projects.oryapis.com`; for a self-hosted **Ory Enterprise License** deployment, point `--project-url` at that deployment's base URL and use the sign-in client id from its Agent Security configuration. Everything downstream — sign-in, checks, delegation — is identical.
117
137
 
118
- **There is nothing else for you to create.** The sign-in client, permission model, native-tool blocks, MCP grants, and observe/enforce posture are provisioned in the Console by someone with project access. At session start the plugin loads or enrolls Cline's Talos runtime credential in the OS credential store; tool paths only read it. Installing needs no workspace privilege.
138
+ **There is nothing else for you to create.** The sign-in client, permission model, native-tool blocks, MCP server access, and observe/enforce posture are provisioned in the Console by someone with project access. At session start the plugin loads or enrolls Cline's Talos runtime credential in the OS credential store; tool paths only read it. Installing needs no workspace privilege.
119
139
 
120
140
  Sign-in runs at the start of every session and never blocks — a declined, skipped, or timed-out login simply leaves that session without a user identity.
121
141
 
package/dist/handlers.js CHANGED
@@ -1,8 +1,97 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.handleHookEvent = handleHookEvent;
37
+ const fs = __importStar(require("node:fs"));
38
+ const os = __importStar(require("node:os"));
39
+ const path = __importStar(require("node:path"));
4
40
  const argus_1 = require("@ory/argus");
5
41
  const HARNESS = "cline";
42
+ /**
43
+ * Identify an MCP tool call.
44
+ *
45
+ * Cline 3 names an MCP tool `<server>__<tool>` (`defaultMcpToolNameTransform`
46
+ * in @cline/core 0.0.51, shipped with cline@3.0.29): runs of characters outside
47
+ * `[a-zA-Z0-9_-]` become `_`, and a name over 128 characters is truncated and
48
+ * suffixed with a hash. The configured server keys split a server name that
49
+ * itself contains `__`; otherwise the first `__` splits it. No Cline 3 native
50
+ * tool name contains `__`. The legacy `use_mcp_tool` tool carries the server
51
+ * and tool in its arguments.
52
+ */
53
+ function identifyMcpTool(toolName, toolArgs) {
54
+ if (toolName === "use_mcp_tool")
55
+ return (0, argus_1.parseMcpToolArgs)(toolArgs) ?? undefined;
56
+ if (!toolName.includes("__"))
57
+ return undefined;
58
+ const servers = configuredMcpServers();
59
+ const configured = (0, argus_1.parseMcpToolWithSeparator)(toolName, "__", servers.keys());
60
+ if (configured)
61
+ return { serverName: servers.get(configured.serverName), toolName: configured.toolName };
62
+ return (0, argus_1.parseMcpToolWithSeparator)(toolName, "__") ?? undefined;
63
+ }
64
+ /**
65
+ * The server keys in Cline's MCP settings file, keyed by the sanitized prefix
66
+ * Cline puts on their tools. Path resolution mirrors @cline/shared
67
+ * `resolveMcpSettingsPath`: `CLINE_MCP_SETTINGS_PATH`, else
68
+ * `<CLINE_DATA_DIR | (CLINE_DIR | ~/.cline)/data>/settings/cline_mcp_settings.json`.
69
+ * Only the `mcpServers` keys are read; server definitions are ignored.
70
+ */
71
+ function configuredMcpServers() {
72
+ const servers = new Map();
73
+ try {
74
+ const settings = JSON.parse(fs.readFileSync(mcpSettingsPath(), "utf-8"));
75
+ if (settings.mcpServers && typeof settings.mcpServers === "object" && !Array.isArray(settings.mcpServers)) {
76
+ for (const name of Object.keys(settings.mcpServers)) {
77
+ if (name.trim() !== "")
78
+ servers.set(name.replace(/[^a-zA-Z0-9_-]+/g, "_"), name);
79
+ }
80
+ }
81
+ }
82
+ catch {
83
+ // Missing or unreadable settings: fall back to the first `__` split.
84
+ }
85
+ return servers;
86
+ }
87
+ function mcpSettingsPath() {
88
+ const explicit = process.env.CLINE_MCP_SETTINGS_PATH?.trim();
89
+ if (explicit)
90
+ return explicit;
91
+ const dataDir = process.env.CLINE_DATA_DIR?.trim() ||
92
+ path.join(process.env.CLINE_DIR?.trim() || path.join(process.env.HOME?.trim() || os.homedir(), ".cline"), "data");
93
+ return path.join(dataDir, "settings", "cline_mcp_settings.json");
94
+ }
6
95
  /**
7
96
  * Route a Cline file-hook event to Ory. Cline blocks a `tool_call` with
8
97
  * `{ cancel: true, errorMessage }`.
@@ -39,6 +128,7 @@ async function handleHookEvent(input, client, deps = {}) {
39
128
  harness: HARNESS,
40
129
  toolName,
41
130
  toolArgs,
131
+ mcpTool: identifyMcpTool(toolName, toolArgs),
42
132
  subjectFallback: `session:${input.taskId}`,
43
133
  principals: actingSubagentPrincipals(input),
44
134
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ory/cline",
3
- "version": "1.5.3",
3
+ "version": "1.7.0",
4
4
  "description": "Ory plugin for Cline: scaffolding skills, a local Ory instance, and authentication, authorization, and audit for every tool call",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://ory.com",
@@ -69,10 +69,10 @@
69
69
  ],
70
70
  "dependencies": {
71
71
  "reova": "^0.7.0",
72
- "@ory/argus": "1.5.3"
72
+ "@ory/argus": "1.7.0"
73
73
  },
74
74
  "devDependencies": {
75
- "typescript": "^6.0.2"
75
+ "typescript": "^7.0.2"
76
76
  },
77
77
  "engines": {
78
78
  "node": ">=22"