@sapiom/mcp 0.7.2 → 0.8.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 ADDED
@@ -0,0 +1,103 @@
1
+ # @sapiom/mcp
2
+
3
+ The **local developer** MCP server for Sapiom. It runs on your machine over
4
+ stdio under the server name `sapiom-dev` — the unmetered `sapiom_dev_*` surface
5
+ for building and operating on Sapiom. Today it gives a coding agent the tools to
6
+ scaffold, test, deploy, and inspect Sapiom orchestrations; the namespace leaves
7
+ room for other non-capability developer tooling later.
8
+
9
+ > **Not the capability surface.** This is *not* the remote "Sapiom" MCP (the
10
+ > hosted connector with `sapiom_sandbox_*`, scrape, search, … capability tools).
11
+ > `sapiom-dev` is the local developer surface; it makes no paid capability calls
12
+ > and exposes no capability tools. See
13
+ > [the two Sapiom MCP servers](../../docs/mcp-servers.md) for which to use when.
14
+
15
+ ## Install
16
+
17
+ No global install — run it on demand with `npx`:
18
+
19
+ ```jsonc
20
+ {
21
+ "mcpServers": {
22
+ "sapiom-dev": {
23
+ "command": "npx",
24
+ "args": ["-y", "@sapiom/mcp"]
25
+ }
26
+ }
27
+ }
28
+ ```
29
+
30
+ In Claude Code:
31
+
32
+ ```sh
33
+ claude mcp add sapiom-dev -- npx -y @sapiom/mcp
34
+ ```
35
+
36
+ ## Configuration
37
+
38
+ The server targets the `production` environment by default. Override it with the
39
+ `SAPIOM_ENVIRONMENT` environment variable:
40
+
41
+ ```jsonc
42
+ {
43
+ "mcpServers": {
44
+ "sapiom-dev": {
45
+ "command": "npx",
46
+ "args": ["-y", "@sapiom/mcp"],
47
+ "env": { "SAPIOM_ENVIRONMENT": "staging" }
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ - `production` (alias `prod`) → `app.sapiom.ai` / `api.sapiom.ai` — the default.
54
+ - `staging` (alias `dev`) → `app.sapiom.dev` / `api.sapiom.dev`.
55
+
56
+ Both resolve from built-in presets, so no config file is required. A custom
57
+ target can be defined in `~/.sapiom/credentials.json` (the server prints the
58
+ expected shape if it encounters an unknown environment name).
59
+
60
+ ## Authentication
61
+
62
+ The first networked call (`link`, `deploy`, `run`, `inspect`, `signal`) needs a
63
+ Sapiom API key. Run **`sapiom_authenticate`** and the server opens a browser
64
+ login flow, then caches the resulting key per environment in
65
+ `~/.sapiom/credentials.json`. After that, tools work without re-authenticating.
66
+ `sapiom_status` reports who you're authenticated as; `sapiom_logout` clears the
67
+ cached credentials.
68
+
69
+ The local authoring tools (`scaffold`, `check`, `run_local`) need no
70
+ authentication — they run entirely offline.
71
+
72
+ ## Tools
73
+
74
+ | Tool | Network | What it does |
75
+ | --- | --- | --- |
76
+ | `sapiom_authenticate` | browser | Log in and cache an API key for the current environment |
77
+ | `sapiom_status` | — | Report authentication status |
78
+ | `sapiom_logout` | — | Clear cached credentials |
79
+ | `sapiom_dev_orchestrations_scaffold` | — | Create a new orchestration project |
80
+ | `sapiom_dev_orchestrations_check` | — | Bundle + validate the step graph offline |
81
+ | `sapiom_dev_orchestrations_run_local` | — | Run the workflow locally, resolving capability calls from stubs (no cost) |
82
+ | `sapiom_dev_orchestrations_link` | ✓ | Resolve/create the hosted orchestration and cache its id |
83
+ | `sapiom_dev_orchestrations_deploy` | ✓ | Push the current commit, build, and wait for it |
84
+ | `sapiom_dev_orchestrations_run` | ✓ | Start a real cloud execution |
85
+ | `sapiom_dev_orchestrations_inspect` | ✓ | Inspect an execution or build (optionally waiting for it) |
86
+ | `sapiom_dev_orchestrations_signal` | ✓ | Resume a paused execution by delivering a signal |
87
+
88
+ A typical loop: `scaffold` → write step code → `run_local` until green → `link`
89
+ → `deploy` → `run` → `inspect`.
90
+
91
+ ## How capabilities fit in
92
+
93
+ Workflows authored here call Sapiom capabilities — sandboxes, repositories,
94
+ coding agents, search, storage, content generation — through
95
+ [`@sapiom/tools`](../tools) (`ctx.sapiom.*`). `run_local` resolves those calls
96
+ from stubs; a real `run`/`deploy` executes them in the cloud (metered). This MCP
97
+ never grows a per-capability tool of its own — capabilities live in
98
+ `@sapiom/tools` and the remote `sapiom` MCP. See
99
+ [the positioning doc](../../docs/mcp-servers.md) for the full policy.
100
+
101
+ ## License
102
+
103
+ MIT
package/dist/index.js CHANGED
@@ -5,16 +5,33 @@ import { resolveEnvironment } from "./credentials.js";
5
5
  import { register as registerAuthenticate } from "./tools/authenticate.js";
6
6
  import { register as registerStatus } from "./tools/status.js";
7
7
  import { register as registerOrchestrations } from "./tools/orchestrations.js";
8
+ import { fetchInstructions } from "./instructions-fetch.js";
8
9
  async function main() {
9
10
  // Resolve environment: SAPIOM_ENVIRONMENT env var > file > "production"
10
11
  const env = await resolveEnvironment(process.env.SAPIOM_ENVIRONMENT);
11
12
  if (env.name !== "production") {
12
13
  console.error(`\u26a0 Using environment "${env.name}": app=${env.appURL} api=${env.apiURL}`);
13
14
  }
15
+ // Pull the latest authoring instructions from the backend (falls back to the
16
+ // bundled copy offline / on error), so guidance can change without a release.
17
+ const instructions = await fetchInstructions(env);
14
18
  const server = new McpServer({
15
- // The local dev surface — distinct from the remote Sapiom capabilities MCP.
19
+ // The local developer surface — distinct from the remote Sapiom
20
+ // capabilities MCP. This is the unmetered `sapiom_dev_*` namespace for
21
+ // building and operating on Sapiom (today: orchestration authoring &
22
+ // lifecycle; room for more dev tooling later). The `name` is the stable
23
+ // wire identifier; `title` and `description` are what MCP clients show, so
24
+ // they spell out which Sapiom this is to keep it from reading as a
25
+ // duplicate of the capability server.
16
26
  name: "sapiom-dev",
27
+ title: "Sapiom Dev — local developer tools",
28
+ description: "The local, unmetered Sapiom developer MCP (sapiom_dev_*). Today it scaffolds, tests, deploys, and inspects orchestrations. Not the remote Sapiom capability MCP — it makes no paid capability calls.",
17
29
  version: "0.1.0",
30
+ }, {
31
+ // Returned in the MCP `initialize` handshake; capable clients surface it to the
32
+ // model on connect, so an agent that adds this server gets the authoring primer
33
+ // automatically. Fetched from the backend; bundled fallback in ./instructions.ts.
34
+ instructions,
18
35
  });
19
36
  // Register all tools
20
37
  registerAuthenticate(server, env);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,QAAQ,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,QAAQ,IAAI,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE/E,KAAK,UAAU,IAAI;IACjB,wEAAwE;IACxE,MAAM,GAAG,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAErE,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,CACX,6BAA6B,GAAG,CAAC,IAAI,UAAU,GAAG,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,CAC9E,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,4EAA4E;QAC5E,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,qBAAqB;IACrB,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEpC,8BAA8B;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAA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E,mEAAmE;QACnE,sCAAsC;QACtC,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,oCAAoC;QAC3C,WAAW,EACT,sMAAsM;QACxM,OAAO,EAAE,OAAO;KACjB,EACD;QACE,gFAAgF;QAChF,gFAAgF;QAChF,kFAAkF;QAClF,YAAY;KACb,CACF,CAAC;IAEF,qBAAqB;IACrB,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEpC,8BAA8B;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;AAC1D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ResolvedEnvironment } from "./credentials.js";
2
+ /**
3
+ * Fetch the authoring instructions from the Sapiom backend
4
+ * (`GET {apiURL}/v1/mcp/instructions`, public / no auth), so the guidance a
5
+ * coding agent receives on connect can change without republishing this package.
6
+ *
7
+ * Falls back to the bundled {@link AUTHORING_INSTRUCTIONS} on any failure — a
8
+ * non-200, an empty body, a network error, or a timeout. Never throws: the MCP
9
+ * server must always start with usable instructions, online or off.
10
+ */
11
+ export declare function fetchInstructions(env: ResolvedEnvironment): Promise<string>;
12
+ //# sourceMappingURL=instructions-fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions-fetch.d.ts","sourceRoot":"","sources":["../src/instructions-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAM5D;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBjF"}
@@ -0,0 +1,33 @@
1
+ import { AUTHORING_INSTRUCTIONS } from "./instructions.js";
2
+ /** How long to wait for the instructions endpoint before falling back. */
3
+ const FETCH_TIMEOUT_MS = 5000;
4
+ /**
5
+ * Fetch the authoring instructions from the Sapiom backend
6
+ * (`GET {apiURL}/v1/mcp/instructions`, public / no auth), so the guidance a
7
+ * coding agent receives on connect can change without republishing this package.
8
+ *
9
+ * Falls back to the bundled {@link AUTHORING_INSTRUCTIONS} on any failure — a
10
+ * non-200, an empty body, a network error, or a timeout. Never throws: the MCP
11
+ * server must always start with usable instructions, online or off.
12
+ */
13
+ export async function fetchInstructions(env) {
14
+ const controller = new AbortController();
15
+ const timeout = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
16
+ try {
17
+ const response = await fetch(`${env.apiURL}/v1/mcp/instructions`, {
18
+ headers: { Accept: "text/markdown, text/plain" },
19
+ signal: controller.signal,
20
+ });
21
+ if (!response.ok)
22
+ return AUTHORING_INSTRUCTIONS;
23
+ const body = (await response.text()).trim();
24
+ return body.length > 0 ? body : AUTHORING_INSTRUCTIONS;
25
+ }
26
+ catch {
27
+ return AUTHORING_INSTRUCTIONS;
28
+ }
29
+ finally {
30
+ clearTimeout(timeout);
31
+ }
32
+ }
33
+ //# sourceMappingURL=instructions-fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions-fetch.js","sourceRoot":"","sources":["../src/instructions-fetch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,0EAA0E;AAC1E,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,GAAwB;IAC9D,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,gBAAgB,CAAC,CAAC;IACvE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,sBAAsB,EAAE;YAChE,OAAO,EAAE,EAAE,MAAM,EAAE,2BAA2B,EAAE;YAChD,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,OAAO,sBAAsB,CAAC;QAChD,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,sBAAsB,CAAC;IAChC,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The MCP server `instructions` string, returned during the `initialize` handshake.
3
+ * Capable MCP clients surface it to the model on connect, so an agent that adds this
4
+ * server gets a workflow-authoring primer without any extra setup.
5
+ *
6
+ * Kept intentionally short — it stays in the model's context for the whole session, and
7
+ * points to the full documentation and the `AGENTS.md` generated into each scaffolded
8
+ * project rather than restating them.
9
+ */
10
+ export declare const AUTHORING_INSTRUCTIONS = "# Sapiom dev MCP (sapiom-dev)\n\n`sapiom-dev` is Sapiom's local developer MCP \u2014 the terminal surface for setting up and managing\nyour Sapiom projects. Today it drives **workflow authoring** (more dev/management tools will land\nhere over time): these tools build, test, and deploy a Sapiom workflow \u2014 a\n`defineOrchestration({ name, entry, steps })` (from `@sapiom/orchestration`) where each step's\n`run(input, ctx)` does work and returns a directive. All from the terminal; no dashboard.\n\n## Two ways to use Sapiom\nThis server (`sapiom-dev`) is where you **author workflows** \u2014 the\n`sapiom_dev_orchestrations_*` tools build, test, and deploy them. For a **one-off capability call** without authoring a\nworkflow, use Sapiom's **remote MCP** at `https://api.sapiom.ai/v1/mcp`\n(`claude mcp add sapiom --transport http https://api.sapiom.ai/v1/mcp`) \u2014 it exposes every\ncapability as a direct `sapiom_*` tool (e.g. `sapiom_search`; run `tool_discover` to find the right one) \u2014 or call the gateway from code with the SDK\n(`@sapiom/fetch`). Rule of thumb: author a workflow for anything multi-step, scheduled, or\ndeployable; use the remote MCP or the SDK for a single action.\n\n## Lifecycle (in order)\n1. `sapiom_authenticate` \u2014 browser login; caches an API key (makes you an API-key principal,\n required for deploy/run). Confirm with `sapiom_status`.\n2. `sapiom_dev_orchestrations_scaffold` \u2014 writes a project. READ its `AGENTS.md` first; it is\n the full authoring guide, shipped inside every scaffold. Then `npm install`.\n3. Test for free: `npm run typecheck` \u2192 `sapiom_dev_orchestrations_check` (validates the step\n graph, offline) \u2192 `sapiom_dev_orchestrations_run_local` (capabilities are stubbed; zero spend).\n4. Ship: `sapiom_dev_orchestrations_link` \u2192 `_deploy` \u2192 `_run` (real, billed) \u2192 `_inspect`.\n\n## Canonical rules (types are the source of truth \u2014 run `npm run typecheck`)\n- Import `defineOrchestration`, `defineStep`, and the directives\n (`goto` / `terminate` / `fail` / `retry` / `pauseUntilSignal`) from `@sapiom/orchestration`.\n NEVER `defineWorkflow` or `@sapiom/workflow-sdk` (they do not exist). Import Zod from `zod/v4`.\n- `defineStep({ name, next, terminal?, canFail?, pause?, inputSchema?, run })`:\n `terminate()` requires `terminal: true`; `fail()` requires `canFail: true`;\n `pauseUntilSignal(handle, \u2026)` requires `pause: { signal, resumeStep }`; every `goto` target\n must be listed in `next[]`. TypeScript enforces all of these.\n- Cross-step state: `ctx.shared` \u2014 the entry input reaches only the entry step.\n- Capabilities run via `ctx.sapiom.*` (sandboxes, repositories, agent(+coding), orchestrations,\n fileStorage, contentGeneration.{images,video}, search, database) \u2014 a typed subset of the gateway\n catalog; use autocomplete/typecheck.\n\nFull reference: https://docs.sapiom.ai/workflows/quick-start (authoring \u00B7 capabilities \u00B7 reference \u00B7 examples)\nand the `AGENTS.md` inside your scaffolded project.";
11
+ //# sourceMappingURL=instructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,+/FAwCmB,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The MCP server `instructions` string, returned during the `initialize` handshake.
3
+ * Capable MCP clients surface it to the model on connect, so an agent that adds this
4
+ * server gets a workflow-authoring primer without any extra setup.
5
+ *
6
+ * Kept intentionally short — it stays in the model's context for the whole session, and
7
+ * points to the full documentation and the `AGENTS.md` generated into each scaffolded
8
+ * project rather than restating them.
9
+ */
10
+ export const AUTHORING_INSTRUCTIONS = `# Sapiom dev MCP (sapiom-dev)
11
+
12
+ \`sapiom-dev\` is Sapiom's local developer MCP — the terminal surface for setting up and managing
13
+ your Sapiom projects. Today it drives **workflow authoring** (more dev/management tools will land
14
+ here over time): these tools build, test, and deploy a Sapiom workflow — a
15
+ \`defineOrchestration({ name, entry, steps })\` (from \`@sapiom/orchestration\`) where each step's
16
+ \`run(input, ctx)\` does work and returns a directive. All from the terminal; no dashboard.
17
+
18
+ ## Two ways to use Sapiom
19
+ This server (\`sapiom-dev\`) is where you **author workflows** — the
20
+ \`sapiom_dev_orchestrations_*\` tools build, test, and deploy them. For a **one-off capability call** without authoring a
21
+ workflow, use Sapiom's **remote MCP** at \`https://api.sapiom.ai/v1/mcp\`
22
+ (\`claude mcp add sapiom --transport http https://api.sapiom.ai/v1/mcp\`) — it exposes every
23
+ capability as a direct \`sapiom_*\` tool (e.g. \`sapiom_search\`; run \`tool_discover\` to find the right one) — or call the gateway from code with the SDK
24
+ (\`@sapiom/fetch\`). Rule of thumb: author a workflow for anything multi-step, scheduled, or
25
+ deployable; use the remote MCP or the SDK for a single action.
26
+
27
+ ## Lifecycle (in order)
28
+ 1. \`sapiom_authenticate\` — browser login; caches an API key (makes you an API-key principal,
29
+ required for deploy/run). Confirm with \`sapiom_status\`.
30
+ 2. \`sapiom_dev_orchestrations_scaffold\` — writes a project. READ its \`AGENTS.md\` first; it is
31
+ the full authoring guide, shipped inside every scaffold. Then \`npm install\`.
32
+ 3. Test for free: \`npm run typecheck\` → \`sapiom_dev_orchestrations_check\` (validates the step
33
+ graph, offline) → \`sapiom_dev_orchestrations_run_local\` (capabilities are stubbed; zero spend).
34
+ 4. Ship: \`sapiom_dev_orchestrations_link\` → \`_deploy\` → \`_run\` (real, billed) → \`_inspect\`.
35
+
36
+ ## Canonical rules (types are the source of truth — run \`npm run typecheck\`)
37
+ - Import \`defineOrchestration\`, \`defineStep\`, and the directives
38
+ (\`goto\` / \`terminate\` / \`fail\` / \`retry\` / \`pauseUntilSignal\`) from \`@sapiom/orchestration\`.
39
+ NEVER \`defineWorkflow\` or \`@sapiom/workflow-sdk\` (they do not exist). Import Zod from \`zod/v4\`.
40
+ - \`defineStep({ name, next, terminal?, canFail?, pause?, inputSchema?, run })\`:
41
+ \`terminate()\` requires \`terminal: true\`; \`fail()\` requires \`canFail: true\`;
42
+ \`pauseUntilSignal(handle, …)\` requires \`pause: { signal, resumeStep }\`; every \`goto\` target
43
+ must be listed in \`next[]\`. TypeScript enforces all of these.
44
+ - Cross-step state: \`ctx.shared\` — the entry input reaches only the entry step.
45
+ - Capabilities run via \`ctx.sapiom.*\` (sandboxes, repositories, agent(+coding), orchestrations,
46
+ fileStorage, contentGeneration.{images,video}, search, database) — a typed subset of the gateway
47
+ catalog; use autocomplete/typecheck.
48
+
49
+ Full reference: https://docs.sapiom.ai/workflows/quick-start (authoring · capabilities · reference · examples)
50
+ and the \`AGENTS.md\` inside your scaffolded project.`;
51
+ //# sourceMappingURL=instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAwCgB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { readCredentials, writeCredentials, } from "../credentials.js";
2
2
  import { performBrowserAuth } from "../auth.js";
3
3
  export function register(server, env) {
4
- server.tool("sapiom_authenticate", "Authenticate with Sapiom by opening a browser login flow. Run this when other Sapiom tools report that authentication is required.", {}, async () => {
4
+ server.tool("sapiom_authenticate", "Authenticate this local Sapiom developer MCP (sapiom-dev) by opening a browser login flow. Run this when a networked orchestration tool (link/deploy/run/inspect/signal) reports that authentication is required.", {}, async () => {
5
5
  // Check if already authenticated
6
6
  const existing = await readCredentials(env.name);
7
7
  if (existing) {
@@ -1 +1 @@
1
- {"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/tools/authenticate.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,gBAAgB,GAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,UAAU,QAAQ,CAAC,MAAiB,EAAE,GAAwB;IAClE,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,oIAAoI,EACpI,EAAE,EACF,KAAK,IAAI,EAAE;QACT,iCAAiC;QACjC,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,4BAA4B,QAAQ,CAAC,gBAAgB,aAAa,QAAQ,CAAC,QAAQ,iDAAiD;qBAC3I;i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from "../credentials.js";
2
2
  export function register(server, env) {
3
- server.tool("sapiom_status", "Check Sapiom authentication status. Returns whether you're authenticated and which organization.", {}, async () => {
3
+ server.tool("sapiom_status", "Check authentication status for this local Sapiom developer MCP (sapiom-dev). Returns whether you're authenticated and which organization.", {}, async () => {
4
4
  const creds = await readCredentials(env.name);
5
5
  if (creds) {
6
6
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,gBAAgB,GAEjB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,UAAU,QAAQ,CAAC,MAAiB,EAAE,GAAwB;IAClE,MAAM,CAAC,IAAI,CACT,eAAe,EACf,kGAAkG,EAClG,EAAE,EACF,KAAK,IAAI,EAAE;QACT,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,KAAK,EAAE,CAAC;YACV,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,oBAAoB,KAAK,CAAC,gBAAgB,aAAa,KAAK,CAAC,QAAQ,GAAG;qBAC/E;iBACF;aACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,gEAAgE;iBACvE;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,eAAe,EACf,+EAA+E,EAC/E,EAAE,EACF,KAAK,IAAI,EAAE;QACT,MAAM,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEjC,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,gEAAgE;iBACvE;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,gBAAgB,GAEjB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,UAAU,QAAQ,CAAC,MAAiB,EAAE,GAAwB;IAClE,MAAM,CAAC,IAAI,CACT,eAAe,EACf,4IAA4I,EAC5I,EAAE,EACF,KAAK,IAAI,EAAE;QACT,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,KAAK,EAAE,CAAC;YACV,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,oBAAoB,KAAK,CAAC,gBAAgB,aAAa,KAAK,CAAC,QAAQ,GAAG;qBAC/E;iBACF;aACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,gEAAgE;iBACvE;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,eAAe,EACf,+EAA+E,EAC/E,EAAE,EACF,KAAK,IAAI,EAAE;QACT,MAAM,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEjC,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,gEAAgE;iBACvE;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sapiom/mcp",
3
- "version": "0.7.2",
4
- "description": "Sapiom MCP server for Claude Code browser-based authentication and API tools",
3
+ "version": "0.8.1",
4
+ "description": "Local Sapiom developer MCP server (sapiom-dev) — the unmetered surface for building and operating on Sapiom; today it scaffolds, tests, deploys, and inspects orchestrations. Not the remote Sapiom capability MCP.",
5
5
  "mcpName": "io.github.sapiom/mcp",
6
6
  "keywords": [
7
7
  "sapiom",
@@ -35,7 +35,7 @@
35
35
  "zod": "^3.25.0",
36
36
  "@sapiom/core": "0.5.0",
37
37
  "@sapiom/fetch": "0.5.0",
38
- "@sapiom/orchestration-core": "^0.4.0"
38
+ "@sapiom/orchestration-core": "^0.4.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^20.11.30",