@almyty/mcp-server 1.3.0 → 1.5.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 CHANGED
@@ -63,13 +63,13 @@ assistant:
63
63
  | `almyty_invoke_agent` | `almyty_list_providers` |
64
64
  | `almyty_add_provider` | |
65
65
 
66
- `almyty_add_provider` takes a **connection id**, never an API key. A key
66
+ `almyty_add_provider` takes a **credential id**, never an API key. A key
67
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:
68
+ the host editor's logs, so the key goes through `@almyty/credentials` instead:
69
69
 
70
70
  ```bash
71
- npx @almyty/connections connect openai
72
- npx @almyty/connections list # -> the id to hand the tool
71
+ npx @almyty/credentials add openai
72
+ npx @almyty/credentials list # -> the id to hand the tool
73
73
  ```
74
74
 
75
75
  ## When almyty is not reachable
package/dist/catalog.js CHANGED
@@ -90,7 +90,7 @@ export function sanitizePromptName(name) {
90
90
  return name
91
91
  .replace(/[^a-zA-Z0-9_-]/g, '_')
92
92
  .replace(/_{2,}/g, '_')
93
- .replace(/^_+|_+$/g, '') || 'skill';
93
+ .replace(/^_+|(?<!_)_+$/g, '') || 'skill';
94
94
  }
95
95
  /**
96
96
  * Prompt names must be unique, and two different skill names can sanitize to
package/dist/index.js CHANGED
@@ -134,15 +134,17 @@ async function main() {
134
134
  },
135
135
  {
136
136
  name: 'almyty_create_gateway',
137
- description: 'Create a gateway that exposes tools OR an agent over a protocol (MCP, A2A, UTCP, Skills). Use kind="tool" for a tool gateway or kind="agent" for an agent gateway.',
137
+ description: 'Share tools over one protocol: MCP, UTCP or Skills (one gateway each). An agent is put in front of people or other agents (web, chat apps, A2A) through an app, not here.',
138
138
  shape: {
139
139
  name: z.string().describe('Gateway name'),
140
- type: z.enum(['mcp', 'a2a', 'utcp', 'skills']).describe('Protocol type'),
140
+ type: z.enum(['mcp', 'utcp', 'skills']).default('mcp').describe('The one protocol this gateway serves'),
141
141
  endpoint: z.string().describe('URL slug for the gateway endpoint'),
142
- kind: z.enum(['tool', 'agent']).default('tool').describe('What the gateway exposes: tools or a single agent'),
143
- agentId: z.string().optional().describe('Agent ID (required when kind is "agent")'),
144
142
  },
145
- run: (args) => proxy.createGateway({ ...args, configuration: {} }),
143
+ run: (args) => proxy.createGateway({
144
+ ...args,
145
+ kind: 'tool',
146
+ configuration: args.type === 'mcp' ? { transport: 'http' } : args.type === 'utcp' ? { protocol: 'http' } : {},
147
+ }),
146
148
  },
147
149
  {
148
150
  name: 'almyty_assign_tool',
@@ -181,18 +183,18 @@ async function main() {
181
183
  },
182
184
  {
183
185
  name: 'almyty_list_providers',
184
- description: 'List the LLM providers configured in your organization, with the connection backing each one.',
186
+ description: 'List the LLM providers configured in your organization, with the credential backing each one.',
185
187
  shape: {},
186
188
  run: () => proxy.listProviders(),
187
189
  },
188
190
  {
189
191
  name: 'almyty_add_provider',
190
- description: 'Add an LLM provider backed by an existing connection. Connect the vendor account first with `npx @almyty/connections connect <vendor>` and pass the connection id here. ' +
192
+ description: 'Add an LLM provider backed by an existing credential. Add the vendor key first with `npx @almyty/credentials add <vendor>` and pass the credential id here. ' +
191
193
  'This tool deliberately does not take an API key: a key passed as a tool argument would be written into this conversation\'s transcript and the host editor\'s logs.',
192
194
  shape: {
193
195
  name: z.string().describe('Display name for the provider'),
194
196
  type: z.string().describe('Provider type (openai, anthropic, gemini, azure, bedrock, ...)'),
195
- credentialId: z.string().describe('Id of an existing connection, from `npx @almyty/connections list`'),
197
+ credentialId: z.string().describe('Id of an existing credential, from `npx @almyty/credentials list`'),
196
198
  },
197
199
  run: (args) => proxy.addProvider({ name: args.name, type: args.type, credentialId: args.credentialId, configuration: {} }),
198
200
  },
@@ -224,6 +226,32 @@ async function main() {
224
226
  }, null, 2),
225
227
  }],
226
228
  }));
229
+ // A compact index of everything available, as one prompt. Registered
230
+ // before connect: the SDK declares the prompts capability on the first
231
+ // prompt and refuses to after the transport is up, so a first prompt
232
+ // added after discovery killed the server with "Cannot register
233
+ // capabilities after connecting to transport". Its description gets
234
+ // the tool count once discovery has run.
235
+ let promptNames = [];
236
+ const overview = server.prompt('almyty-overview', 'Overview: the API tools available via almyty', async () => {
237
+ await catalog.ensureFresh();
238
+ const lines = [
239
+ '# almyty API tools',
240
+ '',
241
+ `Connected to: ${ALMYTY_URL}`,
242
+ ALMYTY_GATEWAY_ID ? `Gateway: ${ALMYTY_GATEWAY_ID}` : 'Gateway: all',
243
+ '',
244
+ ];
245
+ if (catalog.lastError && !catalog.discovered) {
246
+ lines.push(`Discovery failed: ${upstreamErrorText(new Error(catalog.lastError))}`, '');
247
+ }
248
+ lines.push(`## ${catalog.tools.length} tools available`, '', ...catalog.tools.map((t) => `- \`${t.name}\`: ${t.description || 'No description'}`), '');
249
+ if (catalog.skills.length > 0) {
250
+ lines.push(`## ${catalog.skills.length} skills (detailed usage guides)`, '', ...catalog.skills.map((s, i) => `- \`${promptNames[i]}\`: ${s.toolCount} tools`), '');
251
+ }
252
+ lines.push('## How to use', '', '1. Load a skill prompt to understand the workflow', '2. Call `almyty_execute` with `tool_name` and `parameters`', '3. Or use `almyty_search` to find the right tool first', '');
253
+ return { messages: [{ role: 'user', content: { type: 'text', text: lines.filter(Boolean).join('\n') } }] };
254
+ });
227
255
  // ── Connect, then discover ───────────────────────────────────────
228
256
  // This order is the point: the client gets its handshake even when the
229
257
  // backend is unreachable, so the editor shows a server that explains the
@@ -240,32 +268,13 @@ async function main() {
240
268
  log(`${catalog.tools.length} gateway tools, ${catalog.skills.length} skills`);
241
269
  }
242
270
  // Skills as prompts, loaded on demand rather than held in context.
243
- const promptNames = uniquePromptNames(catalog.skills.map((s) => s.name));
271
+ promptNames = uniquePromptNames(catalog.skills.map((s) => s.name));
272
+ overview.update({ description: `Overview: ${catalog.tools.length} API tools available via almyty` });
244
273
  catalog.skills.forEach((skill, i) => {
245
274
  server.prompt(promptNames[i], `How to use: ${skill.name} (${skill.toolCount} tools)`, async () => ({
246
275
  messages: [{ role: 'user', content: { type: 'text', text: skill.content } }],
247
276
  }));
248
277
  });
249
- // A compact index of everything available, as one prompt.
250
- server.prompt('almyty-overview', `Overview: ${catalog.tools.length} API tools available via almyty`, async () => {
251
- await catalog.ensureFresh();
252
- const lines = [
253
- '# almyty API tools',
254
- '',
255
- `Connected to: ${ALMYTY_URL}`,
256
- ALMYTY_GATEWAY_ID ? `Gateway: ${ALMYTY_GATEWAY_ID}` : 'Gateway: all',
257
- '',
258
- ];
259
- if (catalog.lastError && !catalog.discovered) {
260
- lines.push(`Discovery failed: ${upstreamErrorText(new Error(catalog.lastError))}`, '');
261
- }
262
- lines.push(`## ${catalog.tools.length} tools available`, '', ...catalog.tools.map((t) => `- \`${t.name}\`: ${t.description || 'No description'}`), '');
263
- if (catalog.skills.length > 0) {
264
- lines.push(`## ${catalog.skills.length} skills (detailed usage guides)`, '', ...catalog.skills.map((s, i) => `- \`${promptNames[i]}\`: ${s.toolCount} tools`), '');
265
- }
266
- lines.push('## How to use', '', '1. Load a skill prompt to understand the workflow', '2. Call `almyty_execute` with `tool_name` and `parameters`', '3. Or use `almyty_search` to find the right tool first', '');
267
- return { messages: [{ role: 'user', content: { type: 'text', text: lines.filter(Boolean).join('\n') } }] };
268
- });
269
278
  if (ALMYTY_MODE === 'full') {
270
279
  // Every gateway tool individually. The JSON Schema the gateway returns
271
280
  // is converted to the Zod shape the SDK wants; handing it the raw
@@ -337,9 +346,9 @@ Management tools (both modes), for building on almyty from your assistant:
337
346
  almyty_list_agents almyty_create_agent almyty_invoke_agent
338
347
  almyty_list_providers almyty_add_provider
339
348
 
340
- almyty_add_provider takes a connection id, never an API key: a key passed as
349
+ almyty_add_provider takes a credential id, never an API key: a key passed as
341
350
  a tool argument would land in the assistant's transcript and the editor's
342
- logs. Make the connection first with \`npx @almyty/connections connect <vendor>\`.
351
+ logs. Add the credential first with \`npx @almyty/credentials add <vendor>\`.
343
352
 
344
353
  Authentication:
345
354
  npx @almyty/auth login Browser-based login (one-time setup)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almyty/mcp-server",
3
- "version": "1.3.0",
3
+ "version": "1.5.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,7 +36,7 @@
36
36
  "author": "almyty",
37
37
  "license": "Apache-2.0",
38
38
  "dependencies": {
39
- "@almyty/client": "^1.2.0",
39
+ "@almyty/client": "^1.5.0",
40
40
  "@modelcontextprotocol/sdk": "^1.7.0",
41
41
  "zod": "^3.22.0"
42
42
  },