@almyty/mcp-server 1.2.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,23 +1,107 @@
1
1
  # @almyty/mcp-server
2
2
 
3
- MCP server that connects AI coding agents to almyty tools and skills.
3
+ An MCP server that connects any AI coding agent to your almyty tools, skills
4
+ and agents — over stdio, with two tools in context instead of twenty.
4
5
 
5
6
  ## Quick start
6
7
 
7
8
  ```bash
8
- $ npx @almyty/auth login
9
- $ npx @almyty/mcp-server
9
+ npx @almyty/auth login
10
+ claude mcp add almyty -- npx -y @almyty/mcp-server
10
11
  ```
11
12
 
13
+ Or scope it to one gateway:
14
+
15
+ ```bash
16
+ npx @almyty/mcp-server acme/petstore
17
+ ```
18
+
19
+ The positional argument is `orgSlug/gatewaySlug`; with none, the server serves
20
+ every gateway the token can see.
21
+
22
+ ## Why skill-first
23
+
24
+ A traditional MCP server puts every tool's JSON Schema in the model's context
25
+ on every turn. Twenty tools is roughly 4,000 tokens you pay for whether or not
26
+ the model uses one.
27
+
28
+ This server registers **two** tools instead, roughly 300 tokens, and serves
29
+ each skill as an MCP prompt the model loads only when it needs it:
30
+
31
+ | Tool | What it does |
32
+ |---|---|
33
+ | `almyty_execute` | Run any almyty tool by name, with a parameter object |
34
+ | `almyty_search` | Find tools by keyword, so the model discovers before it calls |
35
+
36
+ The model reads a skill to learn a workflow, then calls `almyty_execute`. The
37
+ `almyty-overview` prompt is a compact index of everything available.
38
+
39
+ `almyty_search` re-reads the tool index when what it holds has gone stale
40
+ (about a minute), so a tool you add in almyty is findable without restarting
41
+ your editor.
42
+
43
+ ## Modes
44
+
45
+ Set `ALMYTY_MODE`:
46
+
47
+ - **`skill-first`** (default) — the two tools above plus skills as prompts.
48
+ - **`full`** — every gateway tool registered individually, traditional MCP.
49
+ Higher context cost. The list is read once at startup, and the client is
50
+ notified when it arrives.
51
+
52
+ ## Management tools
53
+
54
+ Both modes also register eleven tools for building on almyty from your
55
+ assistant:
56
+
57
+ | Tool | |
58
+ |---|---|
59
+ | `almyty_list_apis` | `almyty_create_api` |
60
+ | `almyty_import_schema` | `almyty_list_gateways` |
61
+ | `almyty_create_gateway` | `almyty_assign_tool` |
62
+ | `almyty_list_agents` | `almyty_create_agent` |
63
+ | `almyty_invoke_agent` | `almyty_list_providers` |
64
+ | `almyty_add_provider` | |
65
+
66
+ `almyty_add_provider` takes a **connection id**, never an API key. A key
67
+ passed as a tool argument would be written into the assistant's transcript and
68
+ the host editor's logs, so the key goes through the connections flow instead:
69
+
70
+ ```bash
71
+ npx @almyty/connections connect openai
72
+ npx @almyty/connections list # -> the id to hand the tool
73
+ ```
74
+
75
+ ## When almyty is not reachable
76
+
77
+ The server connects its transport before it fetches anything, so the MCP
78
+ handshake always completes: an editor never sees the server die during
79
+ startup because the API was down or the token had gone stale. Discovery then
80
+ runs, and a failure is reported on the tool call that needed it, in words that
81
+ name the fix — `run npx @almyty/auth login` for a stale token, `check
82
+ ALMYTY_URL` for an unreachable host. The management tools keep working
83
+ throughout.
84
+
85
+ Every call is bounded: 15 seconds for discovery, 120 for a tool execution.
86
+ A hung backend fails the call rather than hanging your editor.
87
+
88
+ ## stdio discipline
89
+
90
+ stdout carries the MCP protocol and nothing else; every diagnostic goes to
91
+ stderr. One stray line on stdout corrupts the JSON-RPC stream and the host
92
+ loses the server with no useful error, so `--help` and `--version` are the
93
+ only things this binary ever writes to stdout, and it exits without starting a
94
+ server when you ask for either.
95
+
12
96
  ## Agent configuration
13
97
 
14
98
  ### Claude Code
15
99
 
16
100
  ```bash
17
- $ claude mcp add almyty -- npx -y @almyty/mcp-server
101
+ claude mcp add almyty -- npx -y @almyty/mcp-server
18
102
  ```
19
103
 
20
- ### Cursor / Windsurf (`.cursor/mcp.json` or `.windsurf/mcp.json`)
104
+ ### Cursor / Windsurf (`.cursor/mcp.json` or `~/.codeium/windsurf/mcp_config.json`)
21
105
 
22
106
  ```json
23
107
  {
@@ -64,32 +148,33 @@ args = ["-y", "@almyty/mcp-server"]
64
148
  }
65
149
  ```
66
150
 
67
- ## Modes
68
-
69
- - **Skill-first** (default): Exposes 2 tools (`almyty_execute` + `almyty_search`) and loads skills on demand. Keeps context small.
70
- - **Full**: Exposes all tools individually. Set `ALMYTY_MODE=full` to enable.
71
-
72
151
  ## Environment variables
73
152
 
74
153
  | Variable | Description |
75
154
  |----------|-------------|
76
155
  | `ALMYTY_URL` | API URL (default: `https://api.almyty.com`) |
77
- | `ALMYTY_TOKEN` | Auth token |
78
- | `ALMYTY_GATEWAY_ID` | Scope to a specific gateway |
79
- | `ALMYTY_MODE` | `skill` (default) or `full` |
156
+ | `ALMYTY_TOKEN` | Token; otherwise read from `~/.almyty/credentials.json` |
157
+ | `ALMYTY_GATEWAY_ID` | Gateway as `orgSlug/gatewaySlug` (alternative to the positional argument) |
158
+ | `ALMYTY_MODE` | `skill-first` (default) or `full` |
80
159
 
81
160
  ## Authentication
82
161
 
83
- Requires `npx @almyty/auth login` first. Reads credentials from `~/.almyty/credentials.json`.
162
+ Run `npx @almyty/auth login` once; credentials are read from
163
+ `~/.almyty/credentials.json`. `ALMYTY_TOKEN` overrides the file. The old
164
+ `mcp-server login` / `logout` / `whoami` subcommands now point at
165
+ `@almyty/auth` and exit non-zero.
84
166
 
85
167
  ## About almyty
86
168
 
87
- almyty is the full-stack platform for AI agents, agnostic by design: any LLM, any
88
- API turned into tools, served over MCP, A2A, UTCP, and Agent Skills. Open source,
169
+ almyty is the platform for AI agents, agnostic by design: any LLM, any API
170
+ turned into tools, served over MCP, A2A, UTCP and Agent Skills. Open source,
89
171
  no lock-in.
90
172
 
91
- - Website — https://almyty.com
92
- - Docs — https://docs.almyty.com
93
- - Source — https://github.com/almyty-inc/almyty
173
+ - Website: https://almyty.com
174
+ - Docs: https://docs.almyty.com
175
+ - Source: https://github.com/almyty-inc/almyty
176
+
177
+ This CLI is part of the `@almyty/*` suite (versioned together at 1.x) and
178
+ works with the almyty platform 0.1 and later.
94
179
 
95
180
  Apache-2.0 © Almyty Inc.
@@ -0,0 +1,90 @@
1
+ /**
2
+ * What this server knows about the upstream gateway, and when it last
3
+ * asked.
4
+ *
5
+ * Discovery used to happen once, before the transport was connected: a
6
+ * backend that was down or a token that had gone stale killed the process
7
+ * during the MCP handshake, so the host editor saw the server die rather
8
+ * than a server that could explain itself. And a gateway that gained or
9
+ * lost a tool stayed invisible until someone restarted the editor.
10
+ *
11
+ * So discovery lives here instead: it never throws, it remembers why it
12
+ * last failed, and it re-asks when what it holds has gone stale.
13
+ */
14
+ export interface ToolSummary {
15
+ name: string;
16
+ description?: string;
17
+ inputSchema?: Record<string, unknown>;
18
+ }
19
+ export interface SkillSummary {
20
+ name: string;
21
+ content: string;
22
+ toolCount: number;
23
+ }
24
+ /** The slice of the proxy the catalog needs, so a test can stand in for it. */
25
+ export interface DiscoverySource {
26
+ fetchTools(): Promise<ToolSummary[]>;
27
+ fetchSkills(): Promise<SkillSummary[]>;
28
+ }
29
+ export interface CatalogOptions {
30
+ /** How long a discovery result is trusted before it is re-asked. */
31
+ ttlMs?: number;
32
+ now?: () => number;
33
+ warn?: (msg: string) => void;
34
+ }
35
+ export declare class ToolCatalog {
36
+ private readonly source;
37
+ private toolList;
38
+ private skillList;
39
+ private fetchedAt;
40
+ private inFlight;
41
+ private failure;
42
+ private readonly ttlMs;
43
+ private readonly now;
44
+ private readonly warn;
45
+ constructor(source: DiscoverySource, options?: CatalogOptions);
46
+ get tools(): ToolSummary[];
47
+ get skills(): SkillSummary[];
48
+ /** Why the last discovery failed, or null when it worked. */
49
+ get lastError(): string | null;
50
+ /** True once discovery has succeeded at least once. */
51
+ get discovered(): boolean;
52
+ isStale(): boolean;
53
+ /**
54
+ * Ask the backend. Never throws: a failure is recorded and reported on the
55
+ * tool call that needed it, where the model can see it and say so, rather
56
+ * than as an exception nobody is waiting for.
57
+ *
58
+ * Concurrent callers share one request; a failure keeps whatever was
59
+ * already known, because a stale tool list is more use than none.
60
+ */
61
+ refresh(): Promise<void>;
62
+ /** Re-ask only when what we hold has aged out. */
63
+ ensureFresh(): Promise<void>;
64
+ /** Substring match over names and descriptions, the cheapest thing that works. */
65
+ search(query: string): ToolSummary[];
66
+ }
67
+ /**
68
+ * Sanitize a skill name into a valid MCP prompt identifier: anything outside
69
+ * [a-zA-Z0-9_-] (a slash from `petstore/pets`, say) becomes an underscore, so
70
+ * a real-world skill name cannot break the registration.
71
+ */
72
+ export declare function sanitizePromptName(name: string): string;
73
+ /**
74
+ * Prompt names must be unique, and two different skill names can sanitize to
75
+ * the same identifier (`petstore/pets` and `petstore-pets` both become
76
+ * `petstore_pets`). The second one gets a suffix rather than overwriting the
77
+ * first.
78
+ */
79
+ export declare function uniquePromptNames(skillNames: string[]): string[];
80
+ /**
81
+ * What to tell the model when a call to almyty failed.
82
+ *
83
+ * A raw `401 {"statusCode":401,...}` body in a tool result is the worst of
84
+ * both worlds: the model cannot act on it and the person reading the
85
+ * transcript does not learn that their login expired. Every one of these
86
+ * says what to do next.
87
+ */
88
+ export declare function upstreamErrorText(err: unknown): string;
89
+ /** The text `almyty_search` answers with. Separated out so it can be checked. */
90
+ export declare function searchResultText(query: string, matches: ToolSummary[], all: ToolSummary[], limit?: number): string;
@@ -0,0 +1,154 @@
1
+ /**
2
+ * What this server knows about the upstream gateway, and when it last
3
+ * asked.
4
+ *
5
+ * Discovery used to happen once, before the transport was connected: a
6
+ * backend that was down or a token that had gone stale killed the process
7
+ * during the MCP handshake, so the host editor saw the server die rather
8
+ * than a server that could explain itself. And a gateway that gained or
9
+ * lost a tool stayed invisible until someone restarted the editor.
10
+ *
11
+ * So discovery lives here instead: it never throws, it remembers why it
12
+ * last failed, and it re-asks when what it holds has gone stale.
13
+ */
14
+ const DEFAULT_TTL_MS = 60_000;
15
+ export class ToolCatalog {
16
+ source;
17
+ toolList = [];
18
+ skillList = [];
19
+ fetchedAt = 0;
20
+ inFlight = null;
21
+ failure = null;
22
+ ttlMs;
23
+ now;
24
+ warn;
25
+ constructor(source, options = {}) {
26
+ this.source = source;
27
+ this.ttlMs = options.ttlMs ?? DEFAULT_TTL_MS;
28
+ this.now = options.now ?? (() => Date.now());
29
+ // stdout carries the MCP protocol and nothing else, so every log line
30
+ // this process writes goes to stderr.
31
+ this.warn = options.warn ?? ((m) => process.stderr.write(`[almyty mcp-server] ${m}\n`));
32
+ }
33
+ get tools() { return this.toolList; }
34
+ get skills() { return this.skillList; }
35
+ /** Why the last discovery failed, or null when it worked. */
36
+ get lastError() { return this.failure; }
37
+ /** True once discovery has succeeded at least once. */
38
+ get discovered() { return this.fetchedAt > 0; }
39
+ isStale() {
40
+ return this.fetchedAt === 0 || this.now() - this.fetchedAt >= this.ttlMs;
41
+ }
42
+ /**
43
+ * Ask the backend. Never throws: a failure is recorded and reported on the
44
+ * tool call that needed it, where the model can see it and say so, rather
45
+ * than as an exception nobody is waiting for.
46
+ *
47
+ * Concurrent callers share one request; a failure keeps whatever was
48
+ * already known, because a stale tool list is more use than none.
49
+ */
50
+ async refresh() {
51
+ if (this.inFlight)
52
+ return this.inFlight;
53
+ this.inFlight = (async () => {
54
+ try {
55
+ const [tools, skills] = await Promise.all([this.source.fetchTools(), this.source.fetchSkills()]);
56
+ this.toolList = tools;
57
+ this.skillList = skills;
58
+ this.fetchedAt = this.now();
59
+ this.failure = null;
60
+ }
61
+ catch (err) {
62
+ this.failure = err?.message ? String(err.message) : String(err);
63
+ this.warn(`discovery failed: ${this.failure}`);
64
+ }
65
+ finally {
66
+ this.inFlight = null;
67
+ }
68
+ })();
69
+ return this.inFlight;
70
+ }
71
+ /** Re-ask only when what we hold has aged out. */
72
+ async ensureFresh() {
73
+ if (this.isStale())
74
+ await this.refresh();
75
+ }
76
+ /** Substring match over names and descriptions, the cheapest thing that works. */
77
+ search(query) {
78
+ const q = query.trim().toLowerCase();
79
+ if (!q)
80
+ return this.toolList;
81
+ return this.toolList.filter((t) => t.name.toLowerCase().includes(q) || (t.description ?? '').toLowerCase().includes(q));
82
+ }
83
+ }
84
+ /**
85
+ * Sanitize a skill name into a valid MCP prompt identifier: anything outside
86
+ * [a-zA-Z0-9_-] (a slash from `petstore/pets`, say) becomes an underscore, so
87
+ * a real-world skill name cannot break the registration.
88
+ */
89
+ export function sanitizePromptName(name) {
90
+ return name
91
+ .replace(/[^a-zA-Z0-9_-]/g, '_')
92
+ .replace(/_{2,}/g, '_')
93
+ .replace(/^_+|_+$/g, '') || 'skill';
94
+ }
95
+ /**
96
+ * Prompt names must be unique, and two different skill names can sanitize to
97
+ * the same identifier (`petstore/pets` and `petstore-pets` both become
98
+ * `petstore_pets`). The second one gets a suffix rather than overwriting the
99
+ * first.
100
+ */
101
+ export function uniquePromptNames(skillNames) {
102
+ const used = new Set();
103
+ return skillNames.map((name) => {
104
+ let candidate = `skill-${sanitizePromptName(name)}`;
105
+ if (used.has(candidate)) {
106
+ let suffix = 2;
107
+ while (used.has(`${candidate}-${suffix}`))
108
+ suffix++;
109
+ candidate = `${candidate}-${suffix}`;
110
+ }
111
+ used.add(candidate);
112
+ return candidate;
113
+ });
114
+ }
115
+ /**
116
+ * What to tell the model when a call to almyty failed.
117
+ *
118
+ * A raw `401 {"statusCode":401,...}` body in a tool result is the worst of
119
+ * both worlds: the model cannot act on it and the person reading the
120
+ * transcript does not learn that their login expired. Every one of these
121
+ * says what to do next.
122
+ */
123
+ export function upstreamErrorText(err) {
124
+ const message = err instanceof Error ? err.message : String(err);
125
+ if (/\b401\b|unauthor/i.test(message)) {
126
+ return `almyty rejected the credential (${message}). The token is missing or has expired: run \`npx @almyty/auth login\`, or set ALMYTY_TOKEN, then restart this MCP server.`;
127
+ }
128
+ if (/\b403\b|forbidden/i.test(message)) {
129
+ return `almyty refused the request (${message}). The token is valid but lacks permission for this gateway or organization.`;
130
+ }
131
+ if (/\b404\b/.test(message)) {
132
+ return `almyty has no such route or gateway (${message}). Check ALMYTY_GATEWAY_ID: it is "orgSlug/gatewaySlug".`;
133
+ }
134
+ if (/timed out/i.test(message)) {
135
+ return `${message}. almyty did not answer in time; the call was abandoned rather than left hanging.`;
136
+ }
137
+ if (/ECONNREFUSED|ENOTFOUND|EAI_AGAIN|fetch failed/i.test(message)) {
138
+ return `Could not reach almyty (${message}). Check ALMYTY_URL and the network.`;
139
+ }
140
+ return message;
141
+ }
142
+ /** The text `almyty_search` answers with. Separated out so it can be checked. */
143
+ export function searchResultText(query, matches, all, limit = 20) {
144
+ if (matches.length === 0) {
145
+ const sample = all.slice(0, 10).map((t) => t.name).join(', ');
146
+ const more = all.length > 10 ? ` ... and ${all.length - 10} more` : '';
147
+ return all.length === 0
148
+ ? `No tools are available. This gateway exposes none, or discovery has not succeeded — see the server's stderr.`
149
+ : `No tools found matching "${query}". Available tools: ${sample}${more}`;
150
+ }
151
+ const lines = matches.slice(0, limit).map((t) => `- **${t.name}**: ${t.description ?? ''}`).join('\n');
152
+ const truncated = matches.length > limit ? `\n(${matches.length - limit} more not shown; narrow the query)` : '';
153
+ return `Found ${matches.length} tools:\n${lines}${truncated}\n\nLoad the relevant skill prompt for detailed usage instructions, then call almyty_execute.`;
154
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Exit codes shared by every almyty CLI.
3
+ *
4
+ * Scripts need to tell "you are not logged in" apart from "the server
5
+ * fell over" without grepping stderr. Every almyty CLI uses this same
6
+ * table, so `npx @almyty/mcp-server acme/petstore || case $? in 3)
7
+ * almyty login;; esac` behaves the same whichever binary produced the
8
+ * code. This one used to exit 1 for a missing credential, which told a
9
+ * supervisor to restart a server that would never start.
10
+ *
11
+ * Kept as a copy rather than an import: these CLIs are published
12
+ * separately and this table is six numbers that must never drift, which
13
+ * a test in each package pins.
14
+ */
15
+ export declare const EXIT: {
16
+ /** Success. */
17
+ readonly OK: 0;
18
+ /** Unexpected failure (a thrown error with no better classification). */
19
+ readonly ERROR: 1;
20
+ /** Bad or missing arguments, or an unknown command. */
21
+ readonly USAGE: 2;
22
+ /** No stored credential, or the API rejected the one we had. */
23
+ readonly AUTH: 3;
24
+ /** The named gateway does not exist. */
25
+ readonly NOT_FOUND: 4;
26
+ /** The command ran; the operation it asked for failed. */
27
+ readonly FAILED: 5;
28
+ };
29
+ export type ExitCode = (typeof EXIT)[keyof typeof EXIT];
30
+ /** One line per code, for `--help` output and READMEs. */
31
+ export declare const EXIT_CODE_HELP: string;
32
+ /**
33
+ * Classify a startup failure into an exit code.
34
+ *
35
+ * The proxy turns a 401 into "Authentication failed" and everything else
36
+ * into "API error <status>", so the status is what there is to go on. A
37
+ * dead token discovered on the first call has to leave with the same code
38
+ * as no token at all, or a supervisor cannot tell a restart from a login.
39
+ */
40
+ export declare function exitCodeFor(err: unknown): ExitCode;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Exit codes shared by every almyty CLI.
3
+ *
4
+ * Scripts need to tell "you are not logged in" apart from "the server
5
+ * fell over" without grepping stderr. Every almyty CLI uses this same
6
+ * table, so `npx @almyty/mcp-server acme/petstore || case $? in 3)
7
+ * almyty login;; esac` behaves the same whichever binary produced the
8
+ * code. This one used to exit 1 for a missing credential, which told a
9
+ * supervisor to restart a server that would never start.
10
+ *
11
+ * Kept as a copy rather than an import: these CLIs are published
12
+ * separately and this table is six numbers that must never drift, which
13
+ * a test in each package pins.
14
+ */
15
+ export const EXIT = {
16
+ /** Success. */
17
+ OK: 0,
18
+ /** Unexpected failure (a thrown error with no better classification). */
19
+ ERROR: 1,
20
+ /** Bad or missing arguments, or an unknown command. */
21
+ USAGE: 2,
22
+ /** No stored credential, or the API rejected the one we had. */
23
+ AUTH: 3,
24
+ /** The named gateway does not exist. */
25
+ NOT_FOUND: 4,
26
+ /** The command ran; the operation it asked for failed. */
27
+ FAILED: 5,
28
+ };
29
+ /** One line per code, for `--help` output and READMEs. */
30
+ export const EXIT_CODE_HELP = [
31
+ ' 0 success',
32
+ ' 1 unexpected error',
33
+ ' 2 usage error (bad flags, unknown command)',
34
+ ' 3 not authenticated — run `npx @almyty/auth login`',
35
+ ' 4 not found (no such gateway)',
36
+ ' 5 the operation ran and failed',
37
+ ].join('\n');
38
+ /**
39
+ * Classify a startup failure into an exit code.
40
+ *
41
+ * The proxy turns a 401 into "Authentication failed" and everything else
42
+ * into "API error <status>", so the status is what there is to go on. A
43
+ * dead token discovered on the first call has to leave with the same code
44
+ * as no token at all, or a supervisor cannot tell a restart from a login.
45
+ */
46
+ export function exitCodeFor(err) {
47
+ const message = err instanceof Error ? err.message : String(err);
48
+ if (/Authentication failed|\b401\b|\b403\b/.test(message))
49
+ return EXIT.AUTH;
50
+ if (/\b404\b/.test(message))
51
+ return EXIT.NOT_FOUND;
52
+ return EXIT.ERROR;
53
+ }
package/dist/index.d.ts CHANGED
@@ -1,33 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @almyty/mcp-server — Skill-first API proxy for any LLM
3
+ * @almyty/mcp-server — skill-first API proxy for any MCP client
4
4
  *
5
- * Instead of dumping N tool schemas into context (N * ~200 tokens each),
6
- * this injects:
7
- * 1. Skills (compact markdown prompts) — the LLM's knowledge layer
8
- * 2. ONE universal executor tool — handles all API calls
9
- * 3. ONE search tool — finds the right skill/tool on demand
5
+ * Instead of putting N tool schemas in context (N * ~200 tokens each), this
6
+ * registers:
7
+ * 1. skills (compact markdown prompts) loaded on demand,
8
+ * 2. one universal executor, `almyty_execute`,
9
+ * 3. one search tool, `almyty_search`.
10
10
  *
11
- * Token comparison:
12
- * Traditional MCP: 20 tools = ~4,000 tokens always in context
13
- * Skill-first: 2 tools + skills on-demand = ~300 tokens base
11
+ * The model reads a skill to learn a workflow, then calls almyty_execute with
12
+ * a tool name and parameters.
14
13
  *
15
- * The LLM reads a skill to understand a workflow, then calls almyty_execute
16
- * with the tool name and parameters. Skills are loaded on demand via
17
- * MCP prompts — only when the LLM actually needs them.
14
+ * Two rules this file lives by:
18
15
  *
19
- * Works with every major AI coding assistant:
20
- * - Claude Code (.mcp.json / .claude/skills/)
21
- * - Cursor (.cursor/mcp.json)
22
- * - Windsurf (~/.codeium/windsurf/mcp_config.json)
23
- * - OpenAI Codex CLI (~/.codex/config.toml)
24
- * - GitHub Copilot (.vscode/mcp.json)
25
- * - Google Gemini CLI (~/.gemini/settings.json)
16
+ * **stdout is the protocol.** Every diagnostic goes to stderr; one stray
17
+ * console.log on stdout corrupts the JSON-RPC stream and the host editor
18
+ * loses the server with no useful error.
26
19
  *
27
- * Environment variables:
28
- * ALMYTY_URL - Base URL of the almyty backend (default: https://api.almyty.com)
29
- * ALMYTY_TOKEN - JWT Bearer token for authentication
30
- * ALMYTY_GATEWAY_ID - Optional: scope to a specific gateway
31
- * ALMYTY_MODE - "skill-first" (default) | "full" (registers all tools individually)
20
+ * **The transport connects before anything is fetched.** Discovery used to
21
+ * run first, so a backend that was down or a stale token killed the process
22
+ * during the handshake. Now the handshake always succeeds and a discovery
23
+ * failure is reported on the tool call that needed it.
32
24
  */
33
25
  export {};