@muxoai/platform 0.0.0-stage → 1.2.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.
Files changed (173) hide show
  1. package/ARCHITECTURE.md +111 -0
  2. package/README.md +53 -2
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +527 -0
  5. package/dist/config.d.ts +20 -0
  6. package/dist/config.js +89 -0
  7. package/dist/engine.d.ts +128 -0
  8. package/dist/engine.js +709 -0
  9. package/dist/index.d.ts +7 -0
  10. package/dist/index.js +7 -0
  11. package/dist/mcp.d.ts +9 -0
  12. package/dist/mcp.js +401 -0
  13. package/dist/providers/composio-instant.d.ts +14 -0
  14. package/dist/providers/composio-instant.js +372 -0
  15. package/dist/providers/composio-sdk.d.ts +41 -0
  16. package/dist/providers/composio-sdk.js +514 -0
  17. package/dist/providers/microsoft-governance.d.ts +66 -0
  18. package/dist/providers/microsoft-governance.js +415 -0
  19. package/dist/providers/stripe-billing.d.ts +31 -0
  20. package/dist/providers/stripe-billing.js +168 -0
  21. package/dist/providers/stripe-projects.d.ts +53 -0
  22. package/dist/providers/stripe-projects.js +607 -0
  23. package/dist/providers/supermemory.d.ts +64 -0
  24. package/dist/providers/supermemory.js +224 -0
  25. package/dist/sdk.d.ts +115 -0
  26. package/dist/sdk.js +117 -0
  27. package/dist/server.d.ts +10 -0
  28. package/dist/server.js +816 -0
  29. package/dist/store.d.ts +200 -0
  30. package/dist/store.js +1260 -0
  31. package/dist/types.d.ts +273 -0
  32. package/dist/types.js +1 -0
  33. package/dist/ui/console-html.d.ts +2 -0
  34. package/dist/ui/console-html.js +2153 -0
  35. package/package.json +74 -4
  36. package/plugins/muxo/.app.json +8 -0
  37. package/plugins/muxo/.claude-plugin/plugin.json +16 -0
  38. package/plugins/muxo/.codex-plugin/plugin.json +51 -0
  39. package/plugins/muxo/.mcp.json +8 -0
  40. package/plugins/muxo/assets/logo.png +0 -0
  41. package/plugins/muxo/assets/logo.svg +6 -0
  42. package/plugins/muxo/hooks/hooks.json +27 -0
  43. package/plugins/muxo/hooks/session-start.sh +85 -0
  44. package/plugins/muxo/hooks/user-prompt-submit.sh +45 -0
  45. package/plugins/muxo/skills/muxo/SKILL.md +25 -0
  46. package/plugins/muxo/skills/muxo/references/cli.md +57 -0
  47. package/plugins/muxo/skills/muxo/references/mcp.md +25 -0
  48. package/src/catalogues/stripe-projects-catalog.json +9832 -0
  49. package/vendor/microsoft-governance/README.md +363 -0
  50. package/vendor/microsoft-governance/dist/audit.d.ts +26 -0
  51. package/vendor/microsoft-governance/dist/audit.d.ts.map +1 -0
  52. package/vendor/microsoft-governance/dist/audit.js +107 -0
  53. package/vendor/microsoft-governance/dist/audit.js.map +1 -0
  54. package/vendor/microsoft-governance/dist/cascade-containment.d.ts +84 -0
  55. package/vendor/microsoft-governance/dist/cascade-containment.d.ts.map +1 -0
  56. package/vendor/microsoft-governance/dist/cascade-containment.js +387 -0
  57. package/vendor/microsoft-governance/dist/cascade-containment.js.map +1 -0
  58. package/vendor/microsoft-governance/dist/client.d.ts +34 -0
  59. package/vendor/microsoft-governance/dist/client.d.ts.map +1 -0
  60. package/vendor/microsoft-governance/dist/client.js +112 -0
  61. package/vendor/microsoft-governance/dist/client.js.map +1 -0
  62. package/vendor/microsoft-governance/dist/context-poisoning.d.ts +58 -0
  63. package/vendor/microsoft-governance/dist/context-poisoning.d.ts.map +1 -0
  64. package/vendor/microsoft-governance/dist/context-poisoning.js +410 -0
  65. package/vendor/microsoft-governance/dist/context-poisoning.js.map +1 -0
  66. package/vendor/microsoft-governance/dist/credential-vault.d.ts +213 -0
  67. package/vendor/microsoft-governance/dist/credential-vault.d.ts.map +1 -0
  68. package/vendor/microsoft-governance/dist/credential-vault.js +567 -0
  69. package/vendor/microsoft-governance/dist/credential-vault.js.map +1 -0
  70. package/vendor/microsoft-governance/dist/discovery.d.ts +80 -0
  71. package/vendor/microsoft-governance/dist/discovery.d.ts.map +1 -0
  72. package/vendor/microsoft-governance/dist/discovery.js +404 -0
  73. package/vendor/microsoft-governance/dist/discovery.js.map +1 -0
  74. package/vendor/microsoft-governance/dist/encryption/channel.d.ts +29 -0
  75. package/vendor/microsoft-governance/dist/encryption/channel.d.ts.map +1 -0
  76. package/vendor/microsoft-governance/dist/encryption/channel.js +78 -0
  77. package/vendor/microsoft-governance/dist/encryption/channel.js.map +1 -0
  78. package/vendor/microsoft-governance/dist/encryption/index.d.ts +9 -0
  79. package/vendor/microsoft-governance/dist/encryption/index.d.ts.map +1 -0
  80. package/vendor/microsoft-governance/dist/encryption/index.js +23 -0
  81. package/vendor/microsoft-governance/dist/encryption/index.js.map +1 -0
  82. package/vendor/microsoft-governance/dist/encryption/mesh-client.d.ts +267 -0
  83. package/vendor/microsoft-governance/dist/encryption/mesh-client.d.ts.map +1 -0
  84. package/vendor/microsoft-governance/dist/encryption/mesh-client.js +1001 -0
  85. package/vendor/microsoft-governance/dist/encryption/mesh-client.js.map +1 -0
  86. package/vendor/microsoft-governance/dist/encryption/ratchet.d.ts +38 -0
  87. package/vendor/microsoft-governance/dist/encryption/ratchet.d.ts.map +1 -0
  88. package/vendor/microsoft-governance/dist/encryption/ratchet.js +223 -0
  89. package/vendor/microsoft-governance/dist/encryption/ratchet.js.map +1 -0
  90. package/vendor/microsoft-governance/dist/encryption/registry-client.d.ts +136 -0
  91. package/vendor/microsoft-governance/dist/encryption/registry-client.d.ts.map +1 -0
  92. package/vendor/microsoft-governance/dist/encryption/registry-client.js +369 -0
  93. package/vendor/microsoft-governance/dist/encryption/registry-client.js.map +1 -0
  94. package/vendor/microsoft-governance/dist/encryption/x3dh.d.ts +80 -0
  95. package/vendor/microsoft-governance/dist/encryption/x3dh.d.ts.map +1 -0
  96. package/vendor/microsoft-governance/dist/encryption/x3dh.js +238 -0
  97. package/vendor/microsoft-governance/dist/encryption/x3dh.js.map +1 -0
  98. package/vendor/microsoft-governance/dist/framework-adapter.d.ts +63 -0
  99. package/vendor/microsoft-governance/dist/framework-adapter.d.ts.map +1 -0
  100. package/vendor/microsoft-governance/dist/framework-adapter.js +253 -0
  101. package/vendor/microsoft-governance/dist/framework-adapter.js.map +1 -0
  102. package/vendor/microsoft-governance/dist/identity.d.ts +124 -0
  103. package/vendor/microsoft-governance/dist/identity.d.ts.map +1 -0
  104. package/vendor/microsoft-governance/dist/identity.js +446 -0
  105. package/vendor/microsoft-governance/dist/identity.js.map +1 -0
  106. package/vendor/microsoft-governance/dist/index.d.ts +39 -0
  107. package/vendor/microsoft-governance/dist/index.d.ts.map +1 -0
  108. package/vendor/microsoft-governance/dist/index.js +95 -0
  109. package/vendor/microsoft-governance/dist/index.js.map +1 -0
  110. package/vendor/microsoft-governance/dist/kill-switch.d.ts +22 -0
  111. package/vendor/microsoft-governance/dist/kill-switch.d.ts.map +1 -0
  112. package/vendor/microsoft-governance/dist/kill-switch.js +60 -0
  113. package/vendor/microsoft-governance/dist/kill-switch.js.map +1 -0
  114. package/vendor/microsoft-governance/dist/lifecycle.d.ts +50 -0
  115. package/vendor/microsoft-governance/dist/lifecycle.d.ts.map +1 -0
  116. package/vendor/microsoft-governance/dist/lifecycle.js +113 -0
  117. package/vendor/microsoft-governance/dist/lifecycle.js.map +1 -0
  118. package/vendor/microsoft-governance/dist/mcp.d.ts +41 -0
  119. package/vendor/microsoft-governance/dist/mcp.d.ts.map +1 -0
  120. package/vendor/microsoft-governance/dist/mcp.js +233 -0
  121. package/vendor/microsoft-governance/dist/mcp.js.map +1 -0
  122. package/vendor/microsoft-governance/dist/metrics.d.ts +123 -0
  123. package/vendor/microsoft-governance/dist/metrics.d.ts.map +1 -0
  124. package/vendor/microsoft-governance/dist/metrics.js +289 -0
  125. package/vendor/microsoft-governance/dist/metrics.js.map +1 -0
  126. package/vendor/microsoft-governance/dist/oci-manifest.d.ts +49 -0
  127. package/vendor/microsoft-governance/dist/oci-manifest.d.ts.map +1 -0
  128. package/vendor/microsoft-governance/dist/oci-manifest.js +182 -0
  129. package/vendor/microsoft-governance/dist/oci-manifest.js.map +1 -0
  130. package/vendor/microsoft-governance/dist/policy-backends/cedar.d.ts +15 -0
  131. package/vendor/microsoft-governance/dist/policy-backends/cedar.d.ts.map +1 -0
  132. package/vendor/microsoft-governance/dist/policy-backends/cedar.js +88 -0
  133. package/vendor/microsoft-governance/dist/policy-backends/cedar.js.map +1 -0
  134. package/vendor/microsoft-governance/dist/policy-backends/opa.d.ts +17 -0
  135. package/vendor/microsoft-governance/dist/policy-backends/opa.d.ts.map +1 -0
  136. package/vendor/microsoft-governance/dist/policy-backends/opa.js +74 -0
  137. package/vendor/microsoft-governance/dist/policy-backends/opa.js.map +1 -0
  138. package/vendor/microsoft-governance/dist/policy.d.ts +77 -0
  139. package/vendor/microsoft-governance/dist/policy.d.ts.map +1 -0
  140. package/vendor/microsoft-governance/dist/policy.js +760 -0
  141. package/vendor/microsoft-governance/dist/policy.js.map +1 -0
  142. package/vendor/microsoft-governance/dist/prompt-defense.d.ts +37 -0
  143. package/vendor/microsoft-governance/dist/prompt-defense.d.ts.map +1 -0
  144. package/vendor/microsoft-governance/dist/prompt-defense.js +229 -0
  145. package/vendor/microsoft-governance/dist/prompt-defense.js.map +1 -0
  146. package/vendor/microsoft-governance/dist/protocol-facets.d.ts +87 -0
  147. package/vendor/microsoft-governance/dist/protocol-facets.d.ts.map +1 -0
  148. package/vendor/microsoft-governance/dist/protocol-facets.js +728 -0
  149. package/vendor/microsoft-governance/dist/protocol-facets.js.map +1 -0
  150. package/vendor/microsoft-governance/dist/rings.d.ts +17 -0
  151. package/vendor/microsoft-governance/dist/rings.d.ts.map +1 -0
  152. package/vendor/microsoft-governance/dist/rings.js +61 -0
  153. package/vendor/microsoft-governance/dist/rings.js.map +1 -0
  154. package/vendor/microsoft-governance/dist/sandbox.d.ts +61 -0
  155. package/vendor/microsoft-governance/dist/sandbox.d.ts.map +1 -0
  156. package/vendor/microsoft-governance/dist/sandbox.js +199 -0
  157. package/vendor/microsoft-governance/dist/sandbox.js.map +1 -0
  158. package/vendor/microsoft-governance/dist/surface-parity.d.ts +45 -0
  159. package/vendor/microsoft-governance/dist/surface-parity.d.ts.map +1 -0
  160. package/vendor/microsoft-governance/dist/surface-parity.js +216 -0
  161. package/vendor/microsoft-governance/dist/surface-parity.js.map +1 -0
  162. package/vendor/microsoft-governance/dist/trust.d.ts +28 -0
  163. package/vendor/microsoft-governance/dist/trust.d.ts.map +1 -0
  164. package/vendor/microsoft-governance/dist/trust.js +209 -0
  165. package/vendor/microsoft-governance/dist/trust.js.map +1 -0
  166. package/vendor/microsoft-governance/dist/types.d.ts +422 -0
  167. package/vendor/microsoft-governance/dist/types.d.ts.map +1 -0
  168. package/vendor/microsoft-governance/dist/types.js +29 -0
  169. package/vendor/microsoft-governance/dist/types.js.map +1 -0
  170. package/vendor/microsoft-governance/dist/verify.d.ts +135 -0
  171. package/vendor/microsoft-governance/dist/verify.d.ts.map +1 -0
  172. package/vendor/microsoft-governance/dist/verify.js +356 -0
  173. package/vendor/microsoft-governance/dist/verify.js.map +1 -0
@@ -0,0 +1,7 @@
1
+ export { getConfig, ROOT_DIR, type MuxoConfig } from "./config.js";
2
+ export { MuxoEngine, type ExecutionContext } from "./engine.js";
3
+ export { handleJsonRpcMcpRequest, MUXO_MCP_TOOLS, type McpToolDefinition } from "./mcp.js";
4
+ export { MuxoClient, type MuxoClientOptions } from "./sdk.js";
5
+ export { createMuxoServer } from "./server.js";
6
+ export { MuxoStore } from "./store.js";
7
+ export * from "./types.js";
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { getConfig, ROOT_DIR } from "./config.js";
2
+ export { MuxoEngine } from "./engine.js";
3
+ export { handleJsonRpcMcpRequest, MUXO_MCP_TOOLS } from "./mcp.js";
4
+ export { MuxoClient } from "./sdk.js";
5
+ export { createMuxoServer } from "./server.js";
6
+ export { MuxoStore } from "./store.js";
7
+ export * from "./types.js";
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import type { ExecutionContext, MuxoEngine } from "./engine.js";
2
+ export interface McpToolDefinition {
3
+ name: string;
4
+ description: string;
5
+ inputSchema: Record<string, unknown>;
6
+ }
7
+ export declare const MUXO_MCP_TOOLS: McpToolDefinition[];
8
+ export declare function dispatchMcpToolCall(engine: MuxoEngine, ctx: ExecutionContext, toolName: string, args?: Record<string, unknown>): Promise<unknown>;
9
+ export declare function handleJsonRpcMcpRequest(engine: MuxoEngine, ctx: ExecutionContext, rpc: Record<string, unknown>): Promise<Record<string, unknown> | null>;
package/dist/mcp.js ADDED
@@ -0,0 +1,401 @@
1
+ export const MUXO_MCP_TOOLS = [
2
+ {
3
+ name: "get_profile",
4
+ description: "Get the authenticated actor profile, workspace ID, and subscription tier.",
5
+ inputSchema: { type: "object", properties: {} },
6
+ },
7
+ {
8
+ name: "get_organization",
9
+ description: "Get workspace governance policy, monthly action usage, credit balance, and active connection/resource counts.",
10
+ inputSchema: { type: "object", properties: {} },
11
+ },
12
+ {
13
+ name: "search_tools",
14
+ description: "Search the unified Muxo catalog across Connected Apps (Composio SDK: app.*), Instant Tools (Composio Instant: instant.*), and Cloud Infrastructure (Stripe Projects: resource.*).",
15
+ inputSchema: {
16
+ type: "object",
17
+ properties: {
18
+ query: {
19
+ type: "string",
20
+ description: "Search keywords (e.g. 'postgres', 'github issue', 'web search', 'redis')",
21
+ },
22
+ lane: {
23
+ type: "string",
24
+ enum: ["all", "composio_sdk", "composio_instant", "stripe_projects"],
25
+ default: "all",
26
+ },
27
+ risk_level: {
28
+ type: "string",
29
+ enum: ["read", "write", "admin", "financial", "provisioning", "destructive"],
30
+ },
31
+ limit: { type: "number", default: 20 },
32
+ },
33
+ },
34
+ },
35
+ {
36
+ name: "inspect_tool",
37
+ description: "Inspect a tool's full input JSON schema, risk classification, provider lane, and credit cost before planning.",
38
+ inputSchema: {
39
+ type: "object",
40
+ required: ["tool_slug"],
41
+ properties: {
42
+ tool_slug: {
43
+ type: "string",
44
+ description: "Canonical Muxo tool slug (e.g. 'instant.hackernews.top_stories' or 'resource.neon.launch')",
45
+ },
46
+ },
47
+ },
48
+ },
49
+ {
50
+ name: "connection_status",
51
+ description: "Check connection status across Composio OAuth apps, Instant wallet, and linked Stripe Projects cloud providers.",
52
+ inputSchema: {
53
+ type: "object",
54
+ properties: {
55
+ provider: {
56
+ type: "string",
57
+ description: "Optional provider filter (e.g. 'github', 'slack', 'neon', 'supabase')",
58
+ },
59
+ sync_live: {
60
+ type: "boolean",
61
+ default: true,
62
+ description: "Whether to sync live status from upstream Composio and Stripe Projects",
63
+ },
64
+ },
65
+ },
66
+ },
67
+ {
68
+ name: "start_connection",
69
+ description: "Initiate an OAuth connection for a Connected App (Composio) or link a cloud provider (Stripe Projects).",
70
+ inputSchema: {
71
+ type: "object",
72
+ required: ["provider"],
73
+ properties: {
74
+ provider: {
75
+ type: "string",
76
+ description: "Provider or toolkit slug (e.g. 'github', 'gmail', 'slack', 'neon')",
77
+ },
78
+ lane: {
79
+ type: "string",
80
+ enum: ["composio_sdk", "stripe_projects"],
81
+ description: "Provider lane (defaults to composio_sdk unless prefixed with resource.)",
82
+ },
83
+ callback_url: {
84
+ type: "string",
85
+ description: "Optional OAuth callback URL",
86
+ },
87
+ },
88
+ },
89
+ },
90
+ {
91
+ name: "wait_for_connection",
92
+ description: "Poll and wait for an external user's pending OAuth connection handoff to become active before resuming a planned operation.",
93
+ inputSchema: {
94
+ type: "object",
95
+ required: ["provider"],
96
+ properties: {
97
+ provider: {
98
+ type: "string",
99
+ description: "Provider or toolkit slug (e.g. 'github', 'gmail', 'slack', 'notion', 'linear')",
100
+ },
101
+ timeout_seconds: {
102
+ type: "number",
103
+ default: 15,
104
+ description: "Maximum seconds to poll for OAuth completion (0-120, default 15)",
105
+ },
106
+ },
107
+ },
108
+ },
109
+ {
110
+ name: "plan_action",
111
+ description: "Create a governed execution plan (plan_*) for any tool or infrastructure provisioning operation. Evaluates workspace policy, risk level, and credit balance.",
112
+ inputSchema: {
113
+ type: "object",
114
+ required: ["tool_slug"],
115
+ properties: {
116
+ tool_slug: { type: "string", description: "Muxo tool slug to plan" },
117
+ input: {
118
+ type: "object",
119
+ description: "Arguments matching the tool's inputSchema",
120
+ },
121
+ reason: {
122
+ type: "string",
123
+ description: "Audit reason explaining why this action is being planned",
124
+ },
125
+ },
126
+ },
127
+ },
128
+ {
129
+ name: "get_plan",
130
+ description: "Inspect the status, risk level, and approval state of a planned action.",
131
+ inputSchema: {
132
+ type: "object",
133
+ required: ["plan_id"],
134
+ properties: {
135
+ plan_id: { type: "string", description: "Plan ID (plan_*)" },
136
+ },
137
+ },
138
+ },
139
+ {
140
+ name: "get_run_context",
141
+ description: "Get the workspace runtime context, Supermemory v5 contextual brain (static/dynamic profile + hybrid search recall), Microsoft Agent Governance status, active provisioned Stripe Projects resources, and redacted environment variable keys.",
142
+ inputSchema: {
143
+ type: "object",
144
+ properties: {
145
+ query: {
146
+ type: "string",
147
+ description: "Optional semantic search query to recall relevant workspace memories from Supermemory v5",
148
+ },
149
+ },
150
+ },
151
+ },
152
+ {
153
+ name: "execute_read",
154
+ description: "Execute an approved plan with riskLevel = 'read'.",
155
+ inputSchema: {
156
+ type: "object",
157
+ required: ["plan_id"],
158
+ properties: {
159
+ plan_id: { type: "string", description: "Plan ID (plan_*)" },
160
+ },
161
+ },
162
+ },
163
+ {
164
+ name: "execute_write",
165
+ description: "Execute an approved plan with riskLevel = 'write'.",
166
+ inputSchema: {
167
+ type: "object",
168
+ required: ["plan_id"],
169
+ properties: {
170
+ plan_id: { type: "string", description: "Plan ID (plan_*)" },
171
+ },
172
+ },
173
+ },
174
+ {
175
+ name: "execute_admin",
176
+ description: "Execute an approved plan with riskLevel = 'admin'.",
177
+ inputSchema: {
178
+ type: "object",
179
+ required: ["plan_id"],
180
+ properties: {
181
+ plan_id: { type: "string", description: "Plan ID (plan_*)" },
182
+ },
183
+ },
184
+ },
185
+ {
186
+ name: "execute_financial",
187
+ description: "Execute an approved plan with riskLevel = 'financial'.",
188
+ inputSchema: {
189
+ type: "object",
190
+ required: ["plan_id"],
191
+ properties: {
192
+ plan_id: { type: "string", description: "Plan ID (plan_*)" },
193
+ },
194
+ },
195
+ },
196
+ {
197
+ name: "execute_provisioning",
198
+ description: "Execute an approved infrastructure provisioning plan with riskLevel = 'provisioning' via Stripe Projects.",
199
+ inputSchema: {
200
+ type: "object",
201
+ required: ["plan_id"],
202
+ properties: {
203
+ plan_id: { type: "string", description: "Plan ID (plan_*)" },
204
+ },
205
+ },
206
+ },
207
+ {
208
+ name: "execute_destructive",
209
+ description: "Execute an approved plan with riskLevel = 'destructive'.",
210
+ inputSchema: {
211
+ type: "object",
212
+ required: ["plan_id"],
213
+ properties: {
214
+ plan_id: { type: "string", description: "Plan ID (plan_*)" },
215
+ },
216
+ },
217
+ },
218
+ {
219
+ name: "get_run",
220
+ description: "Get the execution status, output, duration, and metered cost of a run (run_*).",
221
+ inputSchema: {
222
+ type: "object",
223
+ required: ["run_id"],
224
+ properties: {
225
+ run_id: { type: "string", description: "Run ID (run_*)" },
226
+ },
227
+ },
228
+ },
229
+ {
230
+ name: "cancel_run",
231
+ description: "Cancel an in-progress run and issue a cancellation receipt.",
232
+ inputSchema: {
233
+ type: "object",
234
+ required: ["run_id"],
235
+ properties: {
236
+ run_id: { type: "string", description: "Run ID (run_*)" },
237
+ },
238
+ },
239
+ },
240
+ {
241
+ name: "get_receipt",
242
+ description: "Fetch and cryptographically verify the HMAC-SHA256 chained execution receipt (rcpt_*) for a run.",
243
+ inputSchema: {
244
+ type: "object",
245
+ required: ["receipt_id"],
246
+ properties: {
247
+ receipt_id: {
248
+ type: "string",
249
+ description: "Receipt ID (rcpt_*) or Run ID (run_*)",
250
+ },
251
+ },
252
+ },
253
+ },
254
+ ];
255
+ export async function dispatchMcpToolCall(engine, ctx, toolName, args = {}) {
256
+ switch (toolName) {
257
+ case "get_profile":
258
+ return engine.getProfile(ctx);
259
+ case "get_organization":
260
+ return engine.getOrganization(ctx);
261
+ case "search_tools":
262
+ return engine.searchTools({
263
+ query: args.query ? String(args.query) : undefined,
264
+ lane: args.lane || "all",
265
+ riskLevel: args.risk_level,
266
+ limit: args.limit ? Number(args.limit) : 20,
267
+ });
268
+ case "inspect_tool":
269
+ return engine.inspectTool(String(args.tool_slug || args.slug || ""));
270
+ case "connection_status":
271
+ return engine.connectionStatus(ctx, {
272
+ provider: args.provider ? String(args.provider) : undefined,
273
+ syncLive: args.sync_live !== false,
274
+ });
275
+ case "start_connection":
276
+ return engine.startConnection(ctx, {
277
+ provider: String(args.provider || ""),
278
+ lane: args.lane,
279
+ callbackUrl: args.callback_url ? String(args.callback_url) : undefined,
280
+ });
281
+ case "wait_for_connection":
282
+ return engine.waitForConnection(ctx, {
283
+ provider: String(args.provider || ""),
284
+ timeoutSeconds: args.timeout_seconds !== undefined
285
+ ? Number(args.timeout_seconds)
286
+ : 15,
287
+ });
288
+ case "plan_action":
289
+ return engine.planAction(ctx, {
290
+ toolSlug: String(args.tool_slug || args.slug || ""),
291
+ input: args.input || {},
292
+ reason: args.reason ? String(args.reason) : undefined,
293
+ });
294
+ case "get_plan":
295
+ return engine.getPlan(ctx, String(args.plan_id || ""));
296
+ case "get_run_context":
297
+ return engine.getRunContext(ctx, args.query ? String(args.query) : undefined);
298
+ case "execute_read":
299
+ return engine.executePlanForRisk(ctx, String(args.plan_id || ""), "read");
300
+ case "execute_write":
301
+ return engine.executePlanForRisk(ctx, String(args.plan_id || ""), "write");
302
+ case "execute_admin":
303
+ return engine.executePlanForRisk(ctx, String(args.plan_id || ""), "admin");
304
+ case "execute_financial":
305
+ return engine.executePlanForRisk(ctx, String(args.plan_id || ""), "financial");
306
+ case "execute_provisioning":
307
+ return engine.executePlanForRisk(ctx, String(args.plan_id || ""), "provisioning");
308
+ case "execute_destructive":
309
+ return engine.executePlanForRisk(ctx, String(args.plan_id || ""), "destructive");
310
+ case "get_run":
311
+ return engine.getRun(ctx, String(args.run_id || ""));
312
+ case "cancel_run":
313
+ return engine.cancelRun(ctx, String(args.run_id || ""));
314
+ case "get_receipt":
315
+ return engine.getReceipt(ctx, String(args.receipt_id || args.run_id || ""));
316
+ default:
317
+ throw new Error(`Unknown MCP tool: ${toolName}`);
318
+ }
319
+ }
320
+ export async function handleJsonRpcMcpRequest(engine, ctx, rpc) {
321
+ const id = rpc.id ?? null;
322
+ const method = String(rpc.method || "");
323
+ const params = (rpc.params || {});
324
+ if (method === "notifications/initialized") {
325
+ return null;
326
+ }
327
+ try {
328
+ if (method === "initialize") {
329
+ return {
330
+ jsonrpc: "2.0",
331
+ id,
332
+ result: {
333
+ protocolVersion: "2024-11-05",
334
+ serverInfo: {
335
+ name: "muxo-mcp-server",
336
+ version: "1.0.0",
337
+ },
338
+ capabilities: {
339
+ tools: {},
340
+ },
341
+ },
342
+ };
343
+ }
344
+ if (method === "ping") {
345
+ return { jsonrpc: "2.0", id, result: {} };
346
+ }
347
+ if (method === "tools/list") {
348
+ return {
349
+ jsonrpc: "2.0",
350
+ id,
351
+ result: {
352
+ tools: MUXO_MCP_TOOLS,
353
+ },
354
+ };
355
+ }
356
+ if (method === "tools/call") {
357
+ const toolName = String(params.name || "");
358
+ const toolArgs = (params.arguments || {});
359
+ const output = await dispatchMcpToolCall(engine, ctx, toolName, toolArgs);
360
+ return {
361
+ jsonrpc: "2.0",
362
+ id,
363
+ result: {
364
+ content: [
365
+ {
366
+ type: "text",
367
+ text: JSON.stringify(output, null, 2),
368
+ },
369
+ ],
370
+ isError: false,
371
+ },
372
+ };
373
+ }
374
+ return {
375
+ jsonrpc: "2.0",
376
+ id,
377
+ error: {
378
+ code: -32601,
379
+ message: `Method not found: ${method}`,
380
+ },
381
+ };
382
+ }
383
+ catch (err) {
384
+ return {
385
+ jsonrpc: "2.0",
386
+ id,
387
+ result: {
388
+ content: [
389
+ {
390
+ type: "text",
391
+ text: JSON.stringify({
392
+ ok: false,
393
+ error: String(err?.message || err || "MCP tool execution failed"),
394
+ }, null, 2),
395
+ },
396
+ ],
397
+ isError: true,
398
+ },
399
+ };
400
+ }
401
+ }
@@ -0,0 +1,14 @@
1
+ import type { MuxoConfig } from "../config.js";
2
+ import type { MuxoTool } from "../types.js";
3
+ export declare class ComposioInstantAdapter {
4
+ private readonly config;
5
+ constructor(config: MuxoConfig);
6
+ getTools(): MuxoTool[];
7
+ searchTools(query?: string, limit?: number): MuxoTool[];
8
+ inspectTool(slug: string): MuxoTool | null;
9
+ executeTool(params: {
10
+ workspaceId: string;
11
+ tool: MuxoTool;
12
+ input: Record<string, unknown>;
13
+ }): Promise<Record<string, unknown>>;
14
+ }