@agiflowai/one-mcp 0.3.11 → 0.3.13

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,49 +1,17 @@
1
1
  # @agiflowai/one-mcp
2
2
 
3
- > MCP proxy server for progressive tool discovery and reduced token usage
3
+ MCP proxy for aggregating multiple MCP servers behind one endpoint.
4
4
 
5
- Connect to multiple MCP servers through a single proxy that loads tools on-demand, reducing initial token usage by 90%+.
5
+ `one-mcp` supports three proxy modes:
6
6
 
7
- ## The Problem
7
+ - `meta`: expose `describe_tools` and `use_tool`
8
+ - `flat`: expose proxied tools and resources directly
9
+ - `search`: expose `describe_tools`, `list_tools`, and `use_tool`
8
10
 
9
- When connecting to multiple MCP servers directly, AI agents load ALL tools from ALL servers at startup:
10
-
11
- ```
12
- 10 MCP Servers:
13
- Server 1: 20 tools × 200 tokens = 4,000 tokens
14
- Server 2: 15 tools × 200 tokens = 3,000 tokens
15
- Server 3: 30 tools × 200 tokens = 6,000 tokens
16
- ...
17
- Total: ~40,000+ tokens consumed BEFORE you even start coding
18
- ```
19
-
20
- This wastes context window on tool descriptions you may never use.
21
-
22
- ## The Solution
23
-
24
- one-mcp acts as a smart proxy with progressive discovery:
25
-
26
- ```
27
- Traditional (High Token Cost): Progressive Discovery (Low Token Cost):
28
- ┌─────────────────┐ ┌─────────────────┐
29
- │ AI Agent │ ← 40,000+ tokens │ AI Agent │ ← 400 tokens
30
- ├─────────────────┤ ├─────────────────┤
31
- │ Server 1 (20) │ │ one-mcp │ ← 2 meta-tools
32
- │ Server 2 (15) │ │ (proxy) │
33
- │ Server 3 (30) │ └────────┬────────┘
34
- │ ... │ │ loads on-demand
35
- └─────────────────┘ ┌────┴────┬────────┐
36
- │ Srv 1 │ Srv 2 │ ...
37
- └─────────┴────────┘
38
- ```
39
-
40
- 1. **Initial**: Agent sees only 2 meta-tools (`describe_tools`, `use_tool`) - ~400 tokens
41
- 2. **Discovery**: Agent calls `describe_tools` for specific servers when needed
42
- 3. **Execution**: Agent calls `use_tool` to run tools through the proxy
43
-
44
- **Result: 90%+ reduction in initial token usage**
45
-
46
- ---
11
+ Use this when:
12
+ - you want one MCP entry instead of many
13
+ - you want cached startup metadata across multiple downstream servers
14
+ - you want to choose between meta-tool routing and direct flat exposure
47
15
 
48
16
  ## Quick Start
49
17
 
@@ -91,14 +59,47 @@ Add to your MCP config (`.mcp.json`, `.cursor/mcp.json`, etc.):
91
59
  }
92
60
  ```
93
61
 
62
+ To change proxy behavior, set `--proxy-mode`:
63
+
64
+ ```json
65
+ {
66
+ "mcpServers": {
67
+ "one-mcp": {
68
+ "command": "npx",
69
+ "args": ["-y", "@agiflowai/one-mcp", "mcp-serve", "--proxy-mode", "search", "--config", "./mcp-config.yaml"]
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
94
75
  ### 3. Start Using
95
76
 
96
- Your agent now has access to all tools from all configured servers through one connection.
77
+ `one-mcp` now fronts the configured downstream servers through one MCP server.
97
78
 
98
79
  ---
99
80
 
100
81
  ## Configuration
101
82
 
83
+ ### Proxy Modes
84
+
85
+ Use `mcp-serve --proxy-mode <mode>` to control how one-mcp exposes downstream tools.
86
+
87
+ `meta` mode:
88
+ - Default mode
89
+ - Exposes `describe_tools` and `use_tool`
90
+ - `describe_tools` includes the proxied capability catalog in its description
91
+
92
+ `flat` mode:
93
+ - Exposes proxied tools directly in `tools/list`
94
+ - Exposes proxied resources directly in `resources/list`
95
+ - Name clashes are prefixed as `serverName__toolName` or `serverName__resourceUri`
96
+ - `describe_tools` is still exposed when file-based skills or prompt-based skills exist
97
+
98
+ `search` mode:
99
+ - Exposes `describe_tools`, `list_tools`, and `use_tool`
100
+ - `describe_tools` stays compact and is used for schemas and skill instructions
101
+ - `list_tools` shows server capability summaries and can filter results by capability or server
102
+
102
103
  ### Server Types
103
104
 
104
105
  ```yaml
@@ -153,7 +154,7 @@ mcpServers:
153
154
 
154
155
  ### Tool Blacklisting
155
156
 
156
- Block specific tools from being listed or executed:
157
+ Prevent specific downstream tools from being listed or executed:
157
158
 
158
159
  ```yaml
159
160
  mcpServers:
@@ -174,7 +175,7 @@ Blacklisted tools:
174
175
 
175
176
  ### Compact Tool Descriptions
176
177
 
177
- Reduce token usage by omitting verbose descriptions:
178
+ Omit downstream tool descriptions from capability listings:
178
179
 
179
180
  ```yaml
180
181
  mcpServers:
@@ -200,11 +201,11 @@ filesystem:
200
201
 
201
202
  ### Skills
202
203
 
203
- Skills are reusable prompt templates that provide specialized capabilities to AI agents. They are markdown files with YAML frontmatter that get loaded and made available through the `describe_tools` output.
204
+ File-based skills are loaded from `SKILL.md` files and exposed through `describe_tools`.
204
205
 
205
206
  #### Configuration
206
207
 
207
- Enable skills by adding a `skills` section to your config:
208
+ Enable file-based skills by adding a `skills` section:
208
209
 
209
210
  ```yaml
210
211
  mcpServers:
@@ -218,9 +219,7 @@ skills:
218
219
 
219
220
  #### Skill File Structure
220
221
 
221
- Skills can be organized in two ways:
222
-
223
- **Flat structure:**
222
+ Example:
224
223
  ```
225
224
  .claude/skills/
226
225
  ├── pdf/
@@ -229,7 +228,7 @@ Skills can be organized in two ways:
229
228
  └── SKILL.md
230
229
  ```
231
230
 
232
- **Skill file format (`SKILL.md`):**
231
+ `SKILL.md` format:
233
232
  ```markdown
234
233
  ---
235
234
  name: pdf
@@ -246,16 +245,9 @@ This skill helps you work with PDF files...
246
245
 
247
246
  #### Required Frontmatter
248
247
 
249
- Each `SKILL.md` must have:
248
+ Each `SKILL.md` must define:
250
249
  - `name`: Unique identifier for the skill
251
- - `description`: Brief description shown to AI agents
252
-
253
- #### How Skills Work
254
-
255
- 1. Skills are discovered from configured paths at startup
256
- 2. Available skills are listed in the `describe_tools` output
257
- 3. AI agents can invoke skills by name (e.g., `skill: "pdf"`)
258
- 4. The skill's content expands as a prompt providing specialized instructions
250
+ - `description`: Brief description shown to clients
259
251
 
260
252
  #### Precedence
261
253
 
@@ -263,13 +255,13 @@ When multiple paths are configured, skills from earlier paths take precedence ov
263
255
 
264
256
  ### Prompt-Based Skills
265
257
 
266
- You can also convert MCP server prompts into skills. This allows you to expose prompts from MCP servers as executable skills that AI agents can invoke.
258
+ You can also expose MCP prompts as skills.
267
259
 
268
- #### Auto-Detection from Front-Matter (Recommended)
260
+ #### Auto-Detection From Frontmatter
269
261
 
270
- The easiest way to create prompt-based skills is to add YAML front-matter directly in your prompt content. one-mcp automatically detects prompts with `name` and `description` front-matter and exposes them as skills.
262
+ If prompt content contains YAML frontmatter with `name` and `description`, `one-mcp` can expose it as a skill.
271
263
 
272
- **Prompt content with front-matter:**
264
+ Prompt content example:
273
265
  ```markdown
274
266
  ---
275
267
  name: code-reviewer
@@ -281,7 +273,7 @@ description: Review code for best practices and potential issues
281
273
  When reviewing code, follow these guidelines...
282
274
  ```
283
275
 
284
- MCP servers like `@agiflowai/scaffold-mcp` support the `--prompt-as-skill` flag to automatically add front-matter to prompts:
276
+ Some servers, such as `@agiflowai/scaffold-mcp`, support `--prompt-as-skill` and can emit that frontmatter automatically:
285
277
 
286
278
  ```yaml
287
279
  mcpServers:
@@ -294,7 +286,7 @@ mcpServers:
294
286
  - "--prompt-as-skill" # Enables front-matter in prompts
295
287
  ```
296
288
 
297
- **Multi-line descriptions** are supported using YAML block scalars:
289
+ Multi-line descriptions are supported:
298
290
 
299
291
  ```markdown
300
292
  ---
@@ -307,9 +299,9 @@ description: |
307
299
  ---
308
300
  ```
309
301
 
310
- #### Explicit Configuration (Alternative)
302
+ #### Explicit Configuration
311
303
 
312
- You can also explicitly configure which prompts should be exposed as skills:
304
+ You can also configure prompt-to-skill mappings explicitly:
313
305
 
314
306
  ```yaml
315
307
  mcpServers:
@@ -332,20 +324,11 @@ mcpServers:
332
324
  description: "Generate documentation from code"
333
325
  ```
334
326
 
335
- #### How Prompt-Based Skills Work
336
-
337
- 1. **Discovery**: one-mcp scans all prompts from connected servers for front-matter with `name` and `description`
338
- 2. **Fallback**: Explicitly configured prompts (in `config.prompts`) take precedence over auto-detected ones
339
- 3. **Invocation**: When an AI agent requests a prompt-based skill, one-mcp:
340
- - Fetches the prompt content from the MCP server
341
- - Returns the prompt messages as skill instructions
342
- 4. **Execution**: The AI agent follows the skill instructions
343
-
344
327
  #### Skill Configuration Fields (Explicit Config)
345
328
 
346
329
  | Field | Required | Description |
347
330
  |-------|----------|-------------|
348
- | `name` | Yes | Unique skill identifier shown to AI agents |
331
+ | `name` | Yes | Unique skill identifier shown to clients |
349
332
  | `description` | Yes | Brief description of what the skill does |
350
333
  | `folder` | No | Optional folder path for skill resources |
351
334
 
@@ -355,54 +338,41 @@ mcpServers:
355
338
  - Skills are only prefixed with `skill__` when they clash with MCP tool names
356
339
  - Skills that only clash with other skills are deduplicated (first one wins, no prefix)
357
340
 
358
- #### Example Use Case
359
-
360
- Convert a complex prompt from an MCP server into a reusable skill:
361
-
362
- ```yaml
363
- mcpServers:
364
- architect-mcp:
365
- command: npx
366
- args: ["-y", "@agiflowai/architect-mcp", "mcp-serve"]
367
- config:
368
- instruction: "Architecture and design patterns"
369
- prompts:
370
- design-review:
371
- skill:
372
- name: design-reviewer
373
- description: "Review code architecture and suggest improvements"
374
- ```
375
-
376
- When the AI agent invokes `design-reviewer`, it receives the full prompt content from `architect-mcp`'s `design-review` prompt, enabling sophisticated code review capabilities.
377
-
378
- ---
379
-
380
341
  ## MCP Tools
381
342
 
382
- When running as an MCP server, one-mcp provides:
343
+ The MCP tools exposed by `one-mcp` depend on `--proxy-mode`.
383
344
 
384
345
  ### `describe_tools`
385
346
 
386
- Get information about available tools:
347
+ Returns detailed tool schemas and skill instructions.
387
348
 
388
349
  ```json
389
350
  {
390
- "toolNames": ["read_file", "write_file"],
391
- "serverName": "filesystem" // optional
351
+ "toolNames": ["read_file", "write_file"]
392
352
  }
393
353
  ```
394
354
 
395
355
  ### `use_tool`
396
356
 
397
- Execute a tool from any connected server:
357
+ Executes a proxied tool in `meta` and `search` modes.
398
358
 
399
359
  ```json
400
360
  {
401
361
  "toolName": "read_file",
402
362
  "toolArgs": {
403
363
  "path": "/path/to/file"
404
- },
405
- "serverName": "filesystem" // optional, auto-detected if unique
364
+ }
365
+ }
366
+ ```
367
+
368
+ ### `list_tools`
369
+
370
+ Only available in `search` mode. Returns tool names grouped by proxied server, with server capability summaries and optional filtering.
371
+
372
+ ```json
373
+ {
374
+ "capability": "review",
375
+ "serverName": "architect-mcp"
406
376
  }
407
377
  ```
408
378
 
@@ -414,6 +384,9 @@ Execute a tool from any connected server:
414
384
  # Start MCP server (stdio, for Claude Code/Cursor)
415
385
  npx @agiflowai/one-mcp mcp-serve --config ./mcp-config.yaml
416
386
 
387
+ # Start and clear the cached definitions first
388
+ npx @agiflowai/one-mcp mcp-serve --config ./mcp-config.yaml --clear-definitions-cache
389
+
417
390
  # Start with HTTP transport
418
391
  npx @agiflowai/one-mcp mcp-serve --config ./mcp-config.yaml --type http --port 3000
419
392
 
@@ -423,14 +396,18 @@ npx @agiflowai/one-mcp init --output mcp-config.yaml
423
396
  # Pre-download packages for faster startup
424
397
  npx @agiflowai/one-mcp prefetch --config ./mcp-config.yaml
425
398
 
426
- # List all tools from configured servers (also shows configured skills)
427
- npx @agiflowai/one-mcp list-tools --config ./mcp-config.yaml
399
+ # Pre-download packages and build a definitions cache for faster discovery
400
+ npx @agiflowai/one-mcp prefetch --config ./mcp-config.yaml --definitions-out ./.cache/one-mcp-definitions.json
401
+
402
+ # Search tools across configured servers
403
+ npx @agiflowai/one-mcp search-tools --config ./mcp-config.yaml
428
404
 
429
- # List tools as JSON (includes __skills__ key)
430
- npx @agiflowai/one-mcp list-tools --config ./mcp-config.yaml --json
405
+ # Search tools as JSON
406
+ npx @agiflowai/one-mcp search-tools --config ./mcp-config.yaml --json
431
407
 
432
- # Filter tools by server
433
- npx @agiflowai/one-mcp list-tools --config ./mcp-config.yaml --server filesystem
408
+ # Filter tools by capability or server
409
+ npx @agiflowai/one-mcp search-tools --config ./mcp-config.yaml --capability review
410
+ npx @agiflowai/one-mcp search-tools --config ./mcp-config.yaml --server filesystem
434
411
 
435
412
  # Get tool details
436
413
  npx @agiflowai/one-mcp describe-tools --config ./mcp-config.yaml --tools read_file,write_file
@@ -449,16 +426,34 @@ npx @agiflowai/one-mcp read-resource --config ./mcp-config.yaml file:///readme.m
449
426
 
450
427
  # Read from a specific server
451
428
  npx @agiflowai/one-mcp read-resource --config ./mcp-config.yaml --server my-server file:///readme.md
429
+
430
+ # List prompts from configured servers
431
+ npx @agiflowai/one-mcp list-prompts --config ./mcp-config.yaml
432
+
433
+ # Get a prompt by name
434
+ npx @agiflowai/one-mcp get-prompt --config ./mcp-config.yaml scaffold-feature
435
+
436
+ # Get a prompt from a specific server with arguments
437
+ npx @agiflowai/one-mcp get-prompt --config ./mcp-config.yaml --server scaffold-mcp --args '{"projectPath":"apps/web"}' scaffold-feature
452
438
  ```
453
439
 
454
440
  ### Prefetch Command
455
441
 
456
- Pre-download packages used by MCP servers (npx, pnpx, uvx, uv) to speed up initial connections:
442
+ Pre-download packages used by MCP servers (npx, pnpx, uvx, uv) and optionally build a cached definitions file for faster tool/prompt discovery during `mcp-serve` startup:
457
443
 
458
444
  ```bash
459
445
  # Prefetch all packages
460
446
  npx @agiflowai/one-mcp prefetch --config ./mcp-config.yaml
461
447
 
448
+ # Prefetch packages and write a definitions cache
449
+ npx @agiflowai/one-mcp prefetch --config ./mcp-config.yaml --definitions-out ./.cache/one-mcp-definitions.json
450
+
451
+ # Build only the definitions cache
452
+ npx @agiflowai/one-mcp prefetch --config ./mcp-config.yaml --definitions-out ./.cache/one-mcp-definitions.yaml --skip-packages
453
+
454
+ # Clear the default definitions cache
455
+ npx @agiflowai/one-mcp prefetch --config ./mcp-config.yaml --clear-definitions-cache --skip-packages
456
+
462
457
  # Dry run - see what would be prefetched
463
458
  npx @agiflowai/one-mcp prefetch --config ./mcp-config.yaml --dry-run
464
459
 
@@ -475,105 +470,46 @@ npx @agiflowai/one-mcp prefetch --config ./mcp-config.yaml --filter npx
475
470
  | `-p, --parallel` | Run prefetch commands in parallel |
476
471
  | `-d, --dry-run` | Show what would be prefetched without executing |
477
472
  | `-f, --filter` | Filter by package manager: `npx`, `pnpx`, `uvx`, or `uv` |
473
+ | `--definitions-out` | Write a JSON or YAML definitions cache file for `mcp-serve` |
474
+ | `--skip-packages` | Skip package prefetch and only write the definitions cache |
475
+ | `--clear-definitions-cache` | Delete the effective definitions cache file before continuing |
478
476
 
479
- ### Server Options
477
+ ### Definitions Cache Workflow
480
478
 
481
- | Option | Description | Default |
482
- |--------|-------------|---------|
483
- | `-c, --config` | Path to config file (YAML or JSON) | Required |
484
- | `-t, --type` | Transport: `stdio`, `http`, `sse` | `stdio` |
485
- | `-p, --port` | Port for HTTP/SSE | `3000` |
486
- | `--host` | Host for HTTP/SSE | `localhost` |
487
- | `--no-cache` | Force reload config, bypass cache | `false` |
479
+ For installations with many MCP servers, especially stdio-backed servers, `mcp-serve` now tries to use a definitions cache automatically. The default cache path is under `~/.aicode-toolkit/`, and the filename is derived from the sanitized absolute config path. For example, `/tmp/project/mcp-config.yaml` becomes `~/.aicode-toolkit/tmp_project_mcp-config.yaml.definitions-cache.json`.
488
480
 
489
- ---
481
+ If that cache file exists and matches the current config, `one-mcp` starts from cached tool/prompt metadata and connects to downstream MCP servers on demand. If the cache is missing or stale, `one-mcp` keeps the current eager startup behavior and writes a fresh cache in the background for the next run.
490
482
 
491
- ## Use Cases
492
-
493
- ### 1. Consolidate Multiple Servers
494
-
495
- **Before (10 server configs):**
496
- ```json
497
- {
498
- "mcpServers": {
499
- "filesystem": { "command": "npx", "args": ["..."] },
500
- "database": { "command": "npx", "args": ["..."] },
501
- "web-search": { "command": "npx", "args": ["..."] }
502
- // ... 7 more
503
- }
504
- }
505
- ```
506
-
507
- **After (1 config):**
508
- ```json
509
- {
510
- "mcpServers": {
511
- "one-mcp": {
512
- "command": "npx",
513
- "args": ["-y", "@agiflowai/one-mcp", "mcp-serve", "--config", "./mcp-config.yaml"]
514
- }
515
- }
516
- }
517
- ```
518
-
519
- ### 2. Mix Local and Remote Servers
520
-
521
- ```yaml
522
- mcpServers:
523
- # Local development tools
524
- filesystem:
525
- command: npx
526
- args: ["-y", "@modelcontextprotocol/server-filesystem", "${HOME}/dev"]
527
-
528
- # Company-wide remote tools
529
- company-apis:
530
- url: https://mcp.company.com/api
531
- type: sse
532
- headers:
533
- Authorization: "Bearer ${COMPANY_TOKEN}"
534
- ```
535
-
536
- ### 3. Environment-Specific Configs
483
+ You can still prebuild the cache explicitly:
537
484
 
538
485
  ```bash
539
- # Development
540
- npx @agiflowai/one-mcp mcp-serve --config ./mcp-dev.yaml
486
+ # Step 1: Warm packages and cache definitions
487
+ npx @agiflowai/one-mcp prefetch --config ./mcp-config.yaml --definitions-out ./.cache/one-mcp-definitions.json
541
488
 
542
- # Production
543
- npx @agiflowai/one-mcp mcp-serve --config ./mcp-prod.yaml
489
+ # Step 2: Start one-mcp using the prefetched definitions
490
+ npx @agiflowai/one-mcp mcp-serve --config ./mcp-config.yaml --definitions-cache ./.cache/one-mcp-definitions.json
544
491
  ```
545
492
 
546
- ---
493
+ The definitions cache stores tool schemas, prompt metadata, and prompt-based skill metadata. Use `--clear-definitions-cache` on `mcp-serve` or `prefetch` to delete the cache and force a cold start.
547
494
 
548
- ## Architecture
495
+ ### Server Options
549
496
 
550
- ```
551
- ┌─────────────────┐
552
- │ AI Agent │
553
- │ (Claude/etc) │
554
- └────────┬────────┘
555
- Single MCP Connection (2 tools)
556
-
557
- ┌────────▼────────────────────────────┐
558
- │ @agiflowai/one-mcp │
559
- │ │
560
- │ • Load configs (YAML/JSON) │
561
- │ • Environment interpolation │
562
- │ • Connect to servers on-demand │
563
- │ • Route tool calls │
564
- │ • Apply blacklists │
565
- └──────┬──────┬───────┬───────────────┘
566
- │ │ │
567
- │ │ │ Multiple MCP Connections
568
- │ │ │
569
- ┌───▼──┐ ┌─▼────┐ ┌▼─────────┐
570
- │ MCP │ │ MCP │ │ MCP │
571
- │Server│ │Server│ │ Server │
572
- │ 1 │ │ 2 │ │ 3 │
573
- └──────┘ └──────┘ └──────────┘
574
- ```
497
+ | Option | Description | Default |
498
+ |--------|-------------|---------|
499
+ | `-c, --config` | Path to config file (YAML or JSON) | Required |
500
+ | `-t, --type` | Transport: `stdio`, `http`, `sse` | `stdio` |
501
+ | `-p, --port` | Port for HTTP/SSE | `3000` |
502
+ | `--host` | Host for HTTP/SSE | `localhost` |
503
+ | `--no-cache` | Force reload config, bypass cache | `false` |
504
+ | `--definitions-cache` | Read tool/prompt/skill definitions from a specific JSON or YAML cache file | Auto-derived from config path |
505
+ | `--clear-definitions-cache` | Delete the effective definitions cache file before startup | `false` |
575
506
 
576
- ---
507
+ ## Notes
508
+
509
+ - `one-mcp` reads YAML or JSON config files
510
+ - environment variables use `${VAR_NAME}` interpolation
511
+ - downstream stdio/http/sse servers can be mixed in one config
512
+ - definitions cache is keyed by config content and one-mcp version
577
513
 
578
514
  ## Related Packages
579
515