dynmcp 0.0.1 → 0.1.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 +104 -7
- package/dist/index.cjs +355 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +372 -115
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/schema/mcp-config.json +116 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dynamic Discovery MCP
|
|
2
2
|
|
|
3
3
|
A proxy MCP that exposes meta-tools so agents can discover and call upstream MCP tools on demand, without loading every tool schema into the context window.
|
|
4
4
|
|
|
@@ -8,27 +8,124 @@ Large MCPs routinely expose tens to hundreds of tools. When several are active a
|
|
|
8
8
|
|
|
9
9
|
## How It Works
|
|
10
10
|
|
|
11
|
-
`dynmcp` sits in front of
|
|
11
|
+
`dynmcp` sits in front of one or more upstream MCPs and exposes exactly two tools:
|
|
12
12
|
|
|
13
13
|
- **`discover_tool`** — its description contains a compact catalog of every upstream tool (name and one-line summary). Call it with a tool name to get that tool's full schema: description, parameters, types, and required fields.
|
|
14
14
|
- **`use_tool`** — executes a tool by name, proxying the call to the upstream MCP and returning its output unchanged.
|
|
15
15
|
|
|
16
16
|
The agent workflow: scan the catalog in `discover_tool`'s description to find relevant tools, call `discover_tool` to load the full schema of the one it needs, then call `use_tool` to execute it. Full schemas of tools the agent never needs never enter the context window.
|
|
17
17
|
|
|
18
|
-
`dynmcp` runs locally, communicating with both the agent host and the upstream MCP over stdio.
|
|
19
|
-
|
|
20
18
|
## Usage
|
|
21
19
|
|
|
22
20
|
Requires Node.js >= 20.
|
|
23
21
|
|
|
22
|
+
### Single MCP (quick start)
|
|
23
|
+
|
|
24
24
|
Prefix any MCP invocation with `dynmcp --`:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
# Before
|
|
27
|
+
# Before — tool schemas go straight into context
|
|
28
28
|
npx -y chrome-devtools-mcp@latest
|
|
29
29
|
|
|
30
|
-
# With dynmcp
|
|
30
|
+
# With dynmcp — only discover_tool and use_tool are exposed
|
|
31
31
|
npx dynmcp@latest -- npx -y chrome-devtools-mcp@latest
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
Everything after `--` is the command used to launch the upstream MCP.
|
|
34
|
+
Everything after `--` is the command used to launch the upstream MCP. Tool names are exposed as-is (no namespace prefix).
|
|
35
|
+
|
|
36
|
+
### Multiple MCPs (config file)
|
|
37
|
+
|
|
38
|
+
To proxy several MCPs at once, create a config file:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Auto-discover mcp.json or .mcp.json in cwd
|
|
42
|
+
npx dynmcp@latest
|
|
43
|
+
|
|
44
|
+
# Or specify explicitly
|
|
45
|
+
npx dynmcp@latest --config ./my-config.json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
When using a config file, tool names are namespaced as `<mcp-name>/<tool-name>` to avoid collisions.
|
|
49
|
+
|
|
50
|
+
## Config File
|
|
51
|
+
|
|
52
|
+
The config file declares upstream MCPs under a top-level `mcp` key. Three transport types are supported:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"$schema": "https://unpkg.com/dynmcp/schema/mcp-config.json",
|
|
57
|
+
"mcp": {
|
|
58
|
+
"chrome-devtools": {
|
|
59
|
+
"transport": "stdio",
|
|
60
|
+
"command": "npx",
|
|
61
|
+
"args": ["-y", "chrome-devtools-mcp@latest"]
|
|
62
|
+
},
|
|
63
|
+
"filesystem": {
|
|
64
|
+
"transport": "stdio",
|
|
65
|
+
"command": "npx",
|
|
66
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
|
|
67
|
+
},
|
|
68
|
+
"aws-knowledge": {
|
|
69
|
+
"transport": "streamable-http",
|
|
70
|
+
"url": "https://knowledge-mcp.global.api.aws"
|
|
71
|
+
},
|
|
72
|
+
"remote-sse": {
|
|
73
|
+
"transport": "sse",
|
|
74
|
+
"url": "https://example.com/sse",
|
|
75
|
+
"headers": {
|
|
76
|
+
"Authorization": "Bearer my-token"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
YAML is also supported (use `.yml` or `.yaml` extension).
|
|
84
|
+
|
|
85
|
+
### Transport Types
|
|
86
|
+
|
|
87
|
+
| Transport | Fields | Description |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| `stdio` | `command`, `args?`, `env?` | Spawns the MCP as a child process |
|
|
90
|
+
| `streamable-http` | `url`, `headers?` | Connects to a remote MCP over HTTP |
|
|
91
|
+
| `sse` | `url`, `headers?` | Connects to a remote MCP over Server-Sent Events |
|
|
92
|
+
|
|
93
|
+
### Config Discovery
|
|
94
|
+
|
|
95
|
+
When no `--` command is provided, `dynmcp` looks for a config file in this order:
|
|
96
|
+
|
|
97
|
+
1. Path from `-c` / `--config` flag
|
|
98
|
+
2. `mcp.json` in the current directory
|
|
99
|
+
3. `.mcp.json` in the current directory
|
|
100
|
+
|
|
101
|
+
### Naming Rules
|
|
102
|
+
|
|
103
|
+
MCP names (the keys in the config) must match `^[a-z0-9][a-z0-9-]*$`.
|
|
104
|
+
|
|
105
|
+
## CLI Reference
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
dynmcp [options] [-- <upstream-command> [upstream-args...]]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
| Flag | Short | Description |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| `--version` | `-v` | Print the package version and exit |
|
|
114
|
+
| `--help` | `-h` | Print usage information and exit |
|
|
115
|
+
| `--config <path>` | `-c` | Path to config file (JSON or YAML) |
|
|
116
|
+
| `--` | | Everything after is the upstream MCP command (single-MCP mode) |
|
|
117
|
+
|
|
118
|
+
### Mode Resolution
|
|
119
|
+
|
|
120
|
+
1. If `--` is present, single-MCP mode is used (config file is ignored).
|
|
121
|
+
2. Otherwise, config file mode is used.
|
|
122
|
+
|
|
123
|
+
## Development
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm install
|
|
127
|
+
npm run build # Compile to dist/
|
|
128
|
+
npm run typecheck # Type-check without emitting
|
|
129
|
+
npm run check # Biome lint + format
|
|
130
|
+
npm test # Run tests
|
|
131
|
+
```
|