@muxoai/sdk 1.3.0 → 1.4.2
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/.agents/plugins/marketplace.json +2 -2
- package/.claude-plugin/marketplace.json +19 -4
- package/.codex/config.toml +9 -2
- package/ARCHITECTURE.md +16 -6
- package/README.md +69 -24
- package/dist/clerk.d.ts +35 -0
- package/dist/clerk.js +201 -0
- package/dist/cli.js +1589 -103
- package/dist/composio-catalog.d.ts +234 -0
- package/dist/composio-catalog.js +1894 -0
- package/dist/config.d.ts +16 -0
- package/dist/config.js +27 -1
- package/dist/durable-workflow.d.ts +45 -0
- package/dist/durable-workflow.js +90 -0
- package/dist/engine.d.ts +315 -6
- package/dist/engine.js +1778 -94
- package/dist/mcp-schema.d.ts +286 -0
- package/dist/mcp-schema.js +2559 -0
- package/dist/mcp.d.ts +2 -25
- package/dist/mcp.js +949 -507
- package/dist/memory-graph.d.ts +21 -0
- package/dist/memory-graph.js +173 -0
- package/dist/nl.js +214 -35
- package/dist/oauth.d.ts +32 -0
- package/dist/oauth.js +134 -0
- package/dist/policy.d.ts +190 -0
- package/dist/policy.js +1597 -0
- package/dist/providers/composio-instant.d.ts +4 -0
- package/dist/providers/composio-instant.js +890 -535
- package/dist/providers/composio-sdk.d.ts +126 -5
- package/dist/providers/composio-sdk.js +902 -79
- package/dist/providers/microsoft-governance.d.ts +89 -3
- package/dist/providers/microsoft-governance.js +673 -26
- package/dist/providers/stripe-billing.d.ts +42 -0
- package/dist/providers/stripe-billing.js +244 -5
- package/dist/providers/stripe-projects.d.ts +459 -4
- package/dist/providers/stripe-projects.js +2674 -122
- package/dist/providers/supermemory.d.ts +102 -6
- package/dist/providers/supermemory.js +609 -55
- package/dist/provisioning-managed.d.ts +50 -0
- package/dist/provisioning-managed.js +155 -0
- package/dist/sdk.d.ts +705 -7
- package/dist/sdk.js +488 -10
- package/dist/server.js +2646 -348
- package/dist/store.d.ts +138 -6
- package/dist/store.js +932 -58
- package/dist/types.d.ts +312 -4
- package/dist/ui/console-html.d.ts +62 -0
- package/dist/ui/console-html.js +3742 -2228
- package/dist/ui/design-tokens.d.ts +177 -0
- package/dist/ui/design-tokens.js +210 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/package.json +5 -4
- package/plugins/muxo/.app.json +1 -1
- package/plugins/muxo/.claude-plugin/plugin.json +3 -3
- package/plugins/muxo/.codex-plugin/plugin.json +19 -10
- package/plugins/muxo/.cursor-plugin/plugin.json +30 -0
- package/plugins/muxo/.mcp.json +1 -33
- package/plugins/muxo/assets/logo.png +0 -0
- package/plugins/muxo/hooks/session-start.sh +16 -4
- package/plugins/muxo/hooks/user-prompt-submit.sh +14 -1
- package/plugins/muxo/mcp.json +0 -10
- package/plugins/muxo/plugin.json +65 -8
- package/plugins/muxo/skills/muxo/SKILL.md +142 -14
- package/plugins/muxo/skills/muxo/agents/openai.yaml +12 -0
- package/plugins/muxo/skills/muxo/references/cli.md +9 -3
- package/plugins/muxo/skills/muxo/references/mcp.md +22 -10
- package/plugins/muxo/skills/muxo-activity-summary/SKILL.md +81 -0
- package/plugins/muxo/skills/setup/SKILL.md +17 -3
- package/plugins/muxo/skills/setup/agents/openai.yaml +12 -0
- package/src/catalogues/stripe-projects-catalog.json +140 -0
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"plugins": [
|
|
7
7
|
{
|
|
8
8
|
"name": "muxo",
|
|
9
|
-
"version": "1.2
|
|
10
|
-
"description": "Governed execution across 1,000+ Connected Apps, Instant Tools (search, scrape, crawl, SEO audit), Cloud Infrastructure provisioning,
|
|
9
|
+
"version": "1.4.2",
|
|
10
|
+
"description": "Governed execution across 1,000+ Connected Apps, Instant Tools (search, scrape, crawl, SEO audit), Cloud Infrastructure provisioning, Workspace Memory recall, and cryptographic execution receipts.",
|
|
11
11
|
"source": {
|
|
12
12
|
"source": "local",
|
|
13
13
|
"path": "./plugins/muxo"
|
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muxo",
|
|
3
|
+
"description": "Official Muxo plugin marketplace for governed execution across Connected Apps, Instant Tools, Cloud Infrastructure, and Workspace Memory.",
|
|
3
4
|
"owner": {
|
|
4
5
|
"name": "Muxo",
|
|
5
6
|
"email": "founders@muxo.ai",
|
|
6
7
|
"url": "https://muxo.ai"
|
|
7
8
|
},
|
|
9
|
+
"metadata": {
|
|
10
|
+
"description": "Official Muxo plugin marketplace for governed execution across Connected Apps, Instant Tools, Cloud Infrastructure, and Workspace Memory.",
|
|
11
|
+
"version": "1.4.2"
|
|
12
|
+
},
|
|
8
13
|
"plugins": [
|
|
9
14
|
{
|
|
10
15
|
"name": "muxo",
|
|
11
|
-
"source":
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
"source": {
|
|
17
|
+
"source": "npm",
|
|
18
|
+
"package": "@muxoai/cli"
|
|
19
|
+
},
|
|
20
|
+
"strict": false,
|
|
21
|
+
"description": "Governed execution across 1,000+ Connected Apps, Instant Tools (search, scrape, crawl, SEO audit), Cloud Infrastructure provisioning, Workspace Memory recall, and verifiable audit records.",
|
|
22
|
+
"version": "1.4.2",
|
|
23
|
+
"category": "Productivity",
|
|
24
|
+
"skills": [
|
|
25
|
+
"./plugins/muxo/skills/muxo",
|
|
26
|
+
"./plugins/muxo/skills/setup"
|
|
27
|
+
],
|
|
28
|
+
"hooks": "./plugins/muxo/hooks/hooks.json",
|
|
29
|
+
"mcpServers": "./plugins/muxo/.mcp.json"
|
|
15
30
|
}
|
|
16
31
|
]
|
|
17
32
|
}
|
package/.codex/config.toml
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
# OpenAI Codex
|
|
2
|
-
# Reference: https://developers.openai.com/
|
|
1
|
+
# OpenAI Codex Configuration for Muxo
|
|
2
|
+
# Reference: https://developers.openai.com/codex/plugins
|
|
3
3
|
|
|
4
4
|
[plugins."muxo@muxo"]
|
|
5
5
|
enabled = true
|
|
6
|
+
|
|
7
|
+
# TOML MCP Alternative (~/.codex/config.toml):
|
|
8
|
+
[mcp_servers.muxo]
|
|
9
|
+
url = "https://api.muxo.ai/mcp"
|
|
10
|
+
# Or for local stdio proxy (requires Node.js 22+):
|
|
11
|
+
# command = "npx"
|
|
12
|
+
# args = ["-y", "@muxoai/cli@latest", "mcp"]
|
package/ARCHITECTURE.md
CHANGED
|
@@ -42,7 +42,7 @@ Across `muxoai` (gen 1) and `muxo2` (gen 2, 203,443 LOC), the biggest mistake wa
|
|
|
42
42
|
| :--- | :--- | :--- | :--- |
|
|
43
43
|
| **Composio SDK & Tool Router** (`backend.composio.dev/api/v3`) | **ADOPT (Core Lane)** | Provides 500+ managed OAuth integrations (`app.*`), user-scoped Connect Links, and schema discovery without Muxo maintaining custom OAuth apps for every SaaS provider. | Replaces custom per-provider OAuth brokers and bespoke SaaS connectors. |
|
|
44
44
|
| **Composio Instant & `agents.composio.dev` Pattern** | **ADOPT (Core Lane + Onboarding)** | 1) Zero-setup `instant.*` tools work immediately on workspace creation.<br>2) We adopt the **`agents.composio.dev` 2-call autonomous signup pattern** (`POST /api/v1/agents/signup` + `POST /api/v1/agents/claim`) so an agent can self-provision a Muxo workspace in one HTTP call and later hand ownership over to its human via a claim slug. | Replaces complex multi-step human-only bootstrap ceremonies for CLI/agent onboarding. |
|
|
45
|
-
| **Stripe
|
|
45
|
+
| **Stripe v2 Provisioning REST API & CLI** (`https://api.stripe.com/v2/provisioning/*`, `Stripe-Version: 2026-09-30.preview` + `stripe projects` v0.50.0) | **ADOPT (Core Lane — HTTP v2 + Node Runtime)** | Provisions real databases, caches, and cloud services (`neon/postgres`, `upstash/redis`, `turso`, `supabase`, `supermemory/memory`, etc.) directly over HTTP via `POST /v2/provisioning/resources` and reveals secrets via `POST /v2/provisioning/resources/:id/reveal_access_configuration` (with automatic CLI/managed fallback) into Muxo's AES-256-GCM vault. Works natively in both Node.js and Cloudflare Workers V8 isolates! | Replaces `muxo2`'s broken 4-worker Cloudflare Container + mTLS bridge (`projects-gateway` + `projects-executor`). See Section 3 below. |
|
|
46
46
|
| **Microsoft Agent Governance Toolkit** (`@microsoft/agent-governance-sdk` v5.0.0) | **ADOPT (Core Governance)** | A 40 KB, zero-dependency, MIT-licensed SDK providing `McpSecurityScanner` (prompt-injection & exfiltration detection), `PolicyEngine` (YAML/JSON rules + risk gates), `AgentIdentity` (Ed25519 DIDs), and `AuditLogger` (SHA-256 tamper-evident hash chain). | Replaces **~18,000 LOC** of custom authority seals, custom policy DSLs, and hand-rolled audit chains in `muxo2`. |
|
|
47
47
|
| **Supermemory v5** (`supermemory` `^5.0.1`) | **ADOPT (Fail-Open Contextual Brain)** | Gives every Muxo workspace an isolated `/ns/muxo-v5-{hash}` brain with automatic `static` + `dynamic` profiles (`client.profile`), sub-50ms hybrid search (`client.search`), and governed post-run memory (`client.add`). Also natively deployable via Stripe Projects (`supermemory/memory`)! | Replaces **~25,000 LOC** of `muxoai/packages/brain` + Python `context-engine` (Graphiti + Neo4j + Vectorize + D1). |
|
|
48
48
|
| **Mastra (`@mastra/mcp`), Pi (`pi`), Vercel AI SDK (`ai`), Google ADK** | **CLIENT ECOSYSTEM (Do Not Bundle Inside Server)** | These are **agent harnesses** that *consume* Muxo over `/mcp` and `/skill.md`. Bundling an agent framework inside the Muxo server violates "Existing-Agent First" and bloats the runtime. Instead, `app.muxo.ai` and `muxo mcp-config` generate instant copy-paste connectors for Mastra, Pi, Vercel AI SDK, Claude Code, Cursor, and Factory Droid. | Drops `muxoai/packages/harness` (`@cloudflare/think` + custom chat UI) from the core execution server. |
|
|
@@ -58,11 +58,21 @@ In `muxo2` (`projects-production-completion-plan.md`), the runtime was built on
|
|
|
58
58
|
1. `muxo2` tried to wrap the Stripe CLI inside a separate **Cloudflare Container (`apps/projects-executor`)** behind a second **Cloudflare Worker (`apps/projects-gateway`)** with custom CA fingerprint pinning, UID=0 root directory checks, and 55-second container cold-start budgets.
|
|
59
59
|
2. Inside the container, the `stripe-projects-cli` plugin was invoked directly without `PROJECTS_STANDALONE=1` or exceeded container memory/startup deadlines, resulting in `SIGKILL` and 9 consumed diagnostic attempts.
|
|
60
60
|
|
|
61
|
-
### Why It Works 100% Live in `muxo3`
|
|
62
|
-
In `muxo3` (`src/providers/stripe-projects.ts`):
|
|
63
|
-
1. **
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
### Why It Works 100% Live in `muxo3` (Native Stripe v2 Provisioning HTTP API + CLI)
|
|
62
|
+
In `muxo3` (`src/providers/stripe-projects.ts` and `worker/index.ts`), we integrate Stripe's gated **v2 Provisioning REST API** (`https://api.stripe.com/v2/provisioning/*` with header `Stripe-Version: 2026-09-30.preview`) alongside the local CLI:
|
|
63
|
+
1. **Direct Stripe v2 Provisioning HTTP REST Client (Zero Container Required, V8 Isolate Ready):** Both `StripeProjectsAdapter` (Node.js) and `worker/index.ts` (Cloudflare Workers) call Stripe's `/v2/provisioning/*` REST endpoints directly over HTTPS using `Authorization: Bearer <sk_live_...|rk_live_...>` and `Stripe-Version: 2026-09-30.preview`:
|
|
64
|
+
- **Eligibilities:** `GET /v2/provisioning/eligibility` (`v2.provisioning.eligibility`)
|
|
65
|
+
- **Catalog Providers:** `GET /v2/provisioning/catalog/providers` (`v2.provisioning.provider`)
|
|
66
|
+
- **Catalog Service Details:** `GET /v2/provisioning/catalog/services` (`v2.provisioning.provider_service_detail`)
|
|
67
|
+
- **Payment Profiles & Spend Limits:** `GET /v2/provisioning/payment_profile` & `POST /v2/provisioning/payment_profile/update_limit` (`v2.provisioning.payment_profile`)
|
|
68
|
+
- **Payment Method Requests:** `POST /v2/provisioning/payment_method_requests` (`v2.provisioning.payment_method_request`)
|
|
69
|
+
- **Projects:** `POST /v2/provisioning/projects` (`v2.provisioning.project`)
|
|
70
|
+
- **Provider Connections:** `GET /v2/provisioning/provider_connections` & `POST /v2/provisioning/provider_connections/:id/unlink` (`v2.provisioning.provider_connection`)
|
|
71
|
+
- **Provider Connection Requests:** `POST /v2/provisioning/provider_connection_requests`, `GET /v2/provisioning/provider_connection_requests/:id`, & `POST /v2/provisioning/provider_connection_requests/:id/submit_information` (`v2.provisioning.provider_connection_request`)
|
|
72
|
+
- **Resources:** `POST /v2/provisioning/resources`, `POST /v2/provisioning/resources/link`, `GET /v2/provisioning/resources/:id`, `POST /v2/provisioning/resources/:id`, `POST /v2/provisioning/resources/:id/remove`, `POST /v2/provisioning/resources/:id/unlink`, `POST /v2/provisioning/resources/:id/rotate_credentials`, & `POST /v2/provisioning/resources/:id/submit_information` (`v2.provisioning.resource`)
|
|
73
|
+
- **Access Configurations (Secret Reveal):** `POST /v2/provisioning/resources/:id/reveal_access_configuration` (`v2.provisioning.resource.access_configuration` returning `{ configuration: Record<string, string>, expires_at }`)
|
|
74
|
+
2. **Automatic Multi-Tier Fallback:** If the Stripe key does not yet have the `2026-09-30.preview` gate enabled, `StripeProjectsAdapter` transparently falls back to the local `stripe projects` CLI (when a `.projects` directory is present) or Muxo Cloud Managed Infrastructure.
|
|
75
|
+
3. **Encrypted Vault Custody:** Immediately after `POST /v2/provisioning/resources` and `POST /v2/provisioning/resources/:id/reveal_access_configuration` (or `stripe projects env --pull`), `StripeProjectsAdapter` encrypts the returned credentials with **AES-256-GCM** using a per-workspace HKDF-derived key in `MuxoStore` (`src/store.ts`), exposing them only via owner-authenticated `muxo env pull`, `GET /api/v1/resources/env`, or `POST /api/v1/provisioning/resources/:id/reveal_access_configuration`.
|
|
66
76
|
|
|
67
77
|
---
|
|
68
78
|
|
package/README.md
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
# Muxo (`@muxoai/platform` / `@muxoai/cli` / `@muxoai/sdk`)
|
|
2
2
|
|
|
3
|
-
Muxo (`v1.
|
|
3
|
+
Muxo (`v1.4.2`) is the unified execution, cloud infrastructure provisioning, contextual memory, and cryptographic governance platform for AI agents and applications. Customers and their agents interact exclusively with **Muxo** — either via structured tool slugs or free-form **Natural Language** (`muxo do`, `POST /api/v1/do`, `client.do()`, and MCP `plan_action`).
|
|
4
4
|
|
|
5
5
|
See [`ARCHITECTURE.md`](./ARCHITECTURE.md) for the complete internal engineering blueprint, open-source ecosystem Keep/Adopt/Drop matrix, and 4-pillar architecture.
|
|
6
6
|
|
|
7
7
|
Under the hood, Muxo unifies **four core pillars** plus **Natural Language Routing** and **BYOK (Bring Your Own Key) 0-Credit Execution** behind one **19-operation MCP contract**, OpenAI Plugin (`agent-plugins.org/1.0.0`), REST API, Interactive CLI/TUI (`@muxoai/cli`), TypeScript SDK (`@muxoai/sdk`), and Web Console (`https://app.muxo.ai`):
|
|
8
8
|
|
|
9
|
-
1. **
|
|
10
|
-
2. **
|
|
11
|
-
3. **
|
|
12
|
-
4. **
|
|
9
|
+
1. **Connected Apps (`app.*`) & Instant Tools (`instant.*`)** — Managed OAuth SaaS integrations (`app.github.*`, `app.gmail.*`, `app.slack.*`, `app.notion.*`, `app.linear.*`) with live browser OAuth handoff (`wait_for_connection`), zero-OAuth instant capabilities (`instant.web.search`, `instant.web.scrape`, `instant.web.crawl`, `instant.seo.audit`, `instant.hackernews.top_stories`, `instant.github.repo_intel`, `instant.dns.lookup`, `instant.composio.workbench`), plus **CLI-first Autonomous 2-Call Agent Signup & Claim** (`POST /api/v1/agents/signup` + `POST /api/v1/agents/claim`).
|
|
10
|
+
2. **Cloud Infrastructure (`resource.*`) + Unified Credit Billing (`muxo_funded`) & BYOK (`byok`)** — Governed cloud resource provisioning across 60+ providers (`Turso`, `Neon`, `Supabase`, `Cloudflare`, `Vercel`, `Upstash`, `Resend`, `Railway`, `Render`, etc.) with automatic companion plan resolution, AES-256-GCM encrypted secret custody (`muxo env pull`), unified credit settlement (`muxo_funded`), and **0-credit BYOK mode** (`muxo byok set <provider>`) when you bring your own supplier or LLM API keys.
|
|
11
|
+
3. **Workspace Memory (`/ns/muxo-v5-*`)** — Isolated per-workspace long-term static facts, dynamic session context, and hybrid semantic search recalled before every tool plan (`plan_action` & `get_run_context`), with strict secret redaction before memory ingestion.
|
|
12
|
+
4. **Safety & Approvals (Muxo Guardrails)** — Every planned and executed operation passes through prompt-injection security scanning, workspace policy evaluation, cryptographic agent identity (`did:agent:muxo:*`), and produces a verifiable execution audit record.
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
## Install & Quickstart (Humans, Harnesses & Agents)
|
|
17
17
|
|
|
18
|
+
> **Requirement:** `@muxoai/cli` requires **Node.js 22+** (`node >= 22.0.0`).
|
|
19
|
+
|
|
18
20
|
```bash
|
|
19
|
-
# 1. Install the Muxo CLI or run directly via npx
|
|
21
|
+
# 1. Install the Muxo CLI or run directly via npx (requires Node.js 22+)
|
|
20
22
|
npm install -g @muxoai/cli@latest
|
|
21
23
|
|
|
22
|
-
# 2.
|
|
24
|
+
# 2. CLI-first autonomous signup against the hosted workspace (creates ~/.muxo/config.json with mk_live_* key + 250 starter credits)
|
|
23
25
|
muxo login --signup --name "my-agent"
|
|
24
26
|
|
|
25
27
|
# 3. Launch the Interactive Terminal TUI (Natural Language bar, BYOK Vault, Billing & Status)
|
|
@@ -35,28 +37,71 @@ muxo byok set openai # Interactive hidden/line prompt if key omitted
|
|
|
35
37
|
muxo byok set composio # Executes app.* and instant.* tools at 0 Muxo credit cost
|
|
36
38
|
muxo byok list
|
|
37
39
|
|
|
38
|
-
# 6. Manage Billing, Credits & Starter
|
|
40
|
+
# 6. Manage Billing, Credits & Plans (Starter $29/mo, Pro $99/mo, yearly 2 months free)
|
|
39
41
|
muxo billing status
|
|
42
|
+
muxo billing plans
|
|
40
43
|
muxo billing topup 1000
|
|
41
|
-
muxo billing upgrade
|
|
44
|
+
muxo billing upgrade --plan pro --yearly
|
|
45
|
+
muxo billing portal
|
|
42
46
|
|
|
43
|
-
# 7. Connect an OAuth SaaS App & Provision Live Cloud Infrastructure
|
|
47
|
+
# 7. Connect an OAuth SaaS App (browser consent handoff) & Provision Live Cloud Infrastructure
|
|
44
48
|
muxo link gmail --wait
|
|
45
49
|
muxo provision turso --input '{"database_name":"my-agent-db"}' --approve
|
|
46
50
|
muxo env pull --out .env.muxo
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Official OpenAI Plugin & MCP Server (`https://api.muxo.ai/mcp`)
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
# 8. Check your setup, memory, and safety controls
|
|
53
|
+
muxo harness # API, MCP, auth, kill switch, audit chain, catalog (exit 1 on failure)
|
|
54
|
+
muxo memory facts # Facts with history; add --current for current facts only
|
|
55
|
+
muxo memory forget "old staging database" # Delete matching memories and retire their facts
|
|
56
|
+
muxo governance scan "text to check" # Prompt-injection check before storing or forwarding text
|
|
57
|
+
muxo governance pause "incident review" # Kill switch: stop all agent actions in the workspace
|
|
58
|
+
muxo governance resume
|
|
59
|
+
muxo governance policy --ring 2 --block-destructive-sql true --require-approval financial,destructive
|
|
60
|
+
```
|
|
61
|
+
## Official Plugins, Marketplaces & MCP Setup (`https://api.muxo.ai/mcp`)
|
|
62
|
+
|
|
63
|
+
Muxo ships a portable OpenAI Plugin (`plugins/muxo/plugin.json` & `plugins/muxo/mcp.json`), Claude Code Plugin (`plugins/muxo/.claude-plugin/plugin.json`), and Streamable HTTP MCP Server:
|
|
64
|
+
|
|
65
|
+
- **Streamable HTTP MCP Endpoints**: `https://api.muxo.ai/mcp` and `https://app.muxo.ai/mcp`
|
|
66
|
+
- **Local Stdio MCP Command** (requires Node.js 22+, proxies to hosted workspace): `npx -y @muxoai/cli@latest mcp`
|
|
67
|
+
- **Claude Code Marketplace (`muxo@muxo`)**:
|
|
68
|
+
```bash
|
|
69
|
+
claude plugin marketplace add https://api.muxo.ai/.claude-plugin/marketplace.json
|
|
70
|
+
claude plugin install muxo@muxo
|
|
71
|
+
```
|
|
72
|
+
- **OpenAI Codex Marketplace & TOML MCP Alternative**:
|
|
73
|
+
- **Marketplace (Git Repository or Local Directory)**: Add a Git repository or local directory containing `.agents/plugins/marketplace.json`, then enable `[plugins."muxo@muxo"]` in `.codex/config.toml`.
|
|
74
|
+
- **TOML MCP Alternative (`~/.codex/config.toml`)**:
|
|
75
|
+
```toml
|
|
76
|
+
[mcp_servers.muxo]
|
|
77
|
+
url = "https://api.muxo.ai/mcp"
|
|
78
|
+
```
|
|
79
|
+
Or for local stdio proxy (requires Node.js 22+):
|
|
80
|
+
```toml
|
|
81
|
+
[mcp_servers.muxo]
|
|
82
|
+
command = "npx"
|
|
83
|
+
args = ["-y", "@muxoai/cli@latest", "mcp"]
|
|
84
|
+
```
|
|
85
|
+
- **Claude Desktop**:
|
|
86
|
+
- **Hosted MCP (Custom Connectors)**: Open **Settings → Connectors → Add custom connector** and enter `https://api.muxo.ai/mcp`.
|
|
87
|
+
- **Local Stdio Server (`claude_desktop_config.json`, requires Node.js 22+)**:
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"mcpServers": {
|
|
91
|
+
"muxo": {
|
|
92
|
+
"command": "npx",
|
|
93
|
+
"args": ["-y", "@muxoai/cli@latest", "mcp"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
- **ChatGPT**:
|
|
99
|
+
- Open **Plugins → + → Add custom MCP server** (at `https://chatgpt.com/plugins`) and enter `https://api.muxo.ai/mcp`.
|
|
100
|
+
- **OAuth 2.1 Discovery (CIMD or DCR + PKCE)**:
|
|
101
|
+
- `https://api.muxo.ai/.well-known/oauth-protected-resource/mcp` (RFC 9728)
|
|
102
|
+
- `https://api.muxo.ai/.well-known/oauth-authorization-server` (RFC 8414)
|
|
103
|
+
- Client registration can use **Client ID Metadata Documents (CIMD)** or **Dynamic Client Registration (DCR)** (`POST https://api.muxo.ai/oauth/register`); `/oauth/register` is supported when a client uses DCR rather than running on every flow.
|
|
104
|
+
- `GET https://api.muxo.ai/oauth/authorize` & `POST https://api.muxo.ai/oauth/token` (PKCE `S256`)
|
|
60
105
|
- **SEP-2640 Skills Import Extension (`io.modelcontextprotocol/skills`)**: `skills/list`, `skills/get`, and `resources/read` serving `skill://muxo/muxo/SKILL.md` and `skill://muxo/setup/SKILL.md` with `sha256` integrity digests.
|
|
61
106
|
- **Tool Annotations & Multi-Account Profile**: All 19 tools include `title` and `annotations` (`readOnlyHint`, `destructiveHint`, `openWorldHint`), plus `_meta["openai/profile"]: true` on `get_profile` and Company Knowledge `search`/`fetch` compatibility.
|
|
62
107
|
|
|
@@ -71,8 +116,8 @@ Muxo ships a portable OpenAI Plugin (`plugins/muxo/plugin.json` & `plugins/muxo/
|
|
|
71
116
|
| `src/store.ts` | SQLite (`node:sqlite`) store, AES-256-GCM secret vault, credit/settlement ledger, memories, agent claims, and HMAC-SHA256 receipt chain |
|
|
72
117
|
| `src/providers/composio-sdk.ts` | Live Composio v3 Connected Apps adapter (catalog search, OAuth sessions/links, tool execution) |
|
|
73
118
|
| `src/providers/composio-instant.ts` | Live Composio Instant adapter (`search`, `scrape`, `crawl`, `seo.audit`, `hackernews`, `github.repo_intel`, `dns.lookup`, `workbench`) |
|
|
74
|
-
| `src/providers/stripe-projects.ts` | Live Stripe Projects CLI bridge (`
|
|
75
|
-
| `src/providers/stripe-billing.ts` | Live Stripe Checkout billing (`$29/mo
|
|
119
|
+
| `src/providers/stripe-projects.ts` | Live Stripe v2 Provisioning REST API (`2026-09-30.preview`) & Stripe Projects CLI bridge (`eligibility`, `catalog`, `payment_profile`, `provider_connections`, `resources`, `reveal_access_configuration`, `rotate`, `remove`, `env --pull`) |
|
|
120
|
+
| `src/providers/stripe-billing.ts` | Live Stripe Checkout billing (Starter `$29/mo`, Pro `$99/mo`, yearly billing & credit packs with volume discounts) |
|
|
76
121
|
| `src/providers/microsoft-governance.ts` | Microsoft Agent Governance Toolkit v5.0.0 (`McpSecurityScanner`, `PolicyEngine`, `AgentIdentity` Ed25519 DID, `AuditLogger`) |
|
|
77
122
|
| `src/providers/supermemory.ts` | Supermemory v5 Contextual Brain (`profile`, hybrid `search`, secret-redacted `add`, `delete`) |
|
|
78
123
|
| `src/engine.ts` | Unified Governance, Memory & Execution Engine implementing all 19 canonical MCP operations |
|
package/dist/clerk.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface ClerkConfig {
|
|
2
|
+
publishableKey: string;
|
|
3
|
+
frontendApi: string;
|
|
4
|
+
authorizedParties: string[];
|
|
5
|
+
jwtKey?: string;
|
|
6
|
+
secretKey?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ClerkSession {
|
|
9
|
+
userId: string;
|
|
10
|
+
sessionId: string;
|
|
11
|
+
email?: string;
|
|
12
|
+
emailVerified?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ClerkProfile {
|
|
15
|
+
email: string | null;
|
|
16
|
+
emailVerified: boolean;
|
|
17
|
+
name: string | null;
|
|
18
|
+
/** Every verified address on the account, lowercased, primary included. */
|
|
19
|
+
verifiedEmails: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface ClerkEnv {
|
|
22
|
+
CLERK_PUBLISHABLE_KEY?: string;
|
|
23
|
+
CLERK_SECRET_KEY?: string;
|
|
24
|
+
CLERK_JWT_KEY?: string;
|
|
25
|
+
CLERK_AUTHORIZED_PARTIES?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Derives the Clerk Frontend API origin encoded in a publishable key (pk_live_/pk_test_). */
|
|
28
|
+
export declare function clerkFrontendApi(publishableKey: string): string | null;
|
|
29
|
+
export declare function readClerkConfig(env: ClerkEnv, fallbackAuthorizedParty?: string): ClerkConfig | null;
|
|
30
|
+
export declare function looksLikeJwt(token: string): boolean;
|
|
31
|
+
/** Verifies a Clerk session JWT (RS256) and returns the session identity, or null if invalid. */
|
|
32
|
+
export declare function verifyClerkSessionToken(token: string, config: ClerkConfig, nowSeconds?: number): Promise<ClerkSession | null>;
|
|
33
|
+
/** Reads the primary email and name for a Clerk user through the Backend API. */
|
|
34
|
+
export declare function fetchClerkProfile(userId: string, secretKey: string): Promise<ClerkProfile | null>;
|
|
35
|
+
export declare function clerkBrowserScriptUrl(frontendApi: string): string;
|
package/dist/clerk.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
const RS256 = { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" };
|
|
2
|
+
const JWKS_TTL_MS = 10 * 60 * 1000;
|
|
3
|
+
const JWKS_RETRY_MS = 30 * 1000;
|
|
4
|
+
const CLOCK_SKEW_SECONDS = 5;
|
|
5
|
+
function base64UrlToBytes(input) {
|
|
6
|
+
const normalized = input.replace(/-/g, "+").replace(/_/g, "/");
|
|
7
|
+
const padded = normalized + "=".repeat((4 - (normalized.length % 4)) % 4);
|
|
8
|
+
const binary = atob(padded);
|
|
9
|
+
const bytes = new Uint8Array(new ArrayBuffer(binary.length));
|
|
10
|
+
for (let i = 0; i < binary.length; i++)
|
|
11
|
+
bytes[i] = binary.charCodeAt(i);
|
|
12
|
+
return bytes;
|
|
13
|
+
}
|
|
14
|
+
function decodeJsonSegment(segment) {
|
|
15
|
+
try {
|
|
16
|
+
const parsed = JSON.parse(new TextDecoder().decode(base64UrlToBytes(segment)));
|
|
17
|
+
return parsed && typeof parsed === "object" ? parsed : null;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Derives the Clerk Frontend API origin encoded in a publishable key (pk_live_/pk_test_). */
|
|
24
|
+
export function clerkFrontendApi(publishableKey) {
|
|
25
|
+
const match = /^pk_(?:live|test)_([A-Za-z0-9+/=_-]{4,512})$/.exec(publishableKey.trim());
|
|
26
|
+
if (!match)
|
|
27
|
+
return null;
|
|
28
|
+
let decoded;
|
|
29
|
+
try {
|
|
30
|
+
decoded = new TextDecoder().decode(base64UrlToBytes(match[1]));
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
if (!decoded.endsWith("$"))
|
|
36
|
+
return null;
|
|
37
|
+
const host = decoded.slice(0, -1);
|
|
38
|
+
if (!/^(?=.{4,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/i.test(host))
|
|
39
|
+
return null;
|
|
40
|
+
return `https://${host.toLowerCase()}`;
|
|
41
|
+
}
|
|
42
|
+
export function readClerkConfig(env, fallbackAuthorizedParty) {
|
|
43
|
+
const publishableKey = (env.CLERK_PUBLISHABLE_KEY || "").trim();
|
|
44
|
+
if (!publishableKey)
|
|
45
|
+
return null;
|
|
46
|
+
const frontendApi = clerkFrontendApi(publishableKey);
|
|
47
|
+
if (!frontendApi)
|
|
48
|
+
return null;
|
|
49
|
+
const configured = (env.CLERK_AUTHORIZED_PARTIES || "")
|
|
50
|
+
.split(",")
|
|
51
|
+
.map((s) => s.trim().replace(/\/+$/, ""))
|
|
52
|
+
.filter(Boolean);
|
|
53
|
+
const authorizedParties = configured.length
|
|
54
|
+
? configured
|
|
55
|
+
: fallbackAuthorizedParty
|
|
56
|
+
? [fallbackAuthorizedParty.replace(/\/+$/, "")]
|
|
57
|
+
: [];
|
|
58
|
+
return {
|
|
59
|
+
publishableKey,
|
|
60
|
+
frontendApi,
|
|
61
|
+
authorizedParties,
|
|
62
|
+
jwtKey: (env.CLERK_JWT_KEY || "").trim() || undefined,
|
|
63
|
+
secretKey: (env.CLERK_SECRET_KEY || "").trim() || undefined,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export function looksLikeJwt(token) {
|
|
67
|
+
return /^eyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(token);
|
|
68
|
+
}
|
|
69
|
+
async function importPemKey(pem) {
|
|
70
|
+
const body = pem
|
|
71
|
+
.replace(/\\n/g, "\n")
|
|
72
|
+
.replace(/-----BEGIN PUBLIC KEY-----/, "")
|
|
73
|
+
.replace(/-----END PUBLIC KEY-----/, "")
|
|
74
|
+
.replace(/\s+/g, "");
|
|
75
|
+
return crypto.subtle.importKey("spki", base64UrlToBytes(body), RS256, false, ["verify"]);
|
|
76
|
+
}
|
|
77
|
+
// Only public verification keys are cached; never tokens or user data.
|
|
78
|
+
const jwksCache = new Map();
|
|
79
|
+
const pemCache = new Map();
|
|
80
|
+
async function loadJwks(frontendApi) {
|
|
81
|
+
const res = await fetch(`${frontendApi}/.well-known/jwks.json`, {
|
|
82
|
+
headers: { Accept: "application/json" },
|
|
83
|
+
redirect: "manual",
|
|
84
|
+
});
|
|
85
|
+
if (res.status !== 200)
|
|
86
|
+
throw new Error(`Clerk JWKS unavailable (HTTP ${res.status})`);
|
|
87
|
+
const doc = (await res.json());
|
|
88
|
+
const keys = new Map();
|
|
89
|
+
for (const jwk of doc.keys || []) {
|
|
90
|
+
if (jwk.kty !== "RSA" || typeof jwk.kid !== "string")
|
|
91
|
+
continue;
|
|
92
|
+
if (jwk.use && jwk.use !== "sig")
|
|
93
|
+
continue;
|
|
94
|
+
const key = await crypto.subtle.importKey("jwk", { kty: "RSA", n: String(jwk.n), e: String(jwk.e), alg: "RS256", ext: true }, RS256, false, ["verify"]);
|
|
95
|
+
keys.set(jwk.kid, key);
|
|
96
|
+
}
|
|
97
|
+
return keys;
|
|
98
|
+
}
|
|
99
|
+
async function verificationKey(config, kid) {
|
|
100
|
+
if (config.jwtKey) {
|
|
101
|
+
let key = pemCache.get(config.jwtKey);
|
|
102
|
+
if (!key) {
|
|
103
|
+
key = await importPemKey(config.jwtKey);
|
|
104
|
+
pemCache.set(config.jwtKey, key);
|
|
105
|
+
}
|
|
106
|
+
return key;
|
|
107
|
+
}
|
|
108
|
+
if (!kid)
|
|
109
|
+
return null;
|
|
110
|
+
const now = Date.now();
|
|
111
|
+
const cached = jwksCache.get(config.frontendApi);
|
|
112
|
+
const fresh = cached && now - cached.fetchedAt < JWKS_TTL_MS;
|
|
113
|
+
if (cached?.keys.has(kid) && fresh)
|
|
114
|
+
return cached.keys.get(kid);
|
|
115
|
+
// Refetch for unknown kids (key rotation), but not more than once per retry window.
|
|
116
|
+
if (!cached || !fresh || now - cached.fetchedAt > JWKS_RETRY_MS) {
|
|
117
|
+
const keys = await loadJwks(config.frontendApi);
|
|
118
|
+
jwksCache.set(config.frontendApi, { keys, fetchedAt: now });
|
|
119
|
+
return keys.get(kid) || null;
|
|
120
|
+
}
|
|
121
|
+
return cached.keys.get(kid) || null;
|
|
122
|
+
}
|
|
123
|
+
/** Verifies a Clerk session JWT (RS256) and returns the session identity, or null if invalid. */
|
|
124
|
+
export async function verifyClerkSessionToken(token, config, nowSeconds = Math.floor(Date.now() / 1000)) {
|
|
125
|
+
if (!looksLikeJwt(token) || token.length > 16_384)
|
|
126
|
+
return null;
|
|
127
|
+
const [headerPart, payloadPart, signaturePart] = token.split(".");
|
|
128
|
+
const header = decodeJsonSegment(headerPart);
|
|
129
|
+
const payload = decodeJsonSegment(payloadPart);
|
|
130
|
+
if (!header || !payload || header.alg !== "RS256")
|
|
131
|
+
return null;
|
|
132
|
+
let key;
|
|
133
|
+
try {
|
|
134
|
+
key = await verificationKey(config, typeof header.kid === "string" ? header.kid : undefined);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
if (!key)
|
|
140
|
+
return null;
|
|
141
|
+
let valid = false;
|
|
142
|
+
try {
|
|
143
|
+
valid = await crypto.subtle.verify(RS256, key, base64UrlToBytes(signaturePart), new TextEncoder().encode(`${headerPart}.${payloadPart}`));
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
if (!valid)
|
|
149
|
+
return null;
|
|
150
|
+
if (payload.iss !== config.frontendApi)
|
|
151
|
+
return null;
|
|
152
|
+
if (typeof payload.exp !== "number" || payload.exp + CLOCK_SKEW_SECONDS < nowSeconds)
|
|
153
|
+
return null;
|
|
154
|
+
if (typeof payload.nbf === "number" && payload.nbf - CLOCK_SKEW_SECONDS > nowSeconds)
|
|
155
|
+
return null;
|
|
156
|
+
if (typeof payload.iat === "number" && payload.iat - CLOCK_SKEW_SECONDS > nowSeconds)
|
|
157
|
+
return null;
|
|
158
|
+
if (typeof payload.azp === "string" &&
|
|
159
|
+
config.authorizedParties.length > 0 &&
|
|
160
|
+
!config.authorizedParties.includes(payload.azp.replace(/\/+$/, ""))) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
if (payload.sts !== undefined && payload.sts !== "active")
|
|
164
|
+
return null;
|
|
165
|
+
if (typeof payload.sub !== "string" || !/^user_[A-Za-z0-9]{1,128}$/.test(payload.sub))
|
|
166
|
+
return null;
|
|
167
|
+
return {
|
|
168
|
+
userId: payload.sub,
|
|
169
|
+
sessionId: typeof payload.sid === "string" ? payload.sid : "",
|
|
170
|
+
email: typeof payload.email === "string" ? payload.email.toLowerCase() : undefined,
|
|
171
|
+
emailVerified: payload.email_verified === true,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/** Reads the primary email and name for a Clerk user through the Backend API. */
|
|
175
|
+
export async function fetchClerkProfile(userId, secretKey) {
|
|
176
|
+
try {
|
|
177
|
+
const res = await fetch(`https://api.clerk.com/v1/users/${encodeURIComponent(userId)}`, {
|
|
178
|
+
headers: { Authorization: `Bearer ${secretKey}`, Accept: "application/json" },
|
|
179
|
+
});
|
|
180
|
+
if (!res.ok)
|
|
181
|
+
return null;
|
|
182
|
+
const user = (await res.json());
|
|
183
|
+
const addresses = user.email_addresses || [];
|
|
184
|
+
const primary = addresses.find((e) => e.id === user.primary_email_address_id) || addresses[0];
|
|
185
|
+
const name = [user.first_name, user.last_name].filter(Boolean).join(" ").trim() || user.username || null;
|
|
186
|
+
return {
|
|
187
|
+
email: primary?.email_address ? primary.email_address.toLowerCase() : null,
|
|
188
|
+
emailVerified: primary?.verification?.status === "verified",
|
|
189
|
+
name,
|
|
190
|
+
verifiedEmails: addresses
|
|
191
|
+
.filter((e) => e.email_address && e.verification?.status === "verified")
|
|
192
|
+
.map((e) => e.email_address.toLowerCase()),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
export function clerkBrowserScriptUrl(frontendApi) {
|
|
200
|
+
return `${frontendApi}/npm/@clerk/clerk-js@5/dist/clerk.browser.js`;
|
|
201
|
+
}
|