@almyty/mcp-server 1.0.1 → 1.0.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/dist/auth.d.ts +1 -1
- package/dist/auth.js +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +22 -22
- package/package.json +1 -1
package/dist/auth.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Authentication helpers for the almyty MCP server.
|
|
3
3
|
*
|
|
4
4
|
* Supports:
|
|
5
|
-
* 1. Environment variable (
|
|
5
|
+
* 1. Environment variable (ALMYTY_TOKEN) — for CI/scripts
|
|
6
6
|
* 2. Stored credentials (~/.almyty/credentials.json) — for interactive use
|
|
7
7
|
* 3. Interactive login (npx @almyty/mcp-server login) — stores credentials
|
|
8
8
|
*/
|
package/dist/auth.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Authentication helpers for the almyty MCP server.
|
|
3
3
|
*
|
|
4
4
|
* Supports:
|
|
5
|
-
* 1. Environment variable (
|
|
5
|
+
* 1. Environment variable (ALMYTY_TOKEN) — for CI/scripts
|
|
6
6
|
* 2. Stored credentials (~/.almyty/credentials.json) — for interactive use
|
|
7
7
|
* 3. Interactive login (npx @almyty/mcp-server login) — stores credentials
|
|
8
8
|
*/
|
|
@@ -84,7 +84,7 @@ export async function login(baseUrl) {
|
|
|
84
84
|
});
|
|
85
85
|
console.error(`\nLogged in successfully as ${email}`);
|
|
86
86
|
console.error(`Credentials saved to ${CREDENTIALS_FILE}`);
|
|
87
|
-
console.error('\nYou can now use the MCP server without
|
|
87
|
+
console.error('\nYou can now use the MCP server without ALMYTY_TOKEN:');
|
|
88
88
|
console.error(' npx @almyty/mcp-server');
|
|
89
89
|
}
|
|
90
90
|
finally {
|
package/dist/index.d.ts
CHANGED
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
* - Google Gemini CLI (~/.gemini/settings.json)
|
|
26
26
|
*
|
|
27
27
|
* Environment variables:
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
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)
|
|
32
32
|
*/
|
|
33
33
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -25,43 +25,43 @@
|
|
|
25
25
|
* - Google Gemini CLI (~/.gemini/settings.json)
|
|
26
26
|
*
|
|
27
27
|
* Environment variables:
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
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)
|
|
32
32
|
*/
|
|
33
33
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
34
34
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
35
35
|
import { z } from 'zod';
|
|
36
36
|
import { loadCredentials } from './auth.js';
|
|
37
37
|
import { AlmytyProxy } from './proxy.js';
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
38
|
+
const ALMYTY_URL = process.env.ALMYTY_URL || 'https://api.almyty.com';
|
|
39
|
+
const ALMYTY_GATEWAY_ID = process.env.ALMYTY_GATEWAY_ID;
|
|
40
|
+
const ALMYTY_MODE = (process.env.ALMYTY_MODE || 'skill-first');
|
|
41
41
|
async function main() {
|
|
42
42
|
// Resolve token: env var > stored credentials
|
|
43
|
-
let token = process.env.
|
|
43
|
+
let token = process.env.ALMYTY_TOKEN;
|
|
44
44
|
if (!token) {
|
|
45
45
|
const creds = loadCredentials();
|
|
46
46
|
token = creds?.token;
|
|
47
47
|
}
|
|
48
48
|
if (!token) {
|
|
49
49
|
console.error('Error: No authentication token found.\n' +
|
|
50
|
-
'Set
|
|
50
|
+
'Set ALMYTY_TOKEN environment variable or run: npx @almyty/mcp-server login');
|
|
51
51
|
process.exit(1);
|
|
52
52
|
}
|
|
53
|
-
const proxy = new AlmytyProxy(
|
|
53
|
+
const proxy = new AlmytyProxy(ALMYTY_URL, token, ALMYTY_GATEWAY_ID);
|
|
54
54
|
// Fetch tools + skills from backend
|
|
55
55
|
const [tools, skills] = await Promise.all([
|
|
56
56
|
proxy.fetchTools(),
|
|
57
57
|
proxy.fetchSkills(),
|
|
58
58
|
]);
|
|
59
|
-
console.error(`almyty: ${tools.length} tools, ${skills.length} skills (mode: ${
|
|
59
|
+
console.error(`almyty: ${tools.length} tools, ${skills.length} skills (mode: ${ALMYTY_MODE})`);
|
|
60
60
|
const server = new McpServer({
|
|
61
61
|
name: 'almyty',
|
|
62
62
|
version: '1.0.0',
|
|
63
63
|
});
|
|
64
|
-
if (
|
|
64
|
+
if (ALMYTY_MODE === 'skill-first') {
|
|
65
65
|
// =====================================================
|
|
66
66
|
// SKILL-FIRST MODE (default) — minimal token overhead
|
|
67
67
|
// =====================================================
|
|
@@ -176,8 +176,8 @@ async function main() {
|
|
|
176
176
|
const lines = [
|
|
177
177
|
'# almyty API Tools',
|
|
178
178
|
'',
|
|
179
|
-
`Connected to: ${
|
|
180
|
-
|
|
179
|
+
`Connected to: ${ALMYTY_URL}`,
|
|
180
|
+
ALMYTY_GATEWAY_ID ? `Gateway: ${ALMYTY_GATEWAY_ID}` : '',
|
|
181
181
|
'',
|
|
182
182
|
`## ${tools.length} tools available`,
|
|
183
183
|
'',
|
|
@@ -202,9 +202,9 @@ async function main() {
|
|
|
202
202
|
uri: uri.href,
|
|
203
203
|
mimeType: 'application/json',
|
|
204
204
|
text: JSON.stringify({
|
|
205
|
-
server:
|
|
206
|
-
gatewayId:
|
|
207
|
-
mode:
|
|
205
|
+
server: ALMYTY_URL,
|
|
206
|
+
gatewayId: ALMYTY_GATEWAY_ID || 'all',
|
|
207
|
+
mode: ALMYTY_MODE,
|
|
208
208
|
tools: tools.length,
|
|
209
209
|
skills: skills.length,
|
|
210
210
|
}, null, 2),
|
|
@@ -218,7 +218,7 @@ async function main() {
|
|
|
218
218
|
const subcommand = process.argv[2];
|
|
219
219
|
if (subcommand === 'login') {
|
|
220
220
|
const { login } = await import('./auth.js');
|
|
221
|
-
await login(
|
|
221
|
+
await login(ALMYTY_URL);
|
|
222
222
|
}
|
|
223
223
|
else if (subcommand === 'logout') {
|
|
224
224
|
const { logout } = await import('./auth.js');
|
|
@@ -243,10 +243,10 @@ Usage:
|
|
|
243
243
|
npx @almyty/mcp-server logout Clear credentials
|
|
244
244
|
|
|
245
245
|
Environment:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
ALMYTY_URL Base URL (default: https://api.almyty.com)
|
|
247
|
+
ALMYTY_TOKEN JWT Bearer token
|
|
248
|
+
ALMYTY_GATEWAY_ID Scope to specific gateway
|
|
249
|
+
ALMYTY_MODE "skill-first" (default) | "full" (all tools individually)
|
|
250
250
|
|
|
251
251
|
Modes:
|
|
252
252
|
skill-first 2 tools (almyty_execute + almyty_search) + skills as prompts
|
package/package.json
CHANGED