@almyty/mcp-server 1.0.0 → 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/README.md +48 -79
- 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/README.md
CHANGED
|
@@ -1,54 +1,14 @@
|
|
|
1
1
|
# @almyty/mcp-server
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## The Problem with Traditional MCP
|
|
6
|
-
|
|
7
|
-
MCP dumps every tool's full JSON Schema into the LLM's context window:
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
20 tools × ~200 tokens/schema = ~4,000 tokens/turn (always in context)
|
|
11
|
-
400 tools = 80,000+ tokens (unusable)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## The Skill-First Solution
|
|
15
|
-
|
|
16
|
-
Instead of N tool schemas, inject:
|
|
17
|
-
1. **2 tools** (`almyty_execute` + `almyty_search`) = ~300 tokens base
|
|
18
|
-
2. **Skills as prompts** = loaded on-demand, only when needed
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
Token overhead: ~300 tokens (fixed) vs ~4,000+ tokens (scales with tool count)
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Skills are compact markdown that teach the LLM **workflows** — when to use a tool, what parameters to collect, how to handle errors. The LLM loads a skill on demand, then calls `almyty_execute` with the right tool name.
|
|
25
|
-
|
|
26
|
-
## How It Works
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
LLM wants to "create a pet"
|
|
30
|
-
↓
|
|
31
|
-
1. Calls almyty_search("pet") → finds relevant tools
|
|
32
|
-
2. Loads skill-petstore prompt → learns the workflow
|
|
33
|
-
3. Calls almyty_execute(tool_name="addPet", parameters={...})
|
|
34
|
-
↓
|
|
35
|
-
almyty backend executes against the actual API
|
|
36
|
-
```
|
|
3
|
+
Local MCP server that connects your AI coding agent to [almyty](https://almyty.com) tools and skills.
|
|
37
4
|
|
|
38
5
|
## Quick Start
|
|
39
6
|
|
|
40
7
|
```bash
|
|
41
|
-
export APIFAI_URL=http://localhost:4000
|
|
42
|
-
export APIFAI_TOKEN=your-jwt-token
|
|
43
8
|
npx @almyty/mcp-server
|
|
44
9
|
```
|
|
45
10
|
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npx @almyty/mcp-server login
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Configuration
|
|
11
|
+
## Setup
|
|
52
12
|
|
|
53
13
|
### Claude Code
|
|
54
14
|
|
|
@@ -56,15 +16,40 @@ npx @almyty/mcp-server login
|
|
|
56
16
|
claude mcp add almyty -- npx -y @almyty/mcp-server
|
|
57
17
|
```
|
|
58
18
|
|
|
59
|
-
### Cursor (`.cursor/mcp.json`)
|
|
19
|
+
### Cursor / Windsurf (`.cursor/mcp.json`)
|
|
60
20
|
|
|
61
21
|
```json
|
|
62
22
|
{
|
|
63
23
|
"mcpServers": {
|
|
64
24
|
"almyty": {
|
|
65
25
|
"command": "npx",
|
|
66
|
-
"args": ["-y", "@almyty/mcp-server"]
|
|
67
|
-
|
|
26
|
+
"args": ["-y", "@almyty/mcp-server"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### VS Code Copilot (`.vscode/mcp.json`)
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"servers": {
|
|
37
|
+
"almyty": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["-y", "@almyty/mcp-server"]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Google Gemini CLI (`~/.gemini/settings.json`)
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"almyty": {
|
|
51
|
+
"command": "npx",
|
|
52
|
+
"args": ["-y", "@almyty/mcp-server"]
|
|
68
53
|
}
|
|
69
54
|
}
|
|
70
55
|
}
|
|
@@ -76,55 +61,39 @@ claude mcp add almyty -- npx -y @almyty/mcp-server
|
|
|
76
61
|
[mcp_servers.almyty]
|
|
77
62
|
command = "npx"
|
|
78
63
|
args = ["-y", "@almyty/mcp-server"]
|
|
79
|
-
|
|
80
|
-
[mcp_servers.almyty.env]
|
|
81
|
-
APIFAI_URL = "http://localhost:4000"
|
|
82
|
-
APIFAI_TOKEN = "your-jwt-token"
|
|
83
64
|
```
|
|
84
65
|
|
|
85
|
-
|
|
66
|
+
## How It Works
|
|
86
67
|
|
|
87
|
-
|
|
88
|
-
{ "servers": { "almyty": { "command": "npx", "args": ["-y", "@almyty/mcp-server"] } } }
|
|
89
|
-
```
|
|
68
|
+
Instead of dumping every tool schema into the LLM context (thousands of tokens), this server uses a skill-first approach:
|
|
90
69
|
|
|
91
|
-
|
|
70
|
+
1. **2 tools** exposed to the LLM: `almyty_execute` + `almyty_search`
|
|
71
|
+
2. **Skills as prompts** loaded on demand when the LLM needs them
|
|
72
|
+
3. LLM searches for relevant tools → loads the skill → calls execute
|
|
92
73
|
|
|
93
|
-
```
|
|
94
|
-
|
|
74
|
+
```
|
|
75
|
+
Traditional MCP: 20 tools × ~200 tokens = ~4,000 tokens (always in context)
|
|
76
|
+
Skill-first: 2 tools + on-demand skills = ~300 tokens base
|
|
95
77
|
```
|
|
96
78
|
|
|
97
79
|
## Environment Variables
|
|
98
80
|
|
|
99
81
|
| Variable | Default | Description |
|
|
100
82
|
|----------|---------|-------------|
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
| `
|
|
104
|
-
| `APIFAI_MODE` | `skill-first` | `skill-first` or `full` |
|
|
83
|
+
| `ALMYTY_URL` | `https://api.almyty.com` | almyty API URL |
|
|
84
|
+
| `ALMYTY_TOKEN` | — | Auth token (or use `npx @almyty/mcp-server login`) |
|
|
85
|
+
| `ALMYTY_GATEWAY_ID` | — | Scope to a specific gateway |
|
|
105
86
|
|
|
106
|
-
##
|
|
87
|
+
## Authentication
|
|
107
88
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
| `full` | All N tools | ~N×200 tokens | Traditional MCP (every schema in context) |
|
|
112
|
-
|
|
113
|
-
## Architecture
|
|
89
|
+
```bash
|
|
90
|
+
# Interactive login (opens browser)
|
|
91
|
+
npx @almyty/mcp-server login
|
|
114
92
|
|
|
93
|
+
# Or set token directly
|
|
94
|
+
export ALMYTY_TOKEN=your-token
|
|
95
|
+
npx @almyty/mcp-server
|
|
115
96
|
```
|
|
116
|
-
Your LLM (Claude, Cursor, Copilot, Codex, Gemini)
|
|
117
|
-
↕ MCP stdio (2 tools + skills as prompts)
|
|
118
|
-
@almyty/mcp-server
|
|
119
|
-
↕ HTTP/JSON-RPC
|
|
120
|
-
almyty backend (tools + skills + auth)
|
|
121
|
-
↕ HTTP/GraphQL/SOAP/gRPC
|
|
122
|
-
Your APIs (OpenAPI, GraphQL, SOAP, Protobuf)
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
**Auth model:**
|
|
126
|
-
- User → almyty: JWT token (env var or `npx @almyty/mcp-server login`)
|
|
127
|
-
- almyty → APIs: Managed within almyty (API keys, OAuth, etc.)
|
|
128
97
|
|
|
129
98
|
## License
|
|
130
99
|
|
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