@agimon-ai/mcp-proxy 0.4.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/LICENSE +52 -0
- package/README.md +530 -0
- package/dist/cli.cjs +1513 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +1514 -0
- package/dist/index.cjs +27 -0
- package/dist/index.d.cts +1350 -0
- package/dist/index.d.mts +1351 -0
- package/dist/index.mjs +3 -0
- package/dist/src-6KF7hZTe.cjs +4975 -0
- package/dist/src-DQ_MagA0.mjs +4779 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: AgiFlow
|
|
6
|
+
Licensed Work: @agimon-ai/public-packages
|
|
7
|
+
The Licensed Work is (c) 2026 AgiFlow.
|
|
8
|
+
Additional Use Grant: None
|
|
9
|
+
Change Date: 2030-03-06
|
|
10
|
+
Change License: Apache License, Version 2.0
|
|
11
|
+
|
|
12
|
+
Terms
|
|
13
|
+
|
|
14
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
15
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
16
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
17
|
+
production use.
|
|
18
|
+
|
|
19
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
20
|
+
available distribution of a specific version of the Licensed Work under this
|
|
21
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
22
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
23
|
+
above terminate.
|
|
24
|
+
|
|
25
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
26
|
+
currently in effect as described in this License, you must purchase a
|
|
27
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
28
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
29
|
+
|
|
30
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
31
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
32
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
33
|
+
for each version of the Licensed Work released by Licensor.
|
|
34
|
+
|
|
35
|
+
You must conspicuously display this License on each original or modified copy
|
|
36
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
37
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
38
|
+
License apply to your use of that work.
|
|
39
|
+
|
|
40
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
41
|
+
terminate your rights under this License for the current and all other
|
|
42
|
+
versions of the Licensed Work.
|
|
43
|
+
|
|
44
|
+
This License does not grant you any right in any trademark or logo of
|
|
45
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
46
|
+
Licensor as expressly required by this License).
|
|
47
|
+
|
|
48
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
49
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
50
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
51
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
52
|
+
TITLE.
|
package/README.md
ADDED
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
# @agimon-ai/mcp-proxy
|
|
2
|
+
|
|
3
|
+
MCP proxy for aggregating multiple MCP servers behind one endpoint.
|
|
4
|
+
|
|
5
|
+
`mcp-proxy` supports three proxy modes:
|
|
6
|
+
|
|
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`
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
### 1. Create Configuration
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx @agimon-ai/mcp-proxy init
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This creates `mcp-config.yaml`:
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
mcpServers:
|
|
28
|
+
filesystem:
|
|
29
|
+
command: npx
|
|
30
|
+
args:
|
|
31
|
+
- -y
|
|
32
|
+
- "@modelcontextprotocol/server-filesystem"
|
|
33
|
+
- "${HOME}/Documents"
|
|
34
|
+
config:
|
|
35
|
+
instruction: "Access files in the Documents folder"
|
|
36
|
+
|
|
37
|
+
scaffold-mcp:
|
|
38
|
+
command: npx
|
|
39
|
+
args:
|
|
40
|
+
- -y
|
|
41
|
+
- "@agimon-ai/scaffold-mcp"
|
|
42
|
+
- "mcp-serve"
|
|
43
|
+
config:
|
|
44
|
+
instruction: "Scaffold projects and features"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Configure Your Agent
|
|
48
|
+
|
|
49
|
+
Add to your MCP config (`.mcp.json`, `.cursor/mcp.json`, etc.):
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"mcpServers": {
|
|
54
|
+
"mcp-proxy": {
|
|
55
|
+
"command": "npx",
|
|
56
|
+
"args": ["-y", "@agimon-ai/mcp-proxy", "mcp-serve", "--config", "./mcp-config.yaml"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
To change proxy behavior, set `--proxy-mode`:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"mcpServers": {
|
|
67
|
+
"mcp-proxy": {
|
|
68
|
+
"command": "npx",
|
|
69
|
+
"args": ["-y", "@agimon-ai/mcp-proxy", "mcp-serve", "--proxy-mode", "search", "--config", "./mcp-config.yaml"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 3. Start Using
|
|
76
|
+
|
|
77
|
+
`mcp-proxy` now fronts the configured downstream servers through one MCP server.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Configuration
|
|
82
|
+
|
|
83
|
+
### Proxy Modes
|
|
84
|
+
|
|
85
|
+
Use `mcp-serve --proxy-mode <mode>` to control how mcp-proxy 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
|
+
|
|
103
|
+
### Server Types
|
|
104
|
+
|
|
105
|
+
```yaml
|
|
106
|
+
mcpServers:
|
|
107
|
+
# Stdio server (local command)
|
|
108
|
+
local-server:
|
|
109
|
+
command: npx
|
|
110
|
+
args:
|
|
111
|
+
- -y
|
|
112
|
+
- "@modelcontextprotocol/server-example"
|
|
113
|
+
env:
|
|
114
|
+
API_KEY: "${MY_API_KEY}"
|
|
115
|
+
config:
|
|
116
|
+
instruction: "Description for the AI agent"
|
|
117
|
+
|
|
118
|
+
# HTTP/SSE server (remote)
|
|
119
|
+
remote-server:
|
|
120
|
+
url: https://api.example.com/mcp
|
|
121
|
+
type: sse # or http
|
|
122
|
+
headers:
|
|
123
|
+
Authorization: "Bearer ${TOKEN}"
|
|
124
|
+
config:
|
|
125
|
+
instruction: "Remote server description"
|
|
126
|
+
|
|
127
|
+
# Disabled server (skipped)
|
|
128
|
+
disabled-server:
|
|
129
|
+
command: node
|
|
130
|
+
args: ["server.js"]
|
|
131
|
+
disabled: true
|
|
132
|
+
|
|
133
|
+
# Custom timeout for slow servers
|
|
134
|
+
slow-server:
|
|
135
|
+
command: npx
|
|
136
|
+
args: ["-y", "@heavy/mcp-package"]
|
|
137
|
+
timeout: 60000 # 60 seconds (default: 30000)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Environment Variables
|
|
141
|
+
|
|
142
|
+
Use `${VAR_NAME}` syntax:
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
mcpServers:
|
|
146
|
+
api-server:
|
|
147
|
+
command: npx
|
|
148
|
+
args:
|
|
149
|
+
- "@mycompany/mcp-server"
|
|
150
|
+
- "${HOME}/data" # Expands to /Users/username/data
|
|
151
|
+
env:
|
|
152
|
+
API_KEY: "${MY_API_KEY}" # Reads from environment
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Tool Blacklisting
|
|
156
|
+
|
|
157
|
+
Prevent specific downstream tools from being listed or executed:
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
mcpServers:
|
|
161
|
+
filesystem:
|
|
162
|
+
command: npx
|
|
163
|
+
args: ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"]
|
|
164
|
+
config:
|
|
165
|
+
instruction: "File system access (read-only)"
|
|
166
|
+
toolBlacklist:
|
|
167
|
+
- write_file
|
|
168
|
+
- create_directory
|
|
169
|
+
- delete_file
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Blacklisted tools:
|
|
173
|
+
- Won't appear in tool listings
|
|
174
|
+
- Return an error if called
|
|
175
|
+
|
|
176
|
+
### Compact Tool Descriptions
|
|
177
|
+
|
|
178
|
+
Omit downstream tool descriptions from capability listings:
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
mcpServers:
|
|
182
|
+
filesystem:
|
|
183
|
+
command: npx
|
|
184
|
+
args: ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"]
|
|
185
|
+
config:
|
|
186
|
+
omitToolDescription: true # Show only tool names
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Default output:**
|
|
190
|
+
```
|
|
191
|
+
filesystem:
|
|
192
|
+
- read_file: Read contents of a file at the specified path...
|
|
193
|
+
- list_directory: List all files and directories...
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**With omitToolDescription:**
|
|
197
|
+
```
|
|
198
|
+
filesystem:
|
|
199
|
+
read_file, list_directory, search_files
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Skills
|
|
203
|
+
|
|
204
|
+
File-based skills are loaded from `SKILL.md` files and exposed through `describe_tools`.
|
|
205
|
+
|
|
206
|
+
#### Configuration
|
|
207
|
+
|
|
208
|
+
Enable file-based skills by adding a `skills` section:
|
|
209
|
+
|
|
210
|
+
```yaml
|
|
211
|
+
mcpServers:
|
|
212
|
+
# ... your MCP servers
|
|
213
|
+
|
|
214
|
+
skills:
|
|
215
|
+
paths:
|
|
216
|
+
- ".claude/skills" # Relative to config file
|
|
217
|
+
- "/absolute/path/to/skills" # Absolute paths also supported
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
#### Skill File Structure
|
|
221
|
+
|
|
222
|
+
Example:
|
|
223
|
+
```
|
|
224
|
+
.claude/skills/
|
|
225
|
+
├── pdf/
|
|
226
|
+
│ └── SKILL.md
|
|
227
|
+
└── data-analysis/
|
|
228
|
+
└── SKILL.md
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
`SKILL.md` format:
|
|
232
|
+
```markdown
|
|
233
|
+
---
|
|
234
|
+
name: pdf
|
|
235
|
+
description: Create and manipulate PDF documents
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
# PDF Skill
|
|
239
|
+
|
|
240
|
+
This skill helps you work with PDF files...
|
|
241
|
+
|
|
242
|
+
## Usage
|
|
243
|
+
...
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### Required Frontmatter
|
|
247
|
+
|
|
248
|
+
Each `SKILL.md` must define:
|
|
249
|
+
- `name`: Unique identifier for the skill
|
|
250
|
+
- `description`: Brief description shown to clients
|
|
251
|
+
|
|
252
|
+
#### Precedence
|
|
253
|
+
|
|
254
|
+
When multiple paths are configured, skills from earlier paths take precedence over skills with the same name from later paths.
|
|
255
|
+
|
|
256
|
+
### Prompt-Based Skills
|
|
257
|
+
|
|
258
|
+
You can also expose MCP prompts as skills.
|
|
259
|
+
|
|
260
|
+
#### Auto-Detection From Frontmatter
|
|
261
|
+
|
|
262
|
+
If prompt content contains YAML frontmatter with `name` and `description`, `mcp-proxy` can expose it as a skill.
|
|
263
|
+
|
|
264
|
+
Prompt content example:
|
|
265
|
+
```markdown
|
|
266
|
+
---
|
|
267
|
+
name: code-reviewer
|
|
268
|
+
description: Review code for best practices and potential issues
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
# Code Review Instructions
|
|
272
|
+
|
|
273
|
+
When reviewing code, follow these guidelines...
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Some servers, such as `@agimon-ai/scaffold-mcp`, support `--prompt-as-skill` and can emit that frontmatter automatically:
|
|
277
|
+
|
|
278
|
+
```yaml
|
|
279
|
+
mcpServers:
|
|
280
|
+
scaffold-mcp:
|
|
281
|
+
command: npx
|
|
282
|
+
args:
|
|
283
|
+
- -y
|
|
284
|
+
- "@agimon-ai/scaffold-mcp"
|
|
285
|
+
- "mcp-serve"
|
|
286
|
+
- "--prompt-as-skill" # Enables front-matter in prompts
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Multi-line descriptions are supported:
|
|
290
|
+
|
|
291
|
+
```markdown
|
|
292
|
+
---
|
|
293
|
+
name: complex-skill
|
|
294
|
+
description: |
|
|
295
|
+
A skill that does multiple things:
|
|
296
|
+
- First capability
|
|
297
|
+
- Second capability
|
|
298
|
+
- Third capability
|
|
299
|
+
---
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
#### Explicit Configuration
|
|
303
|
+
|
|
304
|
+
You can also configure prompt-to-skill mappings explicitly:
|
|
305
|
+
|
|
306
|
+
```yaml
|
|
307
|
+
mcpServers:
|
|
308
|
+
my-server:
|
|
309
|
+
command: npx
|
|
310
|
+
args:
|
|
311
|
+
- -y
|
|
312
|
+
- "@mycompany/mcp-server"
|
|
313
|
+
config:
|
|
314
|
+
instruction: "My MCP server"
|
|
315
|
+
prompts:
|
|
316
|
+
code-review:
|
|
317
|
+
skill:
|
|
318
|
+
name: code-reviewer
|
|
319
|
+
description: "Review code for best practices and potential issues"
|
|
320
|
+
folder: "./prompts/code-review" # Optional: resource folder
|
|
321
|
+
documentation:
|
|
322
|
+
skill:
|
|
323
|
+
name: doc-generator
|
|
324
|
+
description: "Generate documentation from code"
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
#### Skill Configuration Fields (Explicit Config)
|
|
328
|
+
|
|
329
|
+
| Field | Required | Description |
|
|
330
|
+
|-------|----------|-------------|
|
|
331
|
+
| `name` | Yes | Unique skill identifier shown to clients |
|
|
332
|
+
| `description` | Yes | Brief description of what the skill does |
|
|
333
|
+
| `folder` | No | Optional folder path for skill resources |
|
|
334
|
+
|
|
335
|
+
#### Skill Naming and Precedence
|
|
336
|
+
|
|
337
|
+
- **File-based skills** take precedence over prompt-based skills with the same name
|
|
338
|
+
- Skills are only prefixed with `skill__` when they clash with MCP tool names
|
|
339
|
+
- Skills that only clash with other skills are deduplicated (first one wins, no prefix)
|
|
340
|
+
|
|
341
|
+
## MCP Tools
|
|
342
|
+
|
|
343
|
+
The MCP tools exposed by `mcp-proxy` depend on `--proxy-mode`.
|
|
344
|
+
|
|
345
|
+
### `describe_tools`
|
|
346
|
+
|
|
347
|
+
Returns detailed tool schemas and skill instructions.
|
|
348
|
+
|
|
349
|
+
```json
|
|
350
|
+
{
|
|
351
|
+
"toolNames": ["read_file", "write_file"]
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### `use_tool`
|
|
356
|
+
|
|
357
|
+
Executes a proxied tool in `meta` and `search` modes.
|
|
358
|
+
|
|
359
|
+
```json
|
|
360
|
+
{
|
|
361
|
+
"toolName": "read_file",
|
|
362
|
+
"toolArgs": {
|
|
363
|
+
"path": "/path/to/file"
|
|
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"
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## CLI Commands
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
# Start MCP server (stdio, for Claude Code/Cursor)
|
|
385
|
+
npx @agimon-ai/mcp-proxy mcp-serve --config ./mcp-config.yaml
|
|
386
|
+
|
|
387
|
+
# Start and clear the cached definitions first
|
|
388
|
+
npx @agimon-ai/mcp-proxy mcp-serve --config ./mcp-config.yaml --clear-definitions-cache
|
|
389
|
+
|
|
390
|
+
# Start with HTTP transport
|
|
391
|
+
npx @agimon-ai/mcp-proxy mcp-serve --config ./mcp-config.yaml --type http --port 3000
|
|
392
|
+
|
|
393
|
+
# Start stdio-http bridge (reuses existing HTTP server on host/port when available)
|
|
394
|
+
npx @agimon-ai/mcp-proxy mcp-serve --config ./mcp-config.yaml --type stdio-http --host 127.0.0.1 --port 3000
|
|
395
|
+
|
|
396
|
+
# Start stdio-http bridge with explicit search proxy mode
|
|
397
|
+
npx @agimon-ai/mcp-proxy mcp-serve --config ./mcp-config.yaml --type stdio-http --proxy-mode search --host 127.0.0.1 --port 3000
|
|
398
|
+
|
|
399
|
+
# Initialize config file
|
|
400
|
+
npx @agimon-ai/mcp-proxy init --output mcp-config.yaml
|
|
401
|
+
|
|
402
|
+
# Pre-download packages for faster startup
|
|
403
|
+
npx @agimon-ai/mcp-proxy prefetch --config ./mcp-config.yaml
|
|
404
|
+
|
|
405
|
+
# Pre-download packages and build a definitions cache for faster discovery
|
|
406
|
+
npx @agimon-ai/mcp-proxy prefetch --config ./mcp-config.yaml --definitions-out ./.cache/mcp-proxy-definitions.json
|
|
407
|
+
|
|
408
|
+
# Search tools across configured servers
|
|
409
|
+
npx @agimon-ai/mcp-proxy search-tools --config ./mcp-config.yaml
|
|
410
|
+
|
|
411
|
+
# Search tools as JSON
|
|
412
|
+
npx @agimon-ai/mcp-proxy search-tools --config ./mcp-config.yaml --json
|
|
413
|
+
|
|
414
|
+
# Filter tools by capability or server
|
|
415
|
+
npx @agimon-ai/mcp-proxy search-tools --config ./mcp-config.yaml --capability review
|
|
416
|
+
npx @agimon-ai/mcp-proxy search-tools --config ./mcp-config.yaml --server filesystem
|
|
417
|
+
|
|
418
|
+
# Get tool details
|
|
419
|
+
npx @agimon-ai/mcp-proxy describe-tools --config ./mcp-config.yaml --tools read_file,write_file
|
|
420
|
+
|
|
421
|
+
# Execute a tool directly
|
|
422
|
+
npx @agimon-ai/mcp-proxy use-tool --config ./mcp-config.yaml --tool-name read_file --args '{"path": "/tmp/test.txt"}'
|
|
423
|
+
|
|
424
|
+
# List all resources from configured servers
|
|
425
|
+
npx @agimon-ai/mcp-proxy list-resources --config ./mcp-config.yaml
|
|
426
|
+
|
|
427
|
+
# Filter resources by server
|
|
428
|
+
npx @agimon-ai/mcp-proxy list-resources --config ./mcp-config.yaml --server my-server
|
|
429
|
+
|
|
430
|
+
# Read a resource by URI
|
|
431
|
+
npx @agimon-ai/mcp-proxy read-resource --config ./mcp-config.yaml file:///readme.md
|
|
432
|
+
|
|
433
|
+
# Read from a specific server
|
|
434
|
+
npx @agimon-ai/mcp-proxy read-resource --config ./mcp-config.yaml --server my-server file:///readme.md
|
|
435
|
+
|
|
436
|
+
# List prompts from configured servers
|
|
437
|
+
npx @agimon-ai/mcp-proxy list-prompts --config ./mcp-config.yaml
|
|
438
|
+
|
|
439
|
+
# Get a prompt by name
|
|
440
|
+
npx @agimon-ai/mcp-proxy get-prompt --config ./mcp-config.yaml scaffold-feature
|
|
441
|
+
|
|
442
|
+
# Get a prompt from a specific server with arguments
|
|
443
|
+
npx @agimon-ai/mcp-proxy get-prompt --config ./mcp-config.yaml --server scaffold-mcp --args '{"projectPath":"apps/web"}' scaffold-feature
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Prefetch Command
|
|
447
|
+
|
|
448
|
+
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:
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
# Prefetch all packages
|
|
452
|
+
npx @agimon-ai/mcp-proxy prefetch --config ./mcp-config.yaml
|
|
453
|
+
|
|
454
|
+
# Prefetch packages and write a definitions cache
|
|
455
|
+
npx @agimon-ai/mcp-proxy prefetch --config ./mcp-config.yaml --definitions-out ./.cache/mcp-proxy-definitions.json
|
|
456
|
+
|
|
457
|
+
# Build only the definitions cache
|
|
458
|
+
npx @agimon-ai/mcp-proxy prefetch --config ./mcp-config.yaml --definitions-out ./.cache/mcp-proxy-definitions.yaml --skip-packages
|
|
459
|
+
|
|
460
|
+
# Clear the default definitions cache
|
|
461
|
+
npx @agimon-ai/mcp-proxy prefetch --config ./mcp-config.yaml --clear-definitions-cache --skip-packages
|
|
462
|
+
|
|
463
|
+
# Dry run - see what would be prefetched
|
|
464
|
+
npx @agimon-ai/mcp-proxy prefetch --config ./mcp-config.yaml --dry-run
|
|
465
|
+
|
|
466
|
+
# Run prefetch in parallel (faster)
|
|
467
|
+
npx @agimon-ai/mcp-proxy prefetch --config ./mcp-config.yaml --parallel
|
|
468
|
+
|
|
469
|
+
# Filter by package manager
|
|
470
|
+
npx @agimon-ai/mcp-proxy prefetch --config ./mcp-config.yaml --filter npx
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
| Option | Description |
|
|
474
|
+
|--------|-------------|
|
|
475
|
+
| `-c, --config` | Path to config file |
|
|
476
|
+
| `-p, --parallel` | Run prefetch commands in parallel |
|
|
477
|
+
| `-d, --dry-run` | Show what would be prefetched without executing |
|
|
478
|
+
| `-f, --filter` | Filter by package manager: `npx`, `pnpx`, `uvx`, or `uv` |
|
|
479
|
+
| `--definitions-out` | Write a JSON or YAML definitions cache file for `mcp-serve` |
|
|
480
|
+
| `--skip-packages` | Skip package prefetch and only write the definitions cache |
|
|
481
|
+
| `--clear-definitions-cache` | Delete the effective definitions cache file before continuing |
|
|
482
|
+
|
|
483
|
+
### Definitions Cache Workflow
|
|
484
|
+
|
|
485
|
+
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`.
|
|
486
|
+
|
|
487
|
+
If that cache file exists and matches the current config, `mcp-proxy` starts from cached tool/prompt metadata and connects to downstream MCP servers on demand. If the cache is missing or stale, `mcp-proxy` keeps the current eager startup behavior and writes a fresh cache in the background for the next run.
|
|
488
|
+
|
|
489
|
+
You can still prebuild the cache explicitly:
|
|
490
|
+
|
|
491
|
+
```bash
|
|
492
|
+
# Step 1: Warm packages and cache definitions
|
|
493
|
+
npx @agimon-ai/mcp-proxy prefetch --config ./mcp-config.yaml --definitions-out ./.cache/mcp-proxy-definitions.json
|
|
494
|
+
|
|
495
|
+
# Step 2: Start mcp-proxy using the prefetched definitions
|
|
496
|
+
npx @agimon-ai/mcp-proxy mcp-serve --config ./mcp-config.yaml --definitions-cache ./.cache/mcp-proxy-definitions.json
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
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.
|
|
500
|
+
|
|
501
|
+
### Server Options
|
|
502
|
+
|
|
503
|
+
| Option | Description | Default |
|
|
504
|
+
|--------|-------------|---------|
|
|
505
|
+
| `-c, --config` | Path to config file (YAML or JSON) | Required |
|
|
506
|
+
| `-t, --type` | Transport: `stdio`, `http`, `sse`, `stdio-http` | `stdio` |
|
|
507
|
+
| `-p, --port` | Port for HTTP/SSE/stdio-http internal HTTP | `3000` |
|
|
508
|
+
| `--host` | Host for HTTP/SSE/stdio-http internal HTTP | `localhost` |
|
|
509
|
+
| `--no-cache` | Force reload config, bypass cache | `false` |
|
|
510
|
+
| `--definitions-cache` | Read tool/prompt/skill definitions from a specific JSON or YAML cache file | Auto-derived from config path |
|
|
511
|
+
| `--clear-definitions-cache` | Delete the effective definitions cache file before startup | `false` |
|
|
512
|
+
|
|
513
|
+
## Notes
|
|
514
|
+
|
|
515
|
+
- `mcp-proxy` reads YAML or JSON config files
|
|
516
|
+
- environment variables use `${VAR_NAME}` interpolation
|
|
517
|
+
- downstream stdio/http/sse servers can be mixed in one config
|
|
518
|
+
- definitions cache is keyed by config content and mcp-proxy version
|
|
519
|
+
|
|
520
|
+
## Related Packages
|
|
521
|
+
|
|
522
|
+
- [@agimon-ai/scaffold-mcp](../scaffold-mcp) - Code scaffolding and templates
|
|
523
|
+
- [@agimon-ai/architect-mcp](../architect-mcp) - Design patterns and code review
|
|
524
|
+
- [@agimon-ai/aicode-toolkit](../../apps/aicode-toolkit) - Unified CLI toolkit
|
|
525
|
+
|
|
526
|
+
---
|
|
527
|
+
|
|
528
|
+
## License
|
|
529
|
+
|
|
530
|
+
AGPL-3.0 © AgiflowIO
|