@rolexjs/mcp-server 0.9.1 → 0.11.0-dev.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 +320 -347
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,412 +1,385 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
+
import { localPlatform } from "@rolexjs/local-platform";
|
|
4
5
|
import { FastMCP } from "fastmcp";
|
|
6
|
+
import { createRoleX, detail } from "rolexjs";
|
|
5
7
|
import { z } from "zod";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
nextFinish,
|
|
31
|
-
bootstrap
|
|
32
|
-
} from "rolexjs";
|
|
33
|
-
import { LocalPlatform } from "@rolexjs/local-platform";
|
|
34
|
-
import { join } from "path";
|
|
35
|
-
import { homedir } from "os";
|
|
36
|
-
var DEFAULT_ROLEX_DIR = join(homedir(), ".rolex");
|
|
37
|
-
var rolexDir = process.argv[2] || process.env.ROLEX_DIR || DEFAULT_ROLEX_DIR;
|
|
38
|
-
var platform = new LocalPlatform(rolexDir);
|
|
39
|
-
bootstrap(platform);
|
|
40
|
-
var rolex = new Rolex(platform);
|
|
41
|
-
var currentRole = null;
|
|
42
|
-
var currentRoleName = "";
|
|
43
|
-
var server = new FastMCP({
|
|
44
|
-
name: "Rolex MCP Server",
|
|
45
|
-
version: "0.2.0",
|
|
46
|
-
instructions: INSTRUCTIONS
|
|
47
|
-
});
|
|
48
|
-
function requireRole() {
|
|
49
|
-
if (!currentRole) {
|
|
50
|
-
throw new Error("No active role. Call identity(roleId) first to activate a role.");
|
|
8
|
+
|
|
9
|
+
// src/instructions.ts
|
|
10
|
+
import { world } from "rolexjs";
|
|
11
|
+
var instructions = [
|
|
12
|
+
world["cognitive-priority"],
|
|
13
|
+
world["role-identity"],
|
|
14
|
+
world.execution,
|
|
15
|
+
world.cognition,
|
|
16
|
+
world.memory,
|
|
17
|
+
world.gherkin,
|
|
18
|
+
world.communication,
|
|
19
|
+
world["skill-system"],
|
|
20
|
+
world["state-origin"]
|
|
21
|
+
].join("\n\n");
|
|
22
|
+
|
|
23
|
+
// src/render.ts
|
|
24
|
+
import { describe, hint, renderState } from "rolexjs";
|
|
25
|
+
function render(opts) {
|
|
26
|
+
const { process, name, result, cognitiveHint } = opts;
|
|
27
|
+
const lines = [];
|
|
28
|
+
lines.push(describe(process, name, result.state));
|
|
29
|
+
lines.push(hint(process));
|
|
30
|
+
if (cognitiveHint) {
|
|
31
|
+
lines.push(`I \u2192 ${cognitiveHint}`);
|
|
51
32
|
}
|
|
52
|
-
|
|
33
|
+
lines.push("");
|
|
34
|
+
lines.push(renderState(result.state));
|
|
35
|
+
return lines.join("\n");
|
|
53
36
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
37
|
+
|
|
38
|
+
// src/state.ts
|
|
39
|
+
var McpState = class {
|
|
40
|
+
constructor(rolex2) {
|
|
41
|
+
this.rolex = rolex2;
|
|
58
42
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
43
|
+
activeRoleId = null;
|
|
44
|
+
focusedGoalId = null;
|
|
45
|
+
focusedPlanId = null;
|
|
46
|
+
encounterIds = /* @__PURE__ */ new Set();
|
|
47
|
+
experienceIds = /* @__PURE__ */ new Set();
|
|
48
|
+
// ================================================================
|
|
49
|
+
// Requirements — throw if missing
|
|
50
|
+
// ================================================================
|
|
51
|
+
requireRoleId() {
|
|
52
|
+
if (!this.activeRoleId) throw new Error("No active role. Call activate first.");
|
|
53
|
+
return this.activeRoleId;
|
|
54
|
+
}
|
|
55
|
+
requireGoalId() {
|
|
56
|
+
if (!this.focusedGoalId) throw new Error("No focused goal. Call want first.");
|
|
57
|
+
return this.focusedGoalId;
|
|
58
|
+
}
|
|
59
|
+
requirePlanId() {
|
|
60
|
+
if (!this.focusedPlanId) throw new Error("No focused plan. Call plan first.");
|
|
61
|
+
return this.focusedPlanId;
|
|
62
|
+
}
|
|
63
|
+
// ================================================================
|
|
64
|
+
// Cognition registries — encounter / experience ids
|
|
65
|
+
// ================================================================
|
|
66
|
+
addEncounter(id) {
|
|
67
|
+
this.encounterIds.add(id);
|
|
68
|
+
}
|
|
69
|
+
requireEncounterIds(ids) {
|
|
70
|
+
for (const id of ids) {
|
|
71
|
+
if (!this.encounterIds.has(id)) throw new Error(`Encounter not found: "${id}"`);
|
|
67
72
|
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
description: DESC_SOCIETY,
|
|
73
|
-
parameters: z.object({
|
|
74
|
-
operation: z.enum(["born", "found", "establish", "directory", "find", "teach"]).describe("The society operation to perform"),
|
|
75
|
-
name: z.string().optional().describe(
|
|
76
|
-
"Role name (born/find/teach), organization name (found), or position name (establish)"
|
|
77
|
-
),
|
|
78
|
-
source: z.string().optional().describe(
|
|
79
|
-
"Gherkin feature source (born: persona, teach: knowledge, found: org description, establish: position duties)"
|
|
80
|
-
),
|
|
81
|
-
parent: z.string().optional().describe("Parent organization name (for found with nesting)"),
|
|
82
|
-
orgName: z.string().optional().describe("Organization name (for establish)"),
|
|
83
|
-
roleId: z.string().optional().describe("Target role name for teach operation"),
|
|
84
|
-
type: z.enum(["knowledge", "experience", "voice"]).optional().describe("Growth dimension for teach operation"),
|
|
85
|
-
dimensionName: z.string().optional().describe("Name for the knowledge being taught (e.g. 'distributed-systems')")
|
|
86
|
-
}),
|
|
87
|
-
execute: safeTool(
|
|
88
|
-
"society",
|
|
89
|
-
async ({ operation, name, source, parent, orgName, roleId, type, dimensionName }) => {
|
|
90
|
-
const denied = requireNuwa();
|
|
91
|
-
if (denied) return denied;
|
|
92
|
-
switch (operation) {
|
|
93
|
-
case "born": {
|
|
94
|
-
if (!name || !source) throw new Error("born requires: name, source");
|
|
95
|
-
const feature = rolex.born(name, source);
|
|
96
|
-
return next(`Role born: ${feature.name}`, NEXT.born);
|
|
97
|
-
}
|
|
98
|
-
case "found": {
|
|
99
|
-
if (!name) throw new Error("found requires: name");
|
|
100
|
-
rolex.found(name, source, parent);
|
|
101
|
-
return next(`Organization founded: ${name}`, NEXT.found);
|
|
102
|
-
}
|
|
103
|
-
case "establish": {
|
|
104
|
-
if (!name || !source || !orgName)
|
|
105
|
-
throw new Error("establish requires: name, source, orgName");
|
|
106
|
-
rolex.establish(name, source, orgName);
|
|
107
|
-
return next(`Position established: ${name} in ${orgName}`, NEXT.establish);
|
|
108
|
-
}
|
|
109
|
-
case "directory": {
|
|
110
|
-
const dir = rolex.directory();
|
|
111
|
-
const lines = [];
|
|
112
|
-
if (dir.organizations.length > 0) {
|
|
113
|
-
for (const org of dir.organizations) {
|
|
114
|
-
const parentStr = org.parent ? ` (parent: ${org.parent})` : "";
|
|
115
|
-
lines.push(`Organization: ${org.name}${parentStr}`);
|
|
116
|
-
if (org.positions.length > 0) {
|
|
117
|
-
lines.push(" Positions:");
|
|
118
|
-
for (const pos of org.positions) {
|
|
119
|
-
const posInfo = platform.getPosition(pos, org.name);
|
|
120
|
-
const holder = posInfo?.assignedRole ? ` \u2190 ${posInfo.assignedRole}` : " (vacant)";
|
|
121
|
-
lines.push(` - ${pos}${holder}`);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (org.members.length > 0) {
|
|
125
|
-
lines.push(" Members:");
|
|
126
|
-
for (const member of org.members) {
|
|
127
|
-
const role = dir.roles.find((r) => r.name === member);
|
|
128
|
-
const state = role ? ` [${role.state}]` : "";
|
|
129
|
-
const pos = role?.position ? ` \u2192 ${role.position}` : "";
|
|
130
|
-
lines.push(` - ${member}${state}${pos}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
const freeRoles = dir.roles.filter((r) => r.state === "free");
|
|
136
|
-
if (freeRoles.length > 0) {
|
|
137
|
-
if (lines.length > 0) lines.push("");
|
|
138
|
-
lines.push("Free Roles:");
|
|
139
|
-
for (const role of freeRoles) {
|
|
140
|
-
lines.push(` - ${role.name}`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return lines.join("\n") || "No roles or organizations found.";
|
|
144
|
-
}
|
|
145
|
-
case "find": {
|
|
146
|
-
if (!name) throw new Error("find requires: name");
|
|
147
|
-
const result = rolex.find(name);
|
|
148
|
-
if (result instanceof Organization) {
|
|
149
|
-
const info = result.info();
|
|
150
|
-
const parentStr = info.parent ? ` (parent: ${info.parent})` : "";
|
|
151
|
-
return `Organization: ${info.name}${parentStr}
|
|
152
|
-
Members: ${info.members.length}
|
|
153
|
-
Positions: ${info.positions.join(", ") || "none"}`;
|
|
154
|
-
}
|
|
155
|
-
if (result instanceof Position) {
|
|
156
|
-
const info = result.info();
|
|
157
|
-
return `Position: ${info.name} in ${info.org}
|
|
158
|
-
State: ${info.state}
|
|
159
|
-
Assigned: ${info.assignedRole || "none"}
|
|
160
|
-
Duties: ${info.duties.length}`;
|
|
161
|
-
}
|
|
162
|
-
const features = result.identity();
|
|
163
|
-
return renderFeatures(features);
|
|
164
|
-
}
|
|
165
|
-
case "teach": {
|
|
166
|
-
if (!roleId || !type || !dimensionName || !source)
|
|
167
|
-
throw new Error("teach requires: roleId, type, dimensionName, source");
|
|
168
|
-
const feature = rolex.teach(roleId, type, dimensionName, source);
|
|
169
|
-
return next(`Taught ${type}: ${feature.name}`, NEXT.teach);
|
|
170
|
-
}
|
|
171
|
-
default:
|
|
172
|
-
throw new Error(`Unknown society operation: ${operation}`);
|
|
173
|
-
}
|
|
73
|
+
}
|
|
74
|
+
consumeEncounters(ids) {
|
|
75
|
+
for (const id of ids) {
|
|
76
|
+
this.encounterIds.delete(id);
|
|
174
77
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
name: z.string().describe("Role name to hire, fire, appoint, or dismiss"),
|
|
183
|
-
position: z.string().optional().describe("Position name (for appoint)"),
|
|
184
|
-
orgName: z.string().optional().describe("Target organization name (for hire, required when multiple organizations exist)")
|
|
185
|
-
}),
|
|
186
|
-
execute: safeTool("organization", async ({ operation, name, position, orgName: targetOrg }) => {
|
|
187
|
-
const denied = requireNuwa();
|
|
188
|
-
if (denied) return denied;
|
|
189
|
-
const dir = rolex.directory();
|
|
190
|
-
if (dir.organizations.length === 0) {
|
|
191
|
-
throw new Error("No organization found. Call found() first.");
|
|
78
|
+
}
|
|
79
|
+
addExperience(id) {
|
|
80
|
+
this.experienceIds.add(id);
|
|
81
|
+
}
|
|
82
|
+
requireExperienceIds(ids) {
|
|
83
|
+
for (const id of ids) {
|
|
84
|
+
if (!this.experienceIds.has(id)) throw new Error(`Experience not found: "${id}"`);
|
|
192
85
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
} else if (dir.organizations.length === 1) {
|
|
198
|
-
orgName = dir.organizations[0].name;
|
|
199
|
-
} else {
|
|
200
|
-
const orgNames = dir.organizations.map((o) => o.name).join(", ");
|
|
201
|
-
throw new Error(
|
|
202
|
-
`Multiple organizations exist (${orgNames}). Specify orgName to indicate which one.`
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
} else {
|
|
206
|
-
const assignment = platform.getAssignment(name);
|
|
207
|
-
orgName = assignment?.org ?? dir.organizations[0].name;
|
|
86
|
+
}
|
|
87
|
+
consumeExperiences(ids) {
|
|
88
|
+
for (const id of ids) {
|
|
89
|
+
this.experienceIds.delete(id);
|
|
208
90
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
91
|
+
}
|
|
92
|
+
// ================================================================
|
|
93
|
+
// Lookup
|
|
94
|
+
// ================================================================
|
|
95
|
+
findIndividual(roleId) {
|
|
96
|
+
return this.rolex.find(roleId) !== null;
|
|
97
|
+
}
|
|
98
|
+
// ================================================================
|
|
99
|
+
// Activation helpers
|
|
100
|
+
// ================================================================
|
|
101
|
+
/** Rehydrate ids from an activation projection. */
|
|
102
|
+
cacheFromActivation(state2) {
|
|
103
|
+
this.rehydrate(state2);
|
|
104
|
+
}
|
|
105
|
+
/** Walk the state tree and collect ids into the appropriate registries. */
|
|
106
|
+
rehydrate(node) {
|
|
107
|
+
if (node.id) {
|
|
108
|
+
switch (node.name) {
|
|
109
|
+
case "goal":
|
|
110
|
+
if (!this.focusedGoalId) this.focusedGoalId = node.id;
|
|
111
|
+
break;
|
|
112
|
+
case "encounter":
|
|
113
|
+
this.encounterIds.add(node.id);
|
|
114
|
+
break;
|
|
115
|
+
case "experience":
|
|
116
|
+
this.experienceIds.add(node.id);
|
|
117
|
+
break;
|
|
214
118
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
119
|
+
}
|
|
120
|
+
for (const child of node.children ?? []) {
|
|
121
|
+
this.rehydrate(child);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// ================================================================
|
|
125
|
+
// Cognitive hints — state-aware AI self-direction cues
|
|
126
|
+
// ================================================================
|
|
127
|
+
/** First-person, state-aware hint for the AI after an operation. */
|
|
128
|
+
cognitiveHint(process) {
|
|
129
|
+
switch (process) {
|
|
130
|
+
case "activate":
|
|
131
|
+
if (!this.focusedGoalId)
|
|
132
|
+
return "I have no goal yet. I should call `want` to declare one, or `focus` to review existing goals.";
|
|
133
|
+
return "I have an active goal. I should call `focus` to review progress, or `want` to declare a new goal.";
|
|
134
|
+
case "focus":
|
|
135
|
+
if (!this.focusedPlanId)
|
|
136
|
+
return "I have a goal but no plan. I should call `plan` to design how to achieve it.";
|
|
137
|
+
return "I have a plan. I should call `todo` to create tasks, or continue working.";
|
|
138
|
+
case "want":
|
|
139
|
+
return "Goal declared. I should call `plan` to design how to achieve it.";
|
|
140
|
+
case "plan":
|
|
141
|
+
return "Plan created. I should call `todo` to create concrete tasks.";
|
|
142
|
+
case "todo":
|
|
143
|
+
return "Task created. I can add more with `todo`, or start working and call `finish` when done.";
|
|
144
|
+
case "finish": {
|
|
145
|
+
const encCount = this.encounterIds.size;
|
|
146
|
+
if (encCount > 0 && !this.focusedGoalId)
|
|
147
|
+
return `Task finished. No more goals \u2014 I have ${encCount} encounter(s) to choose from for \`reflect\`, or \`want\` a new goal.`;
|
|
148
|
+
return "Task finished. I should continue with remaining tasks, or call `complete` when the plan is done.";
|
|
218
149
|
}
|
|
219
|
-
case "
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
150
|
+
case "complete":
|
|
151
|
+
case "abandon": {
|
|
152
|
+
const encCount = this.encounterIds.size;
|
|
153
|
+
if (encCount > 0)
|
|
154
|
+
return `Plan closed. I have ${encCount} encounter(s) to choose from for \`reflect\`, or I can continue with other plans.`;
|
|
155
|
+
return "Plan closed. I can create a new `plan`, or `focus` on another goal.";
|
|
223
156
|
}
|
|
224
|
-
case "
|
|
225
|
-
|
|
226
|
-
|
|
157
|
+
case "reflect": {
|
|
158
|
+
const expCount = this.experienceIds.size;
|
|
159
|
+
if (expCount > 0)
|
|
160
|
+
return `Experience gained. I can \`realize\` principles or \`master\` procedures \u2014 ${expCount} experience(s) available.`;
|
|
161
|
+
return "Experience gained. I can `realize` a principle, `master` a procedure, or continue working.";
|
|
227
162
|
}
|
|
163
|
+
case "realize":
|
|
164
|
+
return "Principle added to knowledge. I should continue working.";
|
|
165
|
+
case "master":
|
|
166
|
+
return "Procedure added to knowledge. I should continue working.";
|
|
228
167
|
default:
|
|
229
|
-
|
|
168
|
+
return null;
|
|
230
169
|
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
server.addTool({
|
|
234
|
-
name: "identity",
|
|
235
|
-
description: DESC_IDENTITY,
|
|
236
|
-
parameters: z.object({
|
|
237
|
-
roleId: z.string().describe("Role name (e.g. 'sean')")
|
|
238
|
-
}),
|
|
239
|
-
execute: safeTool("identity", async ({ roleId }) => {
|
|
240
|
-
currentRole = rolex.role(roleId);
|
|
241
|
-
currentRoleName = roleId;
|
|
242
|
-
const features = currentRole.identity();
|
|
243
|
-
const { current } = currentRole.focus();
|
|
244
|
-
const assignment = platform.getAssignment(roleId);
|
|
245
|
-
const statusBar = renderStatusBar(roleId, current, assignment?.org, assignment?.position);
|
|
246
|
-
return `${statusBar}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
247
172
|
|
|
248
|
-
|
|
249
|
-
|
|
173
|
+
// src/index.ts
|
|
174
|
+
var rolex = createRoleX(localPlatform());
|
|
175
|
+
var state = new McpState(rolex);
|
|
176
|
+
var server = new FastMCP({
|
|
177
|
+
name: "rolex",
|
|
178
|
+
version: "0.11.0",
|
|
179
|
+
instructions
|
|
250
180
|
});
|
|
181
|
+
function fmt(process, label, result) {
|
|
182
|
+
return render({
|
|
183
|
+
process,
|
|
184
|
+
name: label,
|
|
185
|
+
result,
|
|
186
|
+
cognitiveHint: state.cognitiveHint(process)
|
|
187
|
+
});
|
|
188
|
+
}
|
|
251
189
|
server.addTool({
|
|
252
|
-
name: "
|
|
253
|
-
description:
|
|
190
|
+
name: "activate",
|
|
191
|
+
description: detail("activate"),
|
|
254
192
|
parameters: z.object({
|
|
255
|
-
|
|
256
|
-
"Growth dimension: knowledge (what I know), experience (what I've lived), voice (how I'm perceived)"
|
|
257
|
-
),
|
|
258
|
-
name: z.string().describe("Name for this growth (used as filename, e.g. 'distributed-systems')"),
|
|
259
|
-
source: z.string().describe("Gherkin feature source text")
|
|
193
|
+
roleId: z.string().describe("Role name to activate")
|
|
260
194
|
}),
|
|
261
|
-
execute:
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
195
|
+
execute: async ({ roleId }) => {
|
|
196
|
+
if (!state.findIndividual(roleId)) {
|
|
197
|
+
rolex.individual.born(void 0, roleId);
|
|
198
|
+
}
|
|
199
|
+
state.activeRoleId = roleId;
|
|
200
|
+
const result = await rolex.role.activate(roleId);
|
|
201
|
+
state.cacheFromActivation(result.state);
|
|
202
|
+
return fmt("activate", roleId, result);
|
|
203
|
+
}
|
|
266
204
|
});
|
|
267
205
|
server.addTool({
|
|
268
206
|
name: "focus",
|
|
269
|
-
description:
|
|
207
|
+
description: detail("focus"),
|
|
270
208
|
parameters: z.object({
|
|
271
|
-
|
|
209
|
+
id: z.string().optional().describe("Goal id to switch to. Omit to view current.")
|
|
272
210
|
}),
|
|
273
|
-
execute:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
const statusBar = renderStatusBar(
|
|
278
|
-
currentRoleName,
|
|
279
|
-
current,
|
|
280
|
-
assignment?.org,
|
|
281
|
-
assignment?.position
|
|
282
|
-
);
|
|
283
|
-
if (!current && otherGoals.length === 0)
|
|
284
|
-
return `${statusBar}
|
|
285
|
-
|
|
286
|
-
No active goal. Use want() to set a new goal.`;
|
|
287
|
-
const parts = [statusBar];
|
|
288
|
-
if (current) {
|
|
289
|
-
parts.push(renderFeature(current));
|
|
290
|
-
if (current.plan) {
|
|
291
|
-
parts.push(renderFeature(current.plan));
|
|
292
|
-
}
|
|
293
|
-
for (const task of current.tasks) {
|
|
294
|
-
parts.push(renderFeature(task));
|
|
295
|
-
}
|
|
211
|
+
execute: async ({ id }) => {
|
|
212
|
+
if (id) {
|
|
213
|
+
state.focusedGoalId = id;
|
|
214
|
+
state.focusedPlanId = null;
|
|
296
215
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return parts.join("\n\n");
|
|
304
|
-
})
|
|
216
|
+
const goalId = state.requireGoalId();
|
|
217
|
+
const result = rolex.role.focus(goalId);
|
|
218
|
+
return fmt("focus", id ?? "current goal", result);
|
|
219
|
+
}
|
|
305
220
|
});
|
|
306
221
|
server.addTool({
|
|
307
222
|
name: "want",
|
|
308
|
-
description:
|
|
223
|
+
description: detail("want"),
|
|
309
224
|
parameters: z.object({
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
testable: z.boolean().optional().default(false).describe("Whether this goal's scenarios should become persistent automated verification")
|
|
225
|
+
id: z.string().describe("Goal id (used for focus/reference)"),
|
|
226
|
+
goal: z.string().describe("Gherkin Feature source describing the goal")
|
|
313
227
|
}),
|
|
314
|
-
execute:
|
|
315
|
-
const
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
228
|
+
execute: async ({ id, goal }) => {
|
|
229
|
+
const roleId = state.requireRoleId();
|
|
230
|
+
const result = rolex.role.want(roleId, goal, id);
|
|
231
|
+
state.focusedGoalId = id;
|
|
232
|
+
state.focusedPlanId = null;
|
|
233
|
+
return fmt("want", id, result);
|
|
234
|
+
}
|
|
319
235
|
});
|
|
320
236
|
server.addTool({
|
|
321
237
|
name: "plan",
|
|
322
|
-
description:
|
|
238
|
+
description: detail("plan"),
|
|
323
239
|
parameters: z.object({
|
|
324
|
-
|
|
240
|
+
id: z.string().describe("Plan id \u2014 keywords from the plan content joined by hyphens"),
|
|
241
|
+
plan: z.string().describe("Gherkin Feature source describing the plan")
|
|
325
242
|
}),
|
|
326
|
-
execute:
|
|
327
|
-
const
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
|
|
243
|
+
execute: async ({ id, plan }) => {
|
|
244
|
+
const goalId = state.requireGoalId();
|
|
245
|
+
const result = rolex.role.plan(goalId, plan, id);
|
|
246
|
+
state.focusedPlanId = id;
|
|
247
|
+
return fmt("plan", id, result);
|
|
248
|
+
}
|
|
331
249
|
});
|
|
332
250
|
server.addTool({
|
|
333
251
|
name: "todo",
|
|
334
|
-
description:
|
|
252
|
+
description: detail("todo"),
|
|
335
253
|
parameters: z.object({
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
testable: z.boolean().optional().default(false).describe("Whether this task's scenarios should become unit or integration tests")
|
|
254
|
+
id: z.string().describe("Task id (used for finish/reference)"),
|
|
255
|
+
task: z.string().describe("Gherkin Feature source describing the task")
|
|
339
256
|
}),
|
|
340
|
-
execute:
|
|
341
|
-
const
|
|
342
|
-
const
|
|
343
|
-
return
|
|
344
|
-
}
|
|
257
|
+
execute: async ({ id, task }) => {
|
|
258
|
+
const planId = state.requirePlanId();
|
|
259
|
+
const result = rolex.role.todo(planId, task, id);
|
|
260
|
+
return fmt("todo", id, result);
|
|
261
|
+
}
|
|
345
262
|
});
|
|
346
263
|
server.addTool({
|
|
347
|
-
name: "
|
|
348
|
-
description:
|
|
264
|
+
name: "finish",
|
|
265
|
+
description: detail("finish"),
|
|
349
266
|
parameters: z.object({
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
)
|
|
267
|
+
id: z.string().describe("Task id to finish"),
|
|
268
|
+
encounter: z.string().optional().describe("Optional Gherkin Feature describing what happened")
|
|
353
269
|
}),
|
|
354
|
-
execute:
|
|
355
|
-
const
|
|
356
|
-
role.
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
|
|
270
|
+
execute: async ({ id, encounter }) => {
|
|
271
|
+
const roleId = state.requireRoleId();
|
|
272
|
+
const result = rolex.role.finish(id, roleId, encounter);
|
|
273
|
+
const encId = result.state.id ?? id;
|
|
274
|
+
state.addEncounter(encId);
|
|
275
|
+
return fmt("finish", id, result);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
server.addTool({
|
|
279
|
+
name: "complete",
|
|
280
|
+
description: detail("complete"),
|
|
281
|
+
parameters: z.object({
|
|
282
|
+
id: z.string().optional().describe("Plan id to complete (defaults to focused plan)"),
|
|
283
|
+
encounter: z.string().optional().describe("Optional Gherkin Feature describing what happened")
|
|
284
|
+
}),
|
|
285
|
+
execute: async ({ id, encounter }) => {
|
|
286
|
+
const roleId = state.requireRoleId();
|
|
287
|
+
const planId = id ?? state.requirePlanId();
|
|
288
|
+
const result = rolex.role.complete(planId, roleId, encounter);
|
|
289
|
+
const encId = result.state.id ?? planId;
|
|
290
|
+
state.addEncounter(encId);
|
|
291
|
+
if (state.focusedPlanId === planId) state.focusedPlanId = null;
|
|
292
|
+
return fmt("complete", planId, result);
|
|
293
|
+
}
|
|
360
294
|
});
|
|
361
295
|
server.addTool({
|
|
362
296
|
name: "abandon",
|
|
363
|
-
description:
|
|
297
|
+
description: detail("abandon"),
|
|
364
298
|
parameters: z.object({
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
)
|
|
299
|
+
id: z.string().optional().describe("Plan id to abandon (defaults to focused plan)"),
|
|
300
|
+
encounter: z.string().optional().describe("Optional Gherkin Feature describing what happened")
|
|
368
301
|
}),
|
|
369
|
-
execute:
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
302
|
+
execute: async ({ id, encounter }) => {
|
|
303
|
+
const roleId = state.requireRoleId();
|
|
304
|
+
const planId = id ?? state.requirePlanId();
|
|
305
|
+
const result = rolex.role.abandon(planId, roleId, encounter);
|
|
306
|
+
const encId = result.state.id ?? planId;
|
|
307
|
+
state.addEncounter(encId);
|
|
308
|
+
if (state.focusedPlanId === planId) state.focusedPlanId = null;
|
|
309
|
+
return fmt("abandon", planId, result);
|
|
310
|
+
}
|
|
375
311
|
});
|
|
376
312
|
server.addTool({
|
|
377
313
|
name: "reflect",
|
|
378
|
-
description:
|
|
314
|
+
description: detail("reflect"),
|
|
379
315
|
parameters: z.object({
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
)
|
|
383
|
-
knowledgeName: z.string().describe(
|
|
384
|
-
"Name for the resulting knowledge (used as filename, e.g. 'authentication-principles')"
|
|
385
|
-
),
|
|
386
|
-
knowledgeSource: z.string().describe("Gherkin feature source text for the knowledge")
|
|
316
|
+
ids: z.array(z.string()).describe("Encounter ids to reflect on (selective consumption)"),
|
|
317
|
+
id: z.string().describe("Experience id \u2014 keywords from the experience content joined by hyphens"),
|
|
318
|
+
experience: z.string().optional().describe("Gherkin Feature source for the experience")
|
|
387
319
|
}),
|
|
388
|
-
execute:
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
);
|
|
395
|
-
}
|
|
320
|
+
execute: async ({ ids, id, experience }) => {
|
|
321
|
+
state.requireEncounterIds(ids);
|
|
322
|
+
const roleId = state.requireRoleId();
|
|
323
|
+
const result = rolex.role.reflect(ids[0], roleId, experience, id);
|
|
324
|
+
state.consumeEncounters(ids);
|
|
325
|
+
state.addExperience(id);
|
|
326
|
+
return fmt("reflect", id, result);
|
|
327
|
+
}
|
|
396
328
|
});
|
|
397
329
|
server.addTool({
|
|
398
|
-
name: "
|
|
399
|
-
description:
|
|
330
|
+
name: "realize",
|
|
331
|
+
description: detail("realize"),
|
|
332
|
+
parameters: z.object({
|
|
333
|
+
ids: z.array(z.string()).describe("Experience ids to distill into a principle"),
|
|
334
|
+
id: z.string().describe("Principle id \u2014 keywords from the principle content joined by hyphens"),
|
|
335
|
+
principle: z.string().optional().describe("Gherkin Feature source for the principle")
|
|
336
|
+
}),
|
|
337
|
+
execute: async ({ ids, id, principle }) => {
|
|
338
|
+
state.requireExperienceIds(ids);
|
|
339
|
+
const roleId = state.requireRoleId();
|
|
340
|
+
const result = rolex.role.realize(ids[0], roleId, principle, id);
|
|
341
|
+
state.consumeExperiences(ids);
|
|
342
|
+
return fmt("realize", id, result);
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
server.addTool({
|
|
346
|
+
name: "master",
|
|
347
|
+
description: detail("master"),
|
|
348
|
+
parameters: z.object({
|
|
349
|
+
ids: z.array(z.string()).describe("Experience ids to distill into a procedure"),
|
|
350
|
+
id: z.string().describe("Procedure id \u2014 keywords from the procedure content joined by hyphens"),
|
|
351
|
+
procedure: z.string().optional().describe("Gherkin Feature source for the procedure")
|
|
352
|
+
}),
|
|
353
|
+
execute: async ({ ids, id, procedure }) => {
|
|
354
|
+
state.requireExperienceIds(ids);
|
|
355
|
+
const roleId = state.requireRoleId();
|
|
356
|
+
const result = rolex.role.master(ids[0], roleId, procedure, id);
|
|
357
|
+
state.consumeExperiences(ids);
|
|
358
|
+
return fmt("master", id, result);
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
server.addTool({
|
|
362
|
+
name: "forget",
|
|
363
|
+
description: detail("forget"),
|
|
400
364
|
parameters: z.object({
|
|
401
|
-
|
|
365
|
+
id: z.string().describe("Id of the node to remove (principle, procedure, experience, encounter, etc.)")
|
|
402
366
|
}),
|
|
403
|
-
execute:
|
|
404
|
-
const
|
|
405
|
-
role.
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
367
|
+
execute: async ({ id }) => {
|
|
368
|
+
const roleId = state.requireRoleId();
|
|
369
|
+
const result = await rolex.role.forget(id, roleId);
|
|
370
|
+
return fmt("forget", id, result);
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
server.addTool({
|
|
374
|
+
name: "skill",
|
|
375
|
+
description: detail("skill"),
|
|
376
|
+
parameters: z.object({
|
|
377
|
+
locator: z.string().describe("ResourceX locator for the skill (e.g. deepractice/role-management)")
|
|
378
|
+
}),
|
|
379
|
+
execute: async ({ locator }) => {
|
|
380
|
+
const content = await rolex.role.skill(locator);
|
|
381
|
+
return content;
|
|
382
|
+
}
|
|
410
383
|
});
|
|
411
384
|
server.start({
|
|
412
385
|
transportType: "stdio"
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @rolexjs/mcp-server\n *\n * MCP server for Rolex — Role-Driven Development.\n *\n * Three-entity architecture:\n * Role = WHO (identity, goals)\n * Organization = WHERE (structure, nesting)\n * Position = WHAT (duties, boundaries)\n *\n * Tools:\n * society — Admin: born, found, establish, directory, find, teach\n * organization — Admin: hire, fire, appoint, dismiss\n * identity — Activate a role\n * growup/focus/want/plan/todo/achieve/abandon/finish — Role lifecycle\n *\n * Usage:\n * rolex-mcp [.rolex-dir]\n */\n\nimport { FastMCP } from \"fastmcp\";\nimport { z } from \"zod\";\nimport {\n Rolex,\n Organization,\n Role,\n Position,\n INSTRUCTIONS,\n DESC_SOCIETY,\n DESC_ORGANIZATION,\n DESC_GROWUP,\n DESC_IDENTITY,\n DESC_FOCUS,\n DESC_WANT,\n DESC_PLAN,\n DESC_TODO,\n DESC_ACHIEVE,\n DESC_ABANDON,\n DESC_REFLECT,\n DESC_FINISH,\n renderFeatures,\n renderFeature,\n renderStatusBar,\n renderError,\n next,\n NEXT,\n nextHire,\n nextFinish,\n bootstrap,\n} from \"rolexjs\";\nimport { LocalPlatform } from \"@rolexjs/local-platform\";\n\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\n\nconst DEFAULT_ROLEX_DIR = join(homedir(), \".rolex\");\nconst rolexDir = process.argv[2] || process.env.ROLEX_DIR || DEFAULT_ROLEX_DIR;\nconst platform = new LocalPlatform(rolexDir);\nbootstrap(platform);\nconst rolex = new Rolex(platform);\n\nlet currentRole: Role | null = null;\nlet currentRoleName: string = \"\";\n\nconst server = new FastMCP({\n name: \"Rolex MCP Server\",\n version: \"0.2.0\",\n instructions: INSTRUCTIONS,\n});\n\n// ========== Helpers ==========\n\nfunction requireRole(): Role {\n if (!currentRole) {\n throw new Error(\"No active role. Call identity(roleId) first to activate a role.\");\n }\n return currentRole;\n}\n\nfunction requireNuwa(): string | null {\n if (!currentRole || currentRoleName !== \"nuwa\") {\n const who = currentRoleName || \"none\";\n return `Permission denied. Only nuwa can use this tool. Current role: ${who}`;\n }\n return null;\n}\n\n/**\n * Wrap a tool execute function with unified error handling.\n * Catches errors and renders them as formatted markdown.\n */\nfunction safeTool<T>(\n toolName: string,\n fn: (args: T) => Promise<string>\n): (args: T) => Promise<string> {\n return async (args: T) => {\n try {\n return await fn(args);\n } catch (error) {\n throw new Error(renderError(toolName, error));\n }\n };\n}\n\n// ========== Society (folded) ==========\n\nserver.addTool({\n name: \"society\",\n description: DESC_SOCIETY,\n parameters: z.object({\n operation: z\n .enum([\"born\", \"found\", \"establish\", \"directory\", \"find\", \"teach\"])\n .describe(\"The society operation to perform\"),\n name: z\n .string()\n .optional()\n .describe(\n \"Role name (born/find/teach), organization name (found), or position name (establish)\"\n ),\n source: z\n .string()\n .optional()\n .describe(\n \"Gherkin feature source (born: persona, teach: knowledge, found: org description, establish: position duties)\"\n ),\n parent: z.string().optional().describe(\"Parent organization name (for found with nesting)\"),\n orgName: z.string().optional().describe(\"Organization name (for establish)\"),\n roleId: z.string().optional().describe(\"Target role name for teach operation\"),\n type: z\n .enum([\"knowledge\", \"experience\", \"voice\"])\n .optional()\n .describe(\"Growth dimension for teach operation\"),\n dimensionName: z\n .string()\n .optional()\n .describe(\"Name for the knowledge being taught (e.g. 'distributed-systems')\"),\n }),\n execute: safeTool(\n \"society\",\n async ({ operation, name, source, parent, orgName, roleId, type, dimensionName }) => {\n const denied = requireNuwa();\n if (denied) return denied;\n switch (operation) {\n case \"born\": {\n if (!name || !source) throw new Error(\"born requires: name, source\");\n const feature = rolex.born(name, source);\n return next(`Role born: ${feature.name}`, NEXT.born);\n }\n case \"found\": {\n if (!name) throw new Error(\"found requires: name\");\n rolex.found(name, source, parent);\n return next(`Organization founded: ${name}`, NEXT.found);\n }\n case \"establish\": {\n if (!name || !source || !orgName)\n throw new Error(\"establish requires: name, source, orgName\");\n rolex.establish(name, source, orgName);\n return next(`Position established: ${name} in ${orgName}`, NEXT.establish);\n }\n case \"directory\": {\n const dir = rolex.directory();\n const lines: string[] = [];\n\n // Organizations with positions and members\n if (dir.organizations.length > 0) {\n for (const org of dir.organizations) {\n const parentStr = org.parent ? ` (parent: ${org.parent})` : \"\";\n lines.push(`Organization: ${org.name}${parentStr}`);\n\n if (org.positions.length > 0) {\n lines.push(\" Positions:\");\n for (const pos of org.positions) {\n const posInfo = platform.getPosition(pos, org.name);\n const holder = posInfo?.assignedRole ? ` ← ${posInfo.assignedRole}` : \" (vacant)\";\n lines.push(` - ${pos}${holder}`);\n }\n }\n\n if (org.members.length > 0) {\n lines.push(\" Members:\");\n for (const member of org.members) {\n const role = dir.roles.find((r) => r.name === member);\n const state = role ? ` [${role.state}]` : \"\";\n const pos = role?.position ? ` → ${role.position}` : \"\";\n lines.push(` - ${member}${state}${pos}`);\n }\n }\n }\n }\n\n // Free roles (not in any org)\n const freeRoles = dir.roles.filter((r) => r.state === \"free\");\n if (freeRoles.length > 0) {\n if (lines.length > 0) lines.push(\"\");\n lines.push(\"Free Roles:\");\n for (const role of freeRoles) {\n lines.push(` - ${role.name}`);\n }\n }\n\n return lines.join(\"\\n\") || \"No roles or organizations found.\";\n }\n case \"find\": {\n if (!name) throw new Error(\"find requires: name\");\n const result = rolex.find(name);\n if (result instanceof Organization) {\n const info = result.info();\n const parentStr = info.parent ? ` (parent: ${info.parent})` : \"\";\n return `Organization: ${info.name}${parentStr}\\nMembers: ${info.members.length}\\nPositions: ${info.positions.join(\", \") || \"none\"}`;\n }\n if (result instanceof Position) {\n const info = result.info();\n return `Position: ${info.name} in ${info.org}\\nState: ${info.state}\\nAssigned: ${info.assignedRole || \"none\"}\\nDuties: ${info.duties.length}`;\n }\n const features = (result as Role).identity();\n return renderFeatures(features);\n }\n case \"teach\": {\n if (!roleId || !type || !dimensionName || !source)\n throw new Error(\"teach requires: roleId, type, dimensionName, source\");\n const feature = rolex.teach(roleId, type, dimensionName, source);\n return next(`Taught ${type}: ${feature.name}`, NEXT.teach);\n }\n default:\n throw new Error(`Unknown society operation: ${operation}`);\n }\n }\n ),\n});\n\n// ========== Organization (folded) ==========\n\nserver.addTool({\n name: \"organization\",\n description: DESC_ORGANIZATION,\n parameters: z.object({\n operation: z\n .enum([\"hire\", \"fire\", \"appoint\", \"dismiss\"])\n .describe(\"The organization operation to perform\"),\n name: z.string().describe(\"Role name to hire, fire, appoint, or dismiss\"),\n position: z.string().optional().describe(\"Position name (for appoint)\"),\n orgName: z\n .string()\n .optional()\n .describe(\"Target organization name (for hire, required when multiple organizations exist)\"),\n }),\n execute: safeTool(\"organization\", async ({ operation, name, position, orgName: targetOrg }) => {\n const denied = requireNuwa();\n if (denied) return denied;\n // Find the first org, or the org the role belongs to\n const dir = rolex.directory();\n if (dir.organizations.length === 0) {\n throw new Error(\"No organization found. Call found() first.\");\n }\n\n // Resolve target organization\n let orgName: string;\n if (operation === \"hire\") {\n if (targetOrg) {\n orgName = targetOrg;\n } else if (dir.organizations.length === 1) {\n orgName = dir.organizations[0].name;\n } else {\n const orgNames = dir.organizations.map((o) => o.name).join(\", \");\n throw new Error(\n `Multiple organizations exist (${orgNames}). Specify orgName to indicate which one.`\n );\n }\n } else {\n const assignment = platform.getAssignment(name);\n orgName = assignment?.org ?? dir.organizations[0].name;\n }\n\n const org = rolex.find(orgName) as Organization;\n\n switch (operation) {\n case \"hire\": {\n org.hire(name);\n return next(`Role hired: ${name} → ${orgName}`, nextHire(name));\n }\n case \"fire\": {\n org.fire(name);\n return next(`Role fired: ${name}`, NEXT.fire);\n }\n case \"appoint\": {\n if (!position) throw new Error(\"appoint requires: name, position\");\n org.appoint(name, position);\n return next(`Role appointed: ${name} → ${position}`, NEXT.appoint);\n }\n case \"dismiss\": {\n org.dismiss(name);\n return next(`Role dismissed: ${name}`, NEXT.dismiss);\n }\n default:\n throw new Error(`Unknown organization operation: ${operation}`);\n }\n }),\n});\n\n// ========== Role Activation ==========\n\nserver.addTool({\n name: \"identity\",\n description: DESC_IDENTITY,\n parameters: z.object({\n roleId: z.string().describe(\"Role name (e.g. 'sean')\"),\n }),\n execute: safeTool(\"identity\", async ({ roleId }) => {\n currentRole = rolex.role(roleId);\n currentRoleName = roleId;\n const features = currentRole.identity();\n const { current } = currentRole.focus();\n const assignment = platform.getAssignment(roleId);\n const statusBar = renderStatusBar(roleId, current, assignment?.org, assignment?.position);\n return `${statusBar}\\n\\n${renderFeatures(features)}`;\n }),\n});\n\n// ========== Role Tools ==========\n\nserver.addTool({\n name: \"growup\",\n description: DESC_GROWUP,\n parameters: z.object({\n type: z\n .enum([\"knowledge\", \"experience\", \"voice\"])\n .describe(\n \"Growth dimension: knowledge (what I know), experience (what I've lived), voice (how I'm perceived)\"\n ),\n name: z\n .string()\n .describe(\"Name for this growth (used as filename, e.g. 'distributed-systems')\"),\n source: z.string().describe(\"Gherkin feature source text\"),\n }),\n execute: safeTool(\"growup\", async ({ type, name, source }) => {\n const role = requireRole();\n const feature = role.growup(type, name, source);\n return next(`Growth added (${type}): ${feature.name}`, NEXT.growup);\n }),\n});\n\nserver.addTool({\n name: \"focus\",\n description: DESC_FOCUS,\n parameters: z.object({\n name: z.string().optional().describe(\"Optional goal name to switch focus to\"),\n }),\n execute: safeTool(\"focus\", async ({ name }) => {\n const role = requireRole();\n const { current, otherGoals } = role.focus(name);\n\n const assignment = platform.getAssignment(currentRoleName);\n const statusBar = renderStatusBar(\n currentRoleName,\n current,\n assignment?.org,\n assignment?.position\n );\n\n if (!current && otherGoals.length === 0)\n return `${statusBar}\\n\\nNo active goal. Use want() to set a new goal.`;\n\n const parts: string[] = [statusBar];\n\n if (current) {\n parts.push(renderFeature(current));\n if (current.plan) {\n parts.push(renderFeature(current.plan));\n }\n for (const task of current.tasks) {\n parts.push(renderFeature(task));\n }\n }\n\n if (otherGoals.length > 0) {\n parts.push(\"Other active goals:\");\n for (const g of otherGoals) {\n parts.push(` - ${g.name}`);\n }\n }\n\n return parts.join(\"\\n\\n\");\n }),\n});\n\nserver.addTool({\n name: \"want\",\n description: DESC_WANT,\n parameters: z.object({\n name: z.string().describe(\"Goal name (used as directory name, e.g. 'local-platform')\"),\n source: z.string().describe(\"Gherkin feature source text for the goal\"),\n testable: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Whether this goal's scenarios should become persistent automated verification\"),\n }),\n execute: safeTool(\"want\", async ({ name, source, testable }) => {\n const role = requireRole();\n const goal = role.want(name, source, testable);\n return next(`Goal created: ${goal.name}`, NEXT.want);\n }),\n});\n\nserver.addTool({\n name: \"plan\",\n description: DESC_PLAN,\n parameters: z.object({\n source: z.string().describe(\"Gherkin feature source text for the plan\"),\n }),\n execute: safeTool(\"plan\", async ({ source }) => {\n const role = requireRole();\n const p = role.plan(source);\n return next(`Plan created: ${p.name}`, NEXT.plan);\n }),\n});\n\nserver.addTool({\n name: \"todo\",\n description: DESC_TODO,\n parameters: z.object({\n name: z.string().describe(\"Task name (used as filename, e.g. 'implement-loader')\"),\n source: z.string().describe(\"Gherkin feature source text for the task\"),\n testable: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Whether this task's scenarios should become unit or integration tests\"),\n }),\n execute: safeTool(\"todo\", async ({ name, source, testable }) => {\n const role = requireRole();\n const task = role.todo(name, source, testable);\n return next(`Task created: ${task.name}`, NEXT.todo);\n }),\n});\n\nserver.addTool({\n name: \"achieve\",\n description: DESC_ACHIEVE,\n parameters: z.object({\n experience: z\n .string()\n .optional()\n .describe(\n \"Optional Gherkin feature source capturing what was learned — auto-saved as experience growup\"\n ),\n }),\n execute: safeTool(\"achieve\", async ({ experience }) => {\n const role = requireRole();\n role.achieve(experience);\n const msg = experience ? \"Goal achieved. Experience captured.\" : \"Goal achieved.\";\n return next(msg, NEXT.achieve);\n }),\n});\n\nserver.addTool({\n name: \"abandon\",\n description: DESC_ABANDON,\n parameters: z.object({\n experience: z\n .string()\n .optional()\n .describe(\n \"Optional Gherkin feature source capturing what was learned — auto-saved as experience growup\"\n ),\n }),\n execute: safeTool(\"abandon\", async ({ experience }) => {\n const role = requireRole();\n role.abandon(experience);\n const msg = experience ? \"Goal abandoned. Experience captured.\" : \"Goal abandoned.\";\n return next(msg, NEXT.abandon);\n }),\n});\n\nserver.addTool({\n name: \"reflect\",\n description: DESC_REFLECT,\n parameters: z.object({\n experienceNames: z\n .array(z.string())\n .describe(\n \"Names of experience files to distill (without .experience.identity.feature suffix)\"\n ),\n knowledgeName: z\n .string()\n .describe(\n \"Name for the resulting knowledge (used as filename, e.g. 'authentication-principles')\"\n ),\n knowledgeSource: z.string().describe(\"Gherkin feature source text for the knowledge\"),\n }),\n execute: safeTool(\"reflect\", async ({ experienceNames, knowledgeName, knowledgeSource }) => {\n const role = requireRole();\n const feature = role.reflect(experienceNames, knowledgeName, knowledgeSource);\n return next(\n `Reflected: ${experienceNames.length} experience(s) → knowledge \"${feature.name}\"`,\n NEXT.reflect\n );\n }),\n});\n\nserver.addTool({\n name: \"finish\",\n description: DESC_FINISH,\n parameters: z.object({\n name: z.string().describe(\"Task name to mark as done\"),\n }),\n execute: safeTool(\"finish\", async ({ name }) => {\n const role = requireRole();\n role.finish(name);\n\n // Dynamic hint: check remaining tasks\n const { current } = role.focus();\n const remaining = current\n ? current.tasks.filter((t) => !t.tags?.some((tag) => tag.name === \"@done\")).length\n : -1;\n return next(`Task finished: ${name}`, remaining >= 0 ? nextFinish(remaining) : NEXT.achieve);\n }),\n});\n\nserver.start({\n transportType: \"stdio\",\n});\n"],"mappings":";;;AAoBA,SAAS,eAAe;AACxB,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAE9B,SAAS,YAAY;AACrB,SAAS,eAAe;AAExB,IAAM,oBAAoB,KAAK,QAAQ,GAAG,QAAQ;AAClD,IAAM,WAAW,QAAQ,KAAK,CAAC,KAAK,QAAQ,IAAI,aAAa;AAC7D,IAAM,WAAW,IAAI,cAA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S,OAAO,CAAC,EAAE,SAC1E;AACJ,WAAO,KAAK,kBAAkB,IAAI,IAAI,aAAa,IAAI,WAAW,SAAS,IAAI,KAAK,OAAO;AAAA,EAC7F,CAAC;AACH,CAAC;AAED,OAAO,MAAM;AAAA,EACX,eAAe;AACjB,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/instructions.ts","../src/render.ts","../src/state.ts"],"sourcesContent":["/**\n * @rolexjs/mcp-server — individual-level MCP tools.\n *\n * Thin wrapper around the Rolex API (which accepts string ids).\n * McpState holds session context: activeRoleId, focusedGoalId, encounter/experience ids.\n *\n * Tools:\n * activate — activate a role\n * focus — view / switch focused goal\n * want — declare a goal\n * plan — plan for focused goal\n * todo — add task to focused plan\n * finish — finish a task → encounter\n * complete — complete focused plan → encounter\n * abandon — abandon focused plan → encounter\n * reflect — encounter(s) → experience\n * realize — experience(s) → principle\n * master — experience(s) → procedure\n * forget — remove a node from the individual\n * skill — load full skill content by locator\n */\n\nimport { localPlatform } from \"@rolexjs/local-platform\";\nimport { FastMCP } from \"fastmcp\";\nimport { createRoleX, detail } from \"rolexjs\";\nimport { z } from \"zod\";\nimport { instructions } from \"./instructions.js\";\nimport { render } from \"./render.js\";\nimport { McpState } from \"./state.js\";\n\n// ========== Setup ==========\n\nconst rolex = createRoleX(localPlatform());\nconst state = new McpState(rolex);\n\n// ========== Server ==========\n\nconst server = new FastMCP({\n name: \"rolex\",\n version: \"0.11.0\",\n instructions,\n});\n\n// ========== Helpers ==========\n\nfunction fmt(process: string, label: string, result: { state: any; process: string }) {\n return render({\n process,\n name: label,\n result,\n cognitiveHint: state.cognitiveHint(process),\n });\n}\n\n// ========== Tools: Role ==========\n\nserver.addTool({\n name: \"activate\",\n description: detail(\"activate\"),\n parameters: z.object({\n roleId: z.string().describe(\"Role name to activate\"),\n }),\n execute: async ({ roleId }) => {\n if (!state.findIndividual(roleId)) {\n // Auto-born if not found\n rolex.individual.born(undefined, roleId);\n }\n state.activeRoleId = roleId;\n const result = await rolex.role.activate(roleId);\n state.cacheFromActivation(result.state);\n return fmt(\"activate\", roleId, result);\n },\n});\n\nserver.addTool({\n name: \"focus\",\n description: detail(\"focus\"),\n parameters: z.object({\n id: z.string().optional().describe(\"Goal id to switch to. Omit to view current.\"),\n }),\n execute: async ({ id }) => {\n if (id) {\n state.focusedGoalId = id;\n state.focusedPlanId = null;\n }\n const goalId = state.requireGoalId();\n const result = rolex.role.focus(goalId);\n return fmt(\"focus\", id ?? \"current goal\", result);\n },\n});\n\n// ========== Tools: Execution ==========\n\nserver.addTool({\n name: \"want\",\n description: detail(\"want\"),\n parameters: z.object({\n id: z.string().describe(\"Goal id (used for focus/reference)\"),\n goal: z.string().describe(\"Gherkin Feature source describing the goal\"),\n }),\n execute: async ({ id, goal }) => {\n const roleId = state.requireRoleId();\n const result = rolex.role.want(roleId, goal, id);\n state.focusedGoalId = id;\n state.focusedPlanId = null;\n return fmt(\"want\", id, result);\n },\n});\n\nserver.addTool({\n name: \"plan\",\n description: detail(\"plan\"),\n parameters: z.object({\n id: z.string().describe(\"Plan id — keywords from the plan content joined by hyphens\"),\n plan: z.string().describe(\"Gherkin Feature source describing the plan\"),\n }),\n execute: async ({ id, plan }) => {\n const goalId = state.requireGoalId();\n const result = rolex.role.plan(goalId, plan, id);\n state.focusedPlanId = id;\n return fmt(\"plan\", id, result);\n },\n});\n\nserver.addTool({\n name: \"todo\",\n description: detail(\"todo\"),\n parameters: z.object({\n id: z.string().describe(\"Task id (used for finish/reference)\"),\n task: z.string().describe(\"Gherkin Feature source describing the task\"),\n }),\n execute: async ({ id, task }) => {\n const planId = state.requirePlanId();\n const result = rolex.role.todo(planId, task, id);\n return fmt(\"todo\", id, result);\n },\n});\n\nserver.addTool({\n name: \"finish\",\n description: detail(\"finish\"),\n parameters: z.object({\n id: z.string().describe(\"Task id to finish\"),\n encounter: z.string().optional().describe(\"Optional Gherkin Feature describing what happened\"),\n }),\n execute: async ({ id, encounter }) => {\n const roleId = state.requireRoleId();\n const result = rolex.role.finish(id, roleId, encounter);\n const encId = result.state.id ?? id;\n state.addEncounter(encId);\n return fmt(\"finish\", id, result);\n },\n});\n\nserver.addTool({\n name: \"complete\",\n description: detail(\"complete\"),\n parameters: z.object({\n id: z.string().optional().describe(\"Plan id to complete (defaults to focused plan)\"),\n encounter: z.string().optional().describe(\"Optional Gherkin Feature describing what happened\"),\n }),\n execute: async ({ id, encounter }) => {\n const roleId = state.requireRoleId();\n const planId = id ?? state.requirePlanId();\n const result = rolex.role.complete(planId, roleId, encounter);\n const encId = result.state.id ?? planId;\n state.addEncounter(encId);\n if (state.focusedPlanId === planId) state.focusedPlanId = null;\n return fmt(\"complete\", planId, result);\n },\n});\n\nserver.addTool({\n name: \"abandon\",\n description: detail(\"abandon\"),\n parameters: z.object({\n id: z.string().optional().describe(\"Plan id to abandon (defaults to focused plan)\"),\n encounter: z.string().optional().describe(\"Optional Gherkin Feature describing what happened\"),\n }),\n execute: async ({ id, encounter }) => {\n const roleId = state.requireRoleId();\n const planId = id ?? state.requirePlanId();\n const result = rolex.role.abandon(planId, roleId, encounter);\n const encId = result.state.id ?? planId;\n state.addEncounter(encId);\n if (state.focusedPlanId === planId) state.focusedPlanId = null;\n return fmt(\"abandon\", planId, result);\n },\n});\n\n// ========== Tools: Cognition ==========\n\nserver.addTool({\n name: \"reflect\",\n description: detail(\"reflect\"),\n parameters: z.object({\n ids: z.array(z.string()).describe(\"Encounter ids to reflect on (selective consumption)\"),\n id: z\n .string()\n .describe(\"Experience id — keywords from the experience content joined by hyphens\"),\n experience: z.string().optional().describe(\"Gherkin Feature source for the experience\"),\n }),\n execute: async ({ ids, id, experience }) => {\n state.requireEncounterIds(ids);\n const roleId = state.requireRoleId();\n const result = rolex.role.reflect(ids[0], roleId, experience, id);\n state.consumeEncounters(ids);\n state.addExperience(id);\n return fmt(\"reflect\", id, result);\n },\n});\n\nserver.addTool({\n name: \"realize\",\n description: detail(\"realize\"),\n parameters: z.object({\n ids: z.array(z.string()).describe(\"Experience ids to distill into a principle\"),\n id: z.string().describe(\"Principle id — keywords from the principle content joined by hyphens\"),\n principle: z.string().optional().describe(\"Gherkin Feature source for the principle\"),\n }),\n execute: async ({ ids, id, principle }) => {\n state.requireExperienceIds(ids);\n const roleId = state.requireRoleId();\n const result = rolex.role.realize(ids[0], roleId, principle, id);\n state.consumeExperiences(ids);\n return fmt(\"realize\", id, result);\n },\n});\n\nserver.addTool({\n name: \"master\",\n description: detail(\"master\"),\n parameters: z.object({\n ids: z.array(z.string()).describe(\"Experience ids to distill into a procedure\"),\n id: z.string().describe(\"Procedure id — keywords from the procedure content joined by hyphens\"),\n procedure: z.string().optional().describe(\"Gherkin Feature source for the procedure\"),\n }),\n execute: async ({ ids, id, procedure }) => {\n state.requireExperienceIds(ids);\n const roleId = state.requireRoleId();\n const result = rolex.role.master(ids[0], roleId, procedure, id);\n state.consumeExperiences(ids);\n return fmt(\"master\", id, result);\n },\n});\n\n// ========== Tools: Knowledge management ==========\n\nserver.addTool({\n name: \"forget\",\n description: detail(\"forget\"),\n parameters: z.object({\n id: z\n .string()\n .describe(\"Id of the node to remove (principle, procedure, experience, encounter, etc.)\"),\n }),\n execute: async ({ id }) => {\n const roleId = state.requireRoleId();\n const result = await rolex.role.forget(id, roleId);\n return fmt(\"forget\", id, result);\n },\n});\n\n// ========== Tools: Skill loading ==========\n\nserver.addTool({\n name: \"skill\",\n description: detail(\"skill\"),\n parameters: z.object({\n locator: z\n .string()\n .describe(\"ResourceX locator for the skill (e.g. deepractice/role-management)\"),\n }),\n execute: async ({ locator }) => {\n const content = await rolex.role.skill(locator);\n return content;\n },\n});\n\n// ========== Start ==========\n\nserver.start({\n transportType: \"stdio\",\n});\n","/**\n * MCP server instructions — the cognitive framework for AI roles.\n *\n * Assembled from world .feature files in rolexjs descriptions.\n * Each feature describes one independent concern of the RoleX framework.\n */\nimport { world } from \"rolexjs\";\n\nexport const instructions = [\n world[\"cognitive-priority\"],\n world[\"role-identity\"],\n world.execution,\n world.cognition,\n world.memory,\n world.gherkin,\n world.communication,\n world[\"skill-system\"],\n world[\"state-origin\"],\n].join(\"\\n\\n\");\n","/**\n * Render — 3-layer output for MCP tool results.\n *\n * Layer 1: Status — what just happened (describe)\n * Layer 2: Hint — what to do next (hint)\n * Layer 3: Projection — full state tree as markdown (renderState)\n *\n * MCP and CLI share describe() + hint() + renderState() from rolexjs.\n * Relations are rendered per-node via bidirectional links — no separate layer needed.\n */\nimport type { RolexResult } from \"rolexjs\";\nimport { describe, hint, renderState } from \"rolexjs\";\n\n// ================================================================\n// Public API\n// ================================================================\n\nexport interface RenderOptions {\n /** The process that was executed. */\n process: string;\n /** Display name for the primary node. */\n name: string;\n /** Result from the Rolex API. */\n result: RolexResult;\n /** AI cognitive hint — first-person, state-aware self-direction cue. */\n cognitiveHint?: string | null;\n}\n\n/** Render a full 3-layer output string. */\nexport function render(opts: RenderOptions): string {\n const { process, name, result, cognitiveHint } = opts;\n const lines: string[] = [];\n\n // Layer 1: Status\n lines.push(describe(process, name, result.state));\n\n // Layer 2: Hint (static) + Cognitive hint (state-aware)\n lines.push(hint(process));\n if (cognitiveHint) {\n lines.push(`I → ${cognitiveHint}`);\n }\n\n // Layer 3: Projection — generic markdown rendering of the full state tree\n lines.push(\"\");\n lines.push(renderState(result.state));\n\n return lines.join(\"\\n\");\n}\n","/**\n * McpState — stateful session for the MCP server.\n *\n * Holds what the stateless Rolex API does not:\n * - activeRoleId (which individual is \"me\")\n * - focusedGoalId / focusedPlanId (execution context)\n * - encounter / experience id sets (for selective cognition)\n *\n * Since the Rolex API now accepts string ids directly,\n * McpState only stores ids — no Structure references.\n */\nimport type { Rolex, State } from \"rolexjs\";\n\nexport class McpState {\n activeRoleId: string | null = null;\n focusedGoalId: string | null = null;\n focusedPlanId: string | null = null;\n\n private encounterIds = new Set<string>();\n private experienceIds = new Set<string>();\n\n constructor(readonly rolex: Rolex) {}\n\n // ================================================================\n // Requirements — throw if missing\n // ================================================================\n\n requireRoleId(): string {\n if (!this.activeRoleId) throw new Error(\"No active role. Call activate first.\");\n return this.activeRoleId;\n }\n\n requireGoalId(): string {\n if (!this.focusedGoalId) throw new Error(\"No focused goal. Call want first.\");\n return this.focusedGoalId;\n }\n\n requirePlanId(): string {\n if (!this.focusedPlanId) throw new Error(\"No focused plan. Call plan first.\");\n return this.focusedPlanId;\n }\n\n // ================================================================\n // Cognition registries — encounter / experience ids\n // ================================================================\n\n addEncounter(id: string) {\n this.encounterIds.add(id);\n }\n\n requireEncounterIds(ids: string[]) {\n for (const id of ids) {\n if (!this.encounterIds.has(id)) throw new Error(`Encounter not found: \"${id}\"`);\n }\n }\n\n consumeEncounters(ids: string[]) {\n for (const id of ids) {\n this.encounterIds.delete(id);\n }\n }\n\n addExperience(id: string) {\n this.experienceIds.add(id);\n }\n\n requireExperienceIds(ids: string[]) {\n for (const id of ids) {\n if (!this.experienceIds.has(id)) throw new Error(`Experience not found: \"${id}\"`);\n }\n }\n\n consumeExperiences(ids: string[]) {\n for (const id of ids) {\n this.experienceIds.delete(id);\n }\n }\n\n // ================================================================\n // Lookup\n // ================================================================\n\n findIndividual(roleId: string): boolean {\n return this.rolex.find(roleId) !== null;\n }\n\n // ================================================================\n // Activation helpers\n // ================================================================\n\n /** Rehydrate ids from an activation projection. */\n cacheFromActivation(state: State) {\n this.rehydrate(state);\n }\n\n /** Walk the state tree and collect ids into the appropriate registries. */\n private rehydrate(node: State) {\n if (node.id) {\n switch (node.name) {\n case \"goal\":\n // Set focused goal to the first one found if none set\n if (!this.focusedGoalId) this.focusedGoalId = node.id;\n break;\n case \"encounter\":\n this.encounterIds.add(node.id);\n break;\n case \"experience\":\n this.experienceIds.add(node.id);\n break;\n }\n }\n for (const child of (node as State & { children?: readonly State[] }).children ?? []) {\n this.rehydrate(child);\n }\n }\n\n // ================================================================\n // Cognitive hints — state-aware AI self-direction cues\n // ================================================================\n\n /** First-person, state-aware hint for the AI after an operation. */\n cognitiveHint(process: string): string | null {\n switch (process) {\n case \"activate\":\n if (!this.focusedGoalId)\n return \"I have no goal yet. I should call `want` to declare one, or `focus` to review existing goals.\";\n return \"I have an active goal. I should call `focus` to review progress, or `want` to declare a new goal.\";\n\n case \"focus\":\n if (!this.focusedPlanId)\n return \"I have a goal but no plan. I should call `plan` to design how to achieve it.\";\n return \"I have a plan. I should call `todo` to create tasks, or continue working.\";\n\n case \"want\":\n return \"Goal declared. I should call `plan` to design how to achieve it.\";\n\n case \"plan\":\n return \"Plan created. I should call `todo` to create concrete tasks.\";\n\n case \"todo\":\n return \"Task created. I can add more with `todo`, or start working and call `finish` when done.\";\n\n case \"finish\": {\n const encCount = this.encounterIds.size;\n if (encCount > 0 && !this.focusedGoalId)\n return `Task finished. No more goals — I have ${encCount} encounter(s) to choose from for \\`reflect\\`, or \\`want\\` a new goal.`;\n return \"Task finished. I should continue with remaining tasks, or call `complete` when the plan is done.\";\n }\n\n case \"complete\":\n case \"abandon\": {\n const encCount = this.encounterIds.size;\n if (encCount > 0)\n return `Plan closed. I have ${encCount} encounter(s) to choose from for \\`reflect\\`, or I can continue with other plans.`;\n return \"Plan closed. I can create a new `plan`, or `focus` on another goal.\";\n }\n\n case \"reflect\": {\n const expCount = this.experienceIds.size;\n if (expCount > 0)\n return `Experience gained. I can \\`realize\\` principles or \\`master\\` procedures — ${expCount} experience(s) available.`;\n return \"Experience gained. I can `realize` a principle, `master` a procedure, or continue working.\";\n }\n\n case \"realize\":\n return \"Principle added to knowledge. I should continue working.\";\n\n case \"master\":\n return \"Procedure added to knowledge. I should continue working.\";\n\n default:\n return null;\n }\n }\n}\n"],"mappings":";;;AAsBA,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,aAAa,cAAc;AACpC,SAAS,SAAS;;;ACnBlB,SAAS,aAAa;AAEf,IAAM,eAAe;AAAA,EAC1B,MAAM,oBAAoB;AAAA,EAC1B,MAAM,eAAe;AAAA,EACrB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAA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E,OAAO,EAAE,SAAS,EAAE,SAAS,0CAA0C;AAAA,EACtF,CAAC;AAAA,EACD,SAAS,OAAO,EAAE,KAAK,IAAI,UAAU,MAAM;AACzC,UAAM,qBAAqB,GAAG;AAC9B,UAAM,SAAS,MAAM,cAAc;AACnC,UAAM,SAAS,MAAM,KAAK,OAAO,IAAI,CAAC,GAAG,QAAQ,WAAW,EAAE;AAC9D,UAAM,mBAAmB,GAAG;AAC5B,WAAO,IAAI,UAAU,IAAI,MAAM;AAAA,EACjC;AACF,CAAC;AAID,OAAO,QAAQ;AAAA,EACb,MAAM;AAAA,EACN,aAAa,OAAO,QAAQ;AAAA,EAC5B,YAAY,EAAE,OAAO;AAAA,IACnB,IAAI,EACD,OAAO,EACP,SAAS,8EAA8E;AAAA,EAC5F,CAAC;AAAA,EACD,SAAS,OAAO,EAAE,GAAG,MAAM;AACzB,UAAM,SAAS,MAAM,cAAc;AACnC,UAAM,SAAS,MAAM,MAAM,KAAK,OAAO,IAAI,MAAM;AACjD,WAAO,IAAI,UAAU,IAAI,MAAM;AAAA,EACjC;AACF,CAAC;AAID,OAAO,QAAQ;AAAA,EACb,MAAM;AAAA,EACN,aAAa,OAAO,OAAO;AAAA,EAC3B,YAAY,EAAE,OAAO;AAAA,IACnB,SAAS,EACN,OAAO,EACP,SAAS,oEAAoE;AAAA,EAClF,CAAC;AAAA,EACD,SAAS,OAAO,EAAE,QAAQ,MAAM;AAC9B,UAAM,UAAU,MAAM,MAAM,KAAK,MAAM,OAAO;AAC9C,WAAO;AAAA,EACT;AACF,CAAC;AAID,OAAO,MAAM;AAAA,EACX,eAAe;AACjB,CAAC;","names":["rolex","state"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolexjs/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0-dev.0",
|
|
4
4
|
"description": "MCP server for Rolex — expose RDD role management as MCP tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rolex",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"clean": "rm -rf dist"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"rolexjs": "
|
|
45
|
-
"@rolexjs/local-platform": "
|
|
44
|
+
"rolexjs": "workspace:*",
|
|
45
|
+
"@rolexjs/local-platform": "workspace:*",
|
|
46
46
|
"fastmcp": "^3.0.0",
|
|
47
47
|
"zod": "^3.25.0"
|
|
48
48
|
},
|