@telora/mcp-products 0.21.1
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 +276 -0
- package/dist/cli/init.d.ts +2 -0
- package/dist/cli/init.js +94 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/handlers/agentHandlers.d.ts +3 -0
- package/dist/handlers/agentHandlers.js +97 -0
- package/dist/handlers/agentHandlers.js.map +1 -0
- package/dist/handlers/connectorHandlers.d.ts +3 -0
- package/dist/handlers/connectorHandlers.js +401 -0
- package/dist/handlers/connectorHandlers.js.map +1 -0
- package/dist/handlers/contextHandlers.d.ts +8 -0
- package/dist/handlers/contextHandlers.js +169 -0
- package/dist/handlers/contextHandlers.js.map +1 -0
- package/dist/handlers/deliveryHandlers.d.ts +3 -0
- package/dist/handlers/deliveryHandlers.js +122 -0
- package/dist/handlers/deliveryHandlers.js.map +1 -0
- package/dist/handlers/deploymentProfileHandlers.d.ts +3 -0
- package/dist/handlers/deploymentProfileHandlers.js +104 -0
- package/dist/handlers/deploymentProfileHandlers.js.map +1 -0
- package/dist/handlers/discoverHandler.d.ts +23 -0
- package/dist/handlers/discoverHandler.js +83 -0
- package/dist/handlers/discoverHandler.js.map +1 -0
- package/dist/handlers/factoryHandlers.d.ts +3 -0
- package/dist/handlers/factoryHandlers.js +484 -0
- package/dist/handlers/factoryHandlers.js.map +1 -0
- package/dist/handlers/ideaHandlers.d.ts +3 -0
- package/dist/handlers/ideaHandlers.js +245 -0
- package/dist/handlers/ideaHandlers.js.map +1 -0
- package/dist/handlers/index.d.ts +15 -0
- package/dist/handlers/index.js +19 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/infrastructureHandlers.d.ts +3 -0
- package/dist/handlers/infrastructureHandlers.js +335 -0
- package/dist/handlers/infrastructureHandlers.js.map +1 -0
- package/dist/handlers/issueHandlers.d.ts +3 -0
- package/dist/handlers/issueHandlers.js +94 -0
- package/dist/handlers/issueHandlers.js.map +1 -0
- package/dist/handlers/okrHandlers.d.ts +3 -0
- package/dist/handlers/okrHandlers.js +194 -0
- package/dist/handlers/okrHandlers.js.map +1 -0
- package/dist/handlers/playbookHandlers.d.ts +3 -0
- package/dist/handlers/playbookHandlers.js +93 -0
- package/dist/handlers/playbookHandlers.js.map +1 -0
- package/dist/handlers/productHandlers.d.ts +3 -0
- package/dist/handlers/productHandlers.js +129 -0
- package/dist/handlers/productHandlers.js.map +1 -0
- package/dist/handlers/reportHandlers.d.ts +3 -0
- package/dist/handlers/reportHandlers.js +59 -0
- package/dist/handlers/reportHandlers.js.map +1 -0
- package/dist/handlers/strategyHandlers.d.ts +3 -0
- package/dist/handlers/strategyHandlers.js +116 -0
- package/dist/handlers/strategyHandlers.js.map +1 -0
- package/dist/handlers/workflowHandlers.d.ts +3 -0
- package/dist/handlers/workflowHandlers.js +93 -0
- package/dist/handlers/workflowHandlers.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +284 -0
- package/dist/index.js.map +1 -0
- package/dist/shared.d.ts +77 -0
- package/dist/shared.js +147 -0
- package/dist/shared.js.map +1 -0
- package/package.json +47 -0
- package/scripts/postinstall.js +96 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Strategy tool handler (consolidated):
|
|
3
|
+
// telora_product_strategy (list | create | update | reorder)
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { callProductApi, successResult, validationError, buildFields, wrapHandler, compactEntity, } from "../shared.js";
|
|
7
|
+
export function registerStrategyTools(server, getCreds, profile = 'full') {
|
|
8
|
+
server.tool("telora_product_strategy", "Execution roadmap: group deliveries into themed work scopes. Strategies define what the AI daemon works on -- " +
|
|
9
|
+
"assigning an agent role queues the strategy for autonomous execution. " +
|
|
10
|
+
"Actions: list strategies for a product, create a strategy (name + productId), " +
|
|
11
|
+
"update strategy settings (description, status, agent role, pipeline config), reorder strategy priority.", {
|
|
12
|
+
action: z.enum(["list", "create", "update", "reorder"]).describe("Action to perform"),
|
|
13
|
+
productId: z.string().uuid().optional().describe("Product UUID (required for list, create, reorder)"),
|
|
14
|
+
strategyId: z.string().uuid().optional().describe("Strategy UUID (required for update)"),
|
|
15
|
+
name: z.string().max(200).optional().describe("Strategy name (required for create)"),
|
|
16
|
+
description: z.string().max(2000).optional().describe("What this strategy aims to achieve"),
|
|
17
|
+
targetDate: z.string().optional().describe("Target date (ISO 8601)"),
|
|
18
|
+
status: z.enum(["proposed", "active", "complete", "cancelled"]).optional().describe("Strategy status (update only)"),
|
|
19
|
+
readOnly: z.boolean().optional().describe("Whether this strategy runs in read-only audit mode (update only)"),
|
|
20
|
+
assignedAgentRoleId: z.string().uuid().nullable().optional().describe("Agent role UUID to assign, or null to unassign (update only)"),
|
|
21
|
+
pipelineConfig: z.object({
|
|
22
|
+
ci: z.object({
|
|
23
|
+
enabled: z.boolean(),
|
|
24
|
+
mergeStrategy: z.enum(["fast-forward", "rebase", "merge-commit"]),
|
|
25
|
+
}),
|
|
26
|
+
cd: z.object({ enabled: z.boolean() }),
|
|
27
|
+
teams: z.object({ enabled: z.boolean() }),
|
|
28
|
+
}).optional().describe("Pipeline configuration (update only)"),
|
|
29
|
+
keyResultIds: z.array(z.string().uuid()).optional().describe("Key result UUIDs to link at creation (create only)"),
|
|
30
|
+
strategyIds: z.array(z.string().uuid()).optional().describe("Ordered array of strategy UUIDs for reorder (first = rank 0)"),
|
|
31
|
+
limit: z.number().int().min(1).max(500).optional().describe("Max results (1-500, default 50)"),
|
|
32
|
+
offset: z.number().int().min(0).optional().describe("Number of results to skip (default 0)"),
|
|
33
|
+
detail: z.enum(["titles", "summary", "full"]).optional().describe("Response detail level"),
|
|
34
|
+
returnFull: z.boolean().optional().describe("Return full entity (default: compact)"),
|
|
35
|
+
}, wrapHandler(async (params) => {
|
|
36
|
+
switch (params.action) {
|
|
37
|
+
case "list": {
|
|
38
|
+
if (!params.productId)
|
|
39
|
+
return validationError("productId required for list");
|
|
40
|
+
const body = {
|
|
41
|
+
action: "strategy_list",
|
|
42
|
+
productId: params.productId,
|
|
43
|
+
};
|
|
44
|
+
if (params.limit !== undefined)
|
|
45
|
+
body.limit = params.limit;
|
|
46
|
+
if (params.offset !== undefined)
|
|
47
|
+
body.offset = params.offset;
|
|
48
|
+
if (params.detail !== undefined)
|
|
49
|
+
body.detail = params.detail;
|
|
50
|
+
const result = await callProductApi(getCreds(), body);
|
|
51
|
+
const listResponse = { items: result.strategies, totalCount: result.totalCount };
|
|
52
|
+
if (profile === 'human') {
|
|
53
|
+
listResponse.context_available = true;
|
|
54
|
+
listResponse.context_hint = "Use telora_context_assemble with strategyId for layered context (philosophy + strategy goals + delivery summaries).";
|
|
55
|
+
}
|
|
56
|
+
return successResult(listResponse);
|
|
57
|
+
}
|
|
58
|
+
case "create": {
|
|
59
|
+
if (profile !== 'full' && profile !== 'human')
|
|
60
|
+
return validationError("strategy create not available in this profile");
|
|
61
|
+
if (!params.productId)
|
|
62
|
+
return validationError("productId required for create");
|
|
63
|
+
if (!params.name)
|
|
64
|
+
return validationError("name required for create");
|
|
65
|
+
const fields = buildFields(params, ['name', 'description', 'targetDate']);
|
|
66
|
+
const body = {
|
|
67
|
+
action: "strategy_create",
|
|
68
|
+
productId: params.productId,
|
|
69
|
+
fields,
|
|
70
|
+
};
|
|
71
|
+
if (params.keyResultIds && params.keyResultIds.length > 0) {
|
|
72
|
+
body.keyResultIds = params.keyResultIds;
|
|
73
|
+
}
|
|
74
|
+
const result = await callProductApi(getCreds(), body);
|
|
75
|
+
const compact = compactEntity(result.strategy, Object.keys(fields), params.returnFull);
|
|
76
|
+
if (!params.returnFull && result.linkedKeyResultIds?.length) {
|
|
77
|
+
compact.linkedKeyResultIds = result.linkedKeyResultIds;
|
|
78
|
+
}
|
|
79
|
+
return successResult(compact);
|
|
80
|
+
}
|
|
81
|
+
case "update": {
|
|
82
|
+
if (profile !== 'full' && profile !== 'human')
|
|
83
|
+
return validationError("strategy update not available in this profile");
|
|
84
|
+
if (!params.strategyId)
|
|
85
|
+
return validationError("strategyId required for update");
|
|
86
|
+
const fields = buildFields(params, ['name', 'description', 'targetDate', 'status', 'readOnly', 'assignedAgentRoleId', 'pipelineConfig']);
|
|
87
|
+
if (Object.keys(fields).length === 0) {
|
|
88
|
+
return validationError("Provide at least one field to update");
|
|
89
|
+
}
|
|
90
|
+
const result = await callProductApi(getCreds(), {
|
|
91
|
+
action: "strategy_update",
|
|
92
|
+
strategyId: params.strategyId,
|
|
93
|
+
fields,
|
|
94
|
+
});
|
|
95
|
+
return successResult(compactEntity(result.strategy, Object.keys(fields), params.returnFull));
|
|
96
|
+
}
|
|
97
|
+
case "reorder": {
|
|
98
|
+
if (profile !== 'full' && profile !== 'human')
|
|
99
|
+
return validationError("strategy reorder not available in this profile");
|
|
100
|
+
if (!params.productId)
|
|
101
|
+
return validationError("productId required for reorder");
|
|
102
|
+
if (!params.strategyIds)
|
|
103
|
+
return validationError("strategyIds required for reorder");
|
|
104
|
+
const result = await callProductApi(getCreds(), {
|
|
105
|
+
action: "strategy_reorder",
|
|
106
|
+
productId: params.productId,
|
|
107
|
+
strategyIds: params.strategyIds,
|
|
108
|
+
});
|
|
109
|
+
return successResult(result.strategies);
|
|
110
|
+
}
|
|
111
|
+
default:
|
|
112
|
+
return validationError(`Unknown action: ${params.action}`);
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=strategyHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategyHandlers.js","sourceRoot":"","sources":["../../src/handlers/strategyHandlers.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wCAAwC;AACxC,+DAA+D;AAC/D,8EAA8E;AAE9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,cAAc,EACd,aAAa,EACb,eAAe,EACf,WAAW,EACX,WAAW,EACX,aA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YAC1C,CAAC;YACD;gBACE,OAAO,eAAe,CAAC,mBAAmB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Workflow tool handler (consolidated):
|
|
3
|
+
// telora_workflow (list | get | create | update | assign)
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { callProductApi, successResult, validationError, buildFields, wrapHandler, compactEntity, } from "../shared.js";
|
|
7
|
+
export function registerWorkflowTools(server, getCreds) {
|
|
8
|
+
server.tool("telora_workflow", "State machine configuration: define workflow stages, transition guards, and policy automation for entities. " +
|
|
9
|
+
"Workflows control how products, strategies, deliveries, and issues move through lifecycle stages. " +
|
|
10
|
+
"Actions: list workflows (filter by entity type), get details (stages, transitions, guards), " +
|
|
11
|
+
"create a workflow (name + entityType), update properties, assign a workflow to an entity.", {
|
|
12
|
+
action: z.enum(["list", "get", "create", "update", "assign"]).describe("Action to perform"),
|
|
13
|
+
workflowId: z.string().uuid().optional().describe("Workflow UUID (required for get, update, assign)"),
|
|
14
|
+
entityType: z.enum(["product", "strategy", "delivery", "issue"]).optional().describe("Entity type (required for create; list: filter; assign: target type)"),
|
|
15
|
+
entityId: z.string().uuid().optional().describe("Entity UUID (required for assign)"),
|
|
16
|
+
name: z.string().max(200).optional().describe("Workflow name (required for create)"),
|
|
17
|
+
description: z.string().max(2000).optional().describe("Workflow description"),
|
|
18
|
+
limit: z.number().int().min(1).max(500).optional().describe("Max results (1-500, default 50)"),
|
|
19
|
+
offset: z.number().int().min(0).optional().describe("Number of results to skip (default 0)"),
|
|
20
|
+
detail: z.enum(["titles", "summary", "full"]).optional().describe("Response detail level"),
|
|
21
|
+
returnFull: z.boolean().optional().describe("Return full entity (default: compact)"),
|
|
22
|
+
}, wrapHandler(async (params) => {
|
|
23
|
+
switch (params.action) {
|
|
24
|
+
case "list": {
|
|
25
|
+
const fields = buildFields({ entityType: params.entityType });
|
|
26
|
+
const body = {
|
|
27
|
+
action: "workflow_list",
|
|
28
|
+
fields: Object.keys(fields).length > 0 ? fields : undefined,
|
|
29
|
+
};
|
|
30
|
+
if (params.limit !== undefined)
|
|
31
|
+
body.limit = params.limit;
|
|
32
|
+
if (params.offset !== undefined)
|
|
33
|
+
body.offset = params.offset;
|
|
34
|
+
if (params.detail !== undefined)
|
|
35
|
+
body.detail = params.detail;
|
|
36
|
+
const result = await callProductApi(getCreds(), body);
|
|
37
|
+
return successResult({ items: result.workflows, totalCount: result.totalCount });
|
|
38
|
+
}
|
|
39
|
+
case "get": {
|
|
40
|
+
if (!params.workflowId)
|
|
41
|
+
return validationError("workflowId required for get");
|
|
42
|
+
const result = await callProductApi(getCreds(), {
|
|
43
|
+
action: "workflow_get",
|
|
44
|
+
workflowId: params.workflowId,
|
|
45
|
+
});
|
|
46
|
+
return successResult(result.workflow);
|
|
47
|
+
}
|
|
48
|
+
case "create": {
|
|
49
|
+
if (!params.name)
|
|
50
|
+
return validationError("name required for create");
|
|
51
|
+
if (!params.entityType)
|
|
52
|
+
return validationError("entityType required for create");
|
|
53
|
+
const fields = buildFields({ name: params.name, entityType: params.entityType, description: params.description });
|
|
54
|
+
const result = await callProductApi(getCreds(), {
|
|
55
|
+
action: "workflow_create",
|
|
56
|
+
fields,
|
|
57
|
+
});
|
|
58
|
+
return successResult(compactEntity(result.workflow, Object.keys(fields), params.returnFull));
|
|
59
|
+
}
|
|
60
|
+
case "update": {
|
|
61
|
+
if (!params.workflowId)
|
|
62
|
+
return validationError("workflowId required for update");
|
|
63
|
+
const fields = buildFields({ name: params.name, description: params.description });
|
|
64
|
+
if (Object.keys(fields).length === 0) {
|
|
65
|
+
return validationError("Provide at least one field to update");
|
|
66
|
+
}
|
|
67
|
+
const result = await callProductApi(getCreds(), {
|
|
68
|
+
action: "workflow_update",
|
|
69
|
+
workflowId: params.workflowId,
|
|
70
|
+
fields,
|
|
71
|
+
});
|
|
72
|
+
return successResult(compactEntity(result.workflow, Object.keys(fields), params.returnFull));
|
|
73
|
+
}
|
|
74
|
+
case "assign": {
|
|
75
|
+
if (!params.workflowId)
|
|
76
|
+
return validationError("workflowId required for assign");
|
|
77
|
+
if (!params.entityType)
|
|
78
|
+
return validationError("entityType required for assign");
|
|
79
|
+
if (!params.entityId)
|
|
80
|
+
return validationError("entityId required for assign");
|
|
81
|
+
const result = await callProductApi(getCreds(), {
|
|
82
|
+
action: "workflow_assign",
|
|
83
|
+
workflowId: params.workflowId,
|
|
84
|
+
fields: { entityType: params.entityType, entityId: params.entityId },
|
|
85
|
+
});
|
|
86
|
+
return successResult(result.assignment);
|
|
87
|
+
}
|
|
88
|
+
default:
|
|
89
|
+
return validationError(`Unknown action: ${params.action}`);
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=workflowHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflowHandlers.js","sourceRoot":"","sources":["../../src/handlers/workflowHandlers.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wCAAwC;AACxC,4DAA4D;AAC5D,8EAA8E;AAE9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,cAAc,EACd,aAAa,EACb,eAAe,EACf,WAAW,EACX,WAAW,EACX,aAAa,GAEd,MAAM,cAAc,CAAC;AAEtB,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,QAAkB;IACzE,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,8GAA8G;QAC9G,oGAAoG;QACpG,8FAA8F;QAC9F,2FAA2F,EAC3F;QACE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,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aAAa,CAAC,MAAM,CAAC,QAAmC,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;YAC1H,CAAC;YACD,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,IAAI,CAAC,MAAM,CAAC,UAAU;oBAAE,OAAO,eAAe,CAAC,gCAAgC,CAAC,CAAC;gBACjF,IAAI,CAAC,MAAM,CAAC,UAAU;oBAAE,OAAO,eAAe,CAAC,gCAAgC,CAAC,CAAC;gBACjF,IAAI,CAAC,MAAM,CAAC,QAAQ;oBAAE,OAAO,eAAe,CAAC,8BAA8B,CAAC,CAAC;gBAC7E,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,QAAQ,EAAE,EAAE;oBAC9C,MAAM,EAAE,iBAAiB;oBACzB,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE;iBACrE,CAA4C,CAAC;gBAC9C,OAAO,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC1C,CAAC;YACD;gBACE,OAAO,eAAe,CAAC,mBAAmB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// CLI subcommand routing -- must run before any MCP imports touch stdio
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
const subcommand = process.argv[2];
|
|
6
|
+
if (subcommand === "init") {
|
|
7
|
+
const { runInit } = await import("./cli/init.js");
|
|
8
|
+
await runInit(process.argv.slice(2));
|
|
9
|
+
process.exit(0);
|
|
10
|
+
}
|
|
11
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
12
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
13
|
+
import { loadCredentials } from "./shared.js";
|
|
14
|
+
import { registerProductTools, registerDeliveryTools, registerStrategyTools, registerIssueTools, registerOkrTools, registerAgentTools, registerPlaybookTools, registerConnectorTools, registerWorkflowTools, registerContextTools, registerContextAssembleTool, registerIdeaTools, registerFactoryTools, registerDeploymentProfileTools, registerInfrastructureTools, registerReportTools, } from "./handlers/index.js";
|
|
15
|
+
import { registerDiscoverTool } from "./handlers/discoverHandler.js";
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// MCP Server
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
const server = new McpServer({
|
|
20
|
+
name: "telora-products",
|
|
21
|
+
version: "0.5.0",
|
|
22
|
+
});
|
|
23
|
+
// Load credentials on demand (re-reads env each call)
|
|
24
|
+
function getCreds() {
|
|
25
|
+
return loadCredentials();
|
|
26
|
+
}
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
// Profile-based tool registration
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
const profile = (process.env.TELORA_MCP_PROFILE || 'human');
|
|
31
|
+
if (profile === 'human') {
|
|
32
|
+
// -------------------------------------------------------------------------
|
|
33
|
+
// Human profile: core tools at startup + telora_discover for the rest
|
|
34
|
+
// -------------------------------------------------------------------------
|
|
35
|
+
// Core tools -- always registered for interactive sessions
|
|
36
|
+
// Target: ≤25 decomposed tools at startup (Claude Code decomposes action enums)
|
|
37
|
+
registerProductTools(server, getCreds, profile);
|
|
38
|
+
registerDeliveryTools(server, getCreds);
|
|
39
|
+
registerStrategyTools(server, getCreds, profile);
|
|
40
|
+
registerIssueTools(server, getCreds);
|
|
41
|
+
registerInfrastructureTools(server, getCreds);
|
|
42
|
+
registerContextAssembleTool(server, getCreds);
|
|
43
|
+
// Deferred domains -- loaded on demand via telora_discover
|
|
44
|
+
const domains = {
|
|
45
|
+
agent: {
|
|
46
|
+
description: "AI agent roles and human-AI escalation management (1 tool, 5 actions)",
|
|
47
|
+
keywords: ["agent", "role", "escalation", "AI", "blocked", "help"],
|
|
48
|
+
toolIndex: [{
|
|
49
|
+
name: "telora_agent", summary: "AI agent orchestration: roles and escalation requests",
|
|
50
|
+
actions: ["role_list", "escalate", "escalation_list", "escalation_get", "escalation_update"],
|
|
51
|
+
keywords: ["agent", "role", "escalate", "blocked", "help", "AI"],
|
|
52
|
+
}],
|
|
53
|
+
register: () => registerAgentTools(server, getCreds),
|
|
54
|
+
},
|
|
55
|
+
context: {
|
|
56
|
+
description: "Product context documents and linking to strategies/deliveries (2 tools, 7 actions)",
|
|
57
|
+
keywords: ["context", "document", "knowledge", "background", "link"],
|
|
58
|
+
toolIndex: [
|
|
59
|
+
{ name: "telora_product_context", summary: "Knowledge base: product context documents for AI agents",
|
|
60
|
+
actions: ["list", "create", "update", "delete", "reorder"],
|
|
61
|
+
keywords: ["context", "document", "knowledge", "background", "content"] },
|
|
62
|
+
{ name: "telora_product_context_link", summary: "Attach/detach context documents to strategies or deliveries",
|
|
63
|
+
actions: ["link", "unlink"],
|
|
64
|
+
keywords: ["link", "attach", "context", "strategy", "delivery"] },
|
|
65
|
+
],
|
|
66
|
+
register: () => registerContextTools(server, getCreds, profile),
|
|
67
|
+
},
|
|
68
|
+
connector: {
|
|
69
|
+
description: "Daemon connector for autonomous agent automation (1 tool)",
|
|
70
|
+
keywords: ["daemon", "connector", "start", "automation", "background"],
|
|
71
|
+
toolIndex: [{
|
|
72
|
+
name: "telora_connector_start", summary: "Launch Telora daemon for autonomous agent execution",
|
|
73
|
+
actions: [], keywords: ["daemon", "start", "connector", "launch", "automation"],
|
|
74
|
+
}],
|
|
75
|
+
register: () => registerConnectorTools(server, getCreds, profile),
|
|
76
|
+
},
|
|
77
|
+
factory: {
|
|
78
|
+
description: "Factory blueprints, specs, and instances for automated software production (3 tools)",
|
|
79
|
+
keywords: ["factory", "blueprint", "spec", "instance", "build", "production", "automated"],
|
|
80
|
+
toolIndex: [
|
|
81
|
+
{ name: "telora_factory_blueprint_list", summary: "List factory blueprints with gate configs and resource limits",
|
|
82
|
+
actions: [], keywords: ["factory", "blueprint", "list", "gate", "infrastructure"] },
|
|
83
|
+
{ name: "telora_factory_spec", summary: "Define what to build via conversational spec authoring",
|
|
84
|
+
actions: ["create", "get", "list", "update", "validate"],
|
|
85
|
+
keywords: ["factory", "spec", "specification", "requirements", "build", "launch"] },
|
|
86
|
+
{ name: "telora_factory_instance", summary: "View and control running factory instances (pause, cancel)",
|
|
87
|
+
actions: ["get", "update"],
|
|
88
|
+
keywords: ["factory", "instance", "running", "pause", "cancel", "resume"] },
|
|
89
|
+
],
|
|
90
|
+
register: () => registerFactoryTools(server, getCreds, profile),
|
|
91
|
+
},
|
|
92
|
+
okr: {
|
|
93
|
+
description: "OKR goal-setting: objectives, key results, strategy alignment (3 tools, 10 actions)",
|
|
94
|
+
keywords: ["OKR", "objective", "key result", "goal", "target", "alignment", "measurable"],
|
|
95
|
+
toolIndex: [
|
|
96
|
+
{ name: "telora_objective", summary: "Strategic objectives with cascading alignment",
|
|
97
|
+
actions: ["create", "get", "list", "update"],
|
|
98
|
+
keywords: ["objective", "goal", "OKR", "target", "achieve"] },
|
|
99
|
+
{ name: "telora_key_result", summary: "Measurable targets with metric types and confidence levels",
|
|
100
|
+
actions: ["create", "list", "update", "delete"],
|
|
101
|
+
keywords: ["key result", "metric", "target", "progress", "measure", "KR"] },
|
|
102
|
+
{ name: "telora_strategy_key_result", summary: "Connect strategies to key results for traceability",
|
|
103
|
+
actions: ["link", "unlink"],
|
|
104
|
+
keywords: ["link", "strategy", "key result", "alignment", "OKR"] },
|
|
105
|
+
],
|
|
106
|
+
register: () => registerOkrTools(server, getCreds),
|
|
107
|
+
},
|
|
108
|
+
ideas: {
|
|
109
|
+
description: "Idea cloud: continuous capture, brainstorming, connections, clusters (3 tools, 12 actions)",
|
|
110
|
+
keywords: ["idea", "brainstorm", "capture", "connection", "cluster", "innovation"],
|
|
111
|
+
toolIndex: [
|
|
112
|
+
{ name: "telora_idea", summary: "Capture ideas: observations, hypotheses, references, links",
|
|
113
|
+
actions: ["create", "list", "update", "delete"],
|
|
114
|
+
keywords: ["idea", "brainstorm", "capture", "thought", "observation"] },
|
|
115
|
+
{ name: "telora_idea_connection", summary: "Map relationships between ideas (supports, causes, contradicts)",
|
|
116
|
+
actions: ["create", "list", "update", "delete"],
|
|
117
|
+
keywords: ["connection", "relationship", "supports", "contradicts", "causes"] },
|
|
118
|
+
{ name: "telora_idea_cluster", summary: "Group related ideas into clusters that can crystallize into strategies",
|
|
119
|
+
actions: ["create", "list", "update", "delete"],
|
|
120
|
+
keywords: ["cluster", "group", "organize", "crystallize", "strategy"] },
|
|
121
|
+
],
|
|
122
|
+
register: () => registerIdeaTools(server, getCreds),
|
|
123
|
+
},
|
|
124
|
+
workflows: {
|
|
125
|
+
description: "Workflow state machines with transition guards and policy automation (1 tool, 5 actions)",
|
|
126
|
+
keywords: ["workflow", "state machine", "transition", "guard", "policy", "lifecycle", "stage"],
|
|
127
|
+
toolIndex: [{
|
|
128
|
+
name: "telora_workflow", summary: "Configure lifecycle stages, transition guards, and assignments",
|
|
129
|
+
actions: ["list", "get", "create", "update", "assign"],
|
|
130
|
+
keywords: ["workflow", "stage", "transition", "guard", "assign", "policy", "state machine"],
|
|
131
|
+
}],
|
|
132
|
+
register: () => registerWorkflowTools(server, getCreds),
|
|
133
|
+
},
|
|
134
|
+
reports: {
|
|
135
|
+
description: "Stakeholder reports: AI-generated weekly digests of product progress (1 tool, 3 actions)",
|
|
136
|
+
keywords: ["report", "stakeholder", "weekly", "digest", "summary", "progress"],
|
|
137
|
+
toolIndex: [{
|
|
138
|
+
name: "telora_product_report", summary: "AI-generated weekly stakeholder digests",
|
|
139
|
+
actions: ["list", "generate", "update"],
|
|
140
|
+
keywords: ["report", "stakeholder", "weekly", "digest", "summary", "progress"],
|
|
141
|
+
}],
|
|
142
|
+
register: () => registerReportTools(server, getCreds),
|
|
143
|
+
},
|
|
144
|
+
playbooks: {
|
|
145
|
+
description: "Playbook templates for repeatable execution patterns (1 tool, 4 actions)",
|
|
146
|
+
keywords: ["playbook", "template", "pattern", "audit", "instantiate", "repeatable"],
|
|
147
|
+
toolIndex: [{
|
|
148
|
+
name: "telora_playbook", summary: "Template strategies with pre-configured deliveries and issues",
|
|
149
|
+
actions: ["list", "get", "create", "instantiate"],
|
|
150
|
+
keywords: ["playbook", "template", "pattern", "audit", "instantiate", "rollout"],
|
|
151
|
+
}],
|
|
152
|
+
register: () => registerPlaybookTools(server, getCreds),
|
|
153
|
+
},
|
|
154
|
+
profiles: {
|
|
155
|
+
description: "Deployment profiles for CI/CD and environment configuration (1 tool, 5 actions)",
|
|
156
|
+
keywords: ["deployment", "profile", "CI/CD", "environment", "infrastructure", "deploy"],
|
|
157
|
+
toolIndex: [{
|
|
158
|
+
name: "telora_deployment_profile", summary: "Define target environments and deployment guidelines",
|
|
159
|
+
actions: ["create", "list", "get", "update", "link_to_product"],
|
|
160
|
+
keywords: ["deployment", "profile", "CI/CD", "environment", "infrastructure", "deploy"],
|
|
161
|
+
}],
|
|
162
|
+
register: () => registerDeploymentProfileTools(server, getCreds),
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
const startup = {
|
|
166
|
+
context_assemble: {
|
|
167
|
+
description: "Layered context assembly for interactive sessions (1 tool)",
|
|
168
|
+
keywords: ["context", "assemble", "philosophy", "architecture", "design"],
|
|
169
|
+
toolIndex: [{
|
|
170
|
+
name: "telora_context_assemble", summary: "Assemble product/strategy/delivery context as markdown",
|
|
171
|
+
actions: [],
|
|
172
|
+
keywords: ["context", "assemble", "philosophy", "architecture", "design", "session"],
|
|
173
|
+
}],
|
|
174
|
+
},
|
|
175
|
+
product: {
|
|
176
|
+
description: "Product registry: portfolio management (1 tool, 5 actions)",
|
|
177
|
+
keywords: ["product", "portfolio", "create", "overview"],
|
|
178
|
+
toolIndex: [{
|
|
179
|
+
name: "telora_product", summary: "Product registry: manage software products and their settings",
|
|
180
|
+
actions: ["list", "create", "get", "update", "overview"],
|
|
181
|
+
keywords: ["product", "portfolio", "create", "overview", "vision"],
|
|
182
|
+
}],
|
|
183
|
+
},
|
|
184
|
+
strategy: {
|
|
185
|
+
description: "Execution roadmap: themed work scopes and agent assignment (1 tool, 4 actions)",
|
|
186
|
+
keywords: ["strategy", "roadmap", "scope", "theme", "agent"],
|
|
187
|
+
toolIndex: [{
|
|
188
|
+
name: "telora_product_strategy", summary: "Execution roadmap: group deliveries into themed work scopes",
|
|
189
|
+
actions: ["list", "create", "update", "reorder"],
|
|
190
|
+
keywords: ["strategy", "roadmap", "scope", "theme", "execution", "agent role"],
|
|
191
|
+
}],
|
|
192
|
+
},
|
|
193
|
+
delivery: {
|
|
194
|
+
description: "Work packages: shippable increments with acceptance criteria (1 tool, 6 actions)",
|
|
195
|
+
keywords: ["delivery", "work package", "increment", "ship"],
|
|
196
|
+
toolIndex: [{
|
|
197
|
+
name: "telora_product_delivery", summary: "Work packages: individual shippable increments within a strategy",
|
|
198
|
+
actions: ["list", "create", "update", "operationalize", "delete", "reorder"],
|
|
199
|
+
keywords: ["delivery", "work package", "increment", "criteria", "ship"],
|
|
200
|
+
}],
|
|
201
|
+
},
|
|
202
|
+
issue: {
|
|
203
|
+
description: "Task tracking: issues (tasks, bugs, context groups) within deliveries (1 tool, 4 actions)",
|
|
204
|
+
keywords: ["issue", "task", "bug", "context group", "tracking"],
|
|
205
|
+
toolIndex: [{
|
|
206
|
+
name: "telora_product_issue", summary: "Task tracking: manage tasks, bugs, and context groups",
|
|
207
|
+
actions: ["list", "create", "update", "delete"],
|
|
208
|
+
keywords: ["issue", "task", "bug", "context group", "status", "tracking"],
|
|
209
|
+
}],
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
const infraStartup = {
|
|
213
|
+
infrastructure: {
|
|
214
|
+
description: "Infrastructure asset registry: environments, assets, relationships, secrets (4 tools)",
|
|
215
|
+
keywords: ["infrastructure", "environment", "asset", "secret", "database", "service", "relationship"],
|
|
216
|
+
toolIndex: [
|
|
217
|
+
{ name: "telora_infra_environment", summary: "Named deployment targets (production, staging, dev)",
|
|
218
|
+
actions: ["list", "create", "update", "delete"],
|
|
219
|
+
keywords: ["environment", "production", "staging", "dev", "deploy"] },
|
|
220
|
+
{ name: "telora_infra_asset", summary: "Typed resources: databases, containers, services, etc.",
|
|
221
|
+
actions: ["list", "create", "update", "delete"],
|
|
222
|
+
keywords: ["asset", "database", "container", "service", "proxy", "dns"] },
|
|
223
|
+
{ name: "telora_infra_relationship", summary: "Directed links between assets (connects_to, depends_on, hosts)",
|
|
224
|
+
actions: ["list", "create", "delete"],
|
|
225
|
+
keywords: ["relationship", "connects", "depends", "hosts", "deploys", "proxies"] },
|
|
226
|
+
{ name: "telora_infra_secret", summary: "Vault-encrypted secrets per asset",
|
|
227
|
+
actions: ["list", "create", "get", "delete"],
|
|
228
|
+
keywords: ["secret", "credential", "key", "vault", "encrypt"] },
|
|
229
|
+
],
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
registerDiscoverTool(server, domains, { ...startup, ...infraStartup });
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
// -------------------------------------------------------------------------
|
|
236
|
+
// Non-human profiles: register everything at startup (no behavior change)
|
|
237
|
+
// -------------------------------------------------------------------------
|
|
238
|
+
// Product tools: get is always available; list/overview/create/update gated by profile
|
|
239
|
+
registerProductTools(server, getCreds, profile);
|
|
240
|
+
// Context tools: list is always available; mutations gated behind 'full'
|
|
241
|
+
registerContextTools(server, getCreds, profile);
|
|
242
|
+
// Factory tools: available in 'full', 'execution', and 'factory' profiles
|
|
243
|
+
registerFactoryTools(server, getCreds, profile);
|
|
244
|
+
// Daemon/workflow tools: excluded from factory profile
|
|
245
|
+
if (profile !== 'factory') {
|
|
246
|
+
registerDeliveryTools(server, getCreds);
|
|
247
|
+
registerStrategyTools(server, getCreds, profile);
|
|
248
|
+
registerIssueTools(server, getCreds);
|
|
249
|
+
registerAgentTools(server, getCreds);
|
|
250
|
+
}
|
|
251
|
+
// Playbook tools: full and execution profiles only
|
|
252
|
+
if (profile !== 'factory') {
|
|
253
|
+
registerPlaybookTools(server, getCreds);
|
|
254
|
+
}
|
|
255
|
+
// Deployment profile tools: full and execution profiles only
|
|
256
|
+
if (profile !== 'factory') {
|
|
257
|
+
registerDeploymentProfileTools(server, getCreds);
|
|
258
|
+
registerInfrastructureTools(server, getCreds);
|
|
259
|
+
registerReportTools(server, getCreds);
|
|
260
|
+
}
|
|
261
|
+
// Full profile only: OKR, ideas, workflows
|
|
262
|
+
if (profile === 'full') {
|
|
263
|
+
registerOkrTools(server, getCreds);
|
|
264
|
+
registerIdeaTools(server, getCreds);
|
|
265
|
+
registerWorkflowTools(server, getCreds);
|
|
266
|
+
}
|
|
267
|
+
// Connector tools: full profile only (non-human)
|
|
268
|
+
if (profile === 'full') {
|
|
269
|
+
registerConnectorTools(server, getCreds, profile);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// ---------------------------------------------------------------------------
|
|
273
|
+
// Start
|
|
274
|
+
// ---------------------------------------------------------------------------
|
|
275
|
+
async function main() {
|
|
276
|
+
const transport = new StdioServerTransport();
|
|
277
|
+
await server.connect(transport);
|
|
278
|
+
console.error(`[telora-products] MCP server running on stdio (profile: ${profile})`);
|
|
279
|
+
}
|
|
280
|
+
main().catch((err) => {
|
|
281
|
+
console.error("[telora-products] Fatal:", err);
|
|
282
|
+
process.exit(1);
|
|
283
|
+
});
|
|
284
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,8EAA8E;AAC9E,wEAAwE;AACxE,8EAA8E;AAC9E,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnC,I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M,EAAE,QAAQ,CAAC,CAAC;QACnC,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACpC,qBAAqB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,iDAAiD;IACjD,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,QAAQ;AACR,8EAA8E;AAE9E,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,2DAA2D,OAAO,GAAG,CAAC,CAAC;AACvF,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export type ToolProfile = 'full' | 'execution' | 'factory' | 'human';
|
|
2
|
+
export interface TrackerConfig {
|
|
3
|
+
accessToken: string;
|
|
4
|
+
teloraUrl: string;
|
|
5
|
+
}
|
|
6
|
+
/** Credentials getter -- re-reads on each call so registration changes are picked up */
|
|
7
|
+
export type GetCreds = () => TrackerConfig;
|
|
8
|
+
export declare function loadCredentials(): TrackerConfig;
|
|
9
|
+
export declare function callProductApi(creds: TrackerConfig, body: Record<string, unknown>): Promise<unknown>;
|
|
10
|
+
export declare function successResult(data: unknown): {
|
|
11
|
+
content: {
|
|
12
|
+
type: "text";
|
|
13
|
+
text: string;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
export declare function errorResult(err: unknown): {
|
|
17
|
+
content: {
|
|
18
|
+
type: "text";
|
|
19
|
+
text: string;
|
|
20
|
+
}[];
|
|
21
|
+
isError: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare function validationError(message: string): {
|
|
24
|
+
content: {
|
|
25
|
+
type: "text";
|
|
26
|
+
text: string;
|
|
27
|
+
}[];
|
|
28
|
+
isError: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Strip an entity response to only the ID + fields the caller requested.
|
|
32
|
+
* Used by create/update handlers to minimize token usage in agent responses.
|
|
33
|
+
*/
|
|
34
|
+
export declare function compactEntity(entity: Record<string, unknown>, requestedFields: string[], returnFull?: boolean): Record<string, unknown>;
|
|
35
|
+
type ToolResult = ReturnType<typeof successResult> | ReturnType<typeof errorResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Build a fields object from params, only including defined values.
|
|
38
|
+
* Replaces the repetitive `if (x !== undefined) fields.x = x` pattern.
|
|
39
|
+
*
|
|
40
|
+
* @param params - Object with all tool parameters
|
|
41
|
+
* @param fieldNames - Names of fields to include (defaults to all params)
|
|
42
|
+
* @param required - Names of required fields to always include
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Before:
|
|
46
|
+
* const fields: Record<string, unknown> = {};
|
|
47
|
+
* if (name !== undefined) fields.name = name;
|
|
48
|
+
* if (description !== undefined) fields.description = description;
|
|
49
|
+
* if (status !== undefined) fields.status = status;
|
|
50
|
+
*
|
|
51
|
+
* // After:
|
|
52
|
+
* const fields = buildFields(params, ['name', 'description', 'status']);
|
|
53
|
+
*/
|
|
54
|
+
export declare function buildFields(params: Record<string, unknown>, fieldNames?: string[], required?: string[]): Record<string, unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* Wrap an async handler with standard try/catch error handling.
|
|
57
|
+
* Replaces the repetitive try { ... } catch (err) { return errorResult(err); } pattern.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // Before:
|
|
61
|
+
* async (params) => {
|
|
62
|
+
* try {
|
|
63
|
+
* const result = await callProductApi(getCreds(), { action: "create", ... });
|
|
64
|
+
* return successResult(result.product);
|
|
65
|
+
* } catch (err) {
|
|
66
|
+
* return errorResult(err);
|
|
67
|
+
* }
|
|
68
|
+
* }
|
|
69
|
+
*
|
|
70
|
+
* // After:
|
|
71
|
+
* wrapHandler(async (params) => {
|
|
72
|
+
* const result = await callProductApi(getCreds(), { action: "create", ... });
|
|
73
|
+
* return successResult(result.product);
|
|
74
|
+
* })
|
|
75
|
+
*/
|
|
76
|
+
export declare function wrapHandler<T extends Record<string, unknown>>(handler: (params: T) => Promise<ToolResult>): (params: T) => Promise<ToolResult>;
|
|
77
|
+
export {};
|