mcp-filter 0.4.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -5,6 +5,50 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.6.0] - 2025-12-02
9
+
10
+ ### Added
11
+ - **Consola Logging**: Modern CLI output with colors, icons, and semantic log levels
12
+ - `info` for startup information
13
+ - `success` for connection and ready states
14
+ - `error` for errors with actionable messages
15
+ - `fatal` for unrecoverable errors
16
+ - **Argument Validation**: Detects common JSON configuration mistakes
17
+ - Catches combined flag+pattern in single string (e.g., `"--include pattern"`)
18
+ - Catches multiple flags in single string (e.g., `"--include pattern --"`)
19
+ - LLM-friendly error messages with WRONG/CORRECT examples
20
+
21
+ ### Changed
22
+ - **README restructured** for better onboarding (490 → 189 lines)
23
+ - Replaced all `console.*` calls with `consola` logger
24
+
25
+ ## [0.5.0] - 2025-11-22
26
+
27
+ ### Added
28
+ - **Multi-Transport Support**: Filter both local and remote MCP servers
29
+ - HTTP transport for remote MCP servers (Streamable HTTP)
30
+ - SSE transport for legacy servers (deprecated, backward compatibility)
31
+ - Stdio transport for local servers (existing functionality, unchanged)
32
+ - `--upstream-url <url>` flag to connect to remote HTTP/SSE servers
33
+ - `--transport <type>` flag to explicitly specify transport type (stdio/http/sse)
34
+ - `--header <header>` flag to add custom HTTP headers (e.g., authentication)
35
+ - `--help` flag to show usage information
36
+ - Transport factory pattern for clean separation of transport logic
37
+ - HTTP transport integration tests with context7 public endpoint
38
+ - Comprehensive CLI tests for new transport options
39
+
40
+ ### Changed
41
+ - **Breaking**: `FilterConfig` now uses `transportConfig` instead of `upstreamCommand`
42
+ - Upgraded `@modelcontextprotocol/sdk` from 1.0.4 to 1.22.0
43
+ - Updated peerDependencies to require SDK >=1.10.0 (for HTTP transport)
44
+ - CLI now auto-detects transport type (HTTP for URLs, stdio for commands)
45
+ - Updated documentation with HTTP/SSE usage examples
46
+ - Reorganized codebase with new `src/types.ts` and `src/transport.ts` modules
47
+
48
+ ### Fixed
49
+ - Increased timeout for integration tests using `npx` to prevent flaky failures
50
+ - Updated architecture validation tests for new transport factory pattern
51
+
8
52
  ## [0.4.0] - 2025-10-08
9
53
 
10
54
  ### Fixed
package/README.md CHANGED
@@ -3,374 +3,185 @@
3
3
  [![npm version](https://badge.fury.io/js/mcp-filter.svg)](https://www.npmjs.com/package/mcp-filter)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- MCP server proxy to filter tools, resources, and prompts from upstream MCP servers.
6
+ Filter tools, resources, and prompts from MCP servers. Control what AI agents can access.
7
7
 
8
- ## Installation
9
-
10
- ```bash
11
- npm install -g mcp-filter
12
- # or use with npx
13
- npx mcp-filter [options] -- <upstream-command>
14
- ```
15
-
16
- ## Usage
8
+ ## Quick Start
17
9
 
18
- ### Basic Usage
19
-
20
- ```bash
21
- # Exclude mode: filter out specific tools
22
- npx mcp-filter --exclude "playwright*" -- npx @playwright/mcp
10
+ Add to your MCP client config (Claude Desktop, Cursor, etc.):
23
11
 
24
- # Include mode: only allow specific tools
25
- npx mcp-filter --include "browser_navigate" --include "browser_screenshot" -- npx @playwright/mcp
26
-
27
- # Combination: include with exceptions (order matters!)
28
- npx mcp-filter --exclude "browser_close" --include "browser_*" -- npx @playwright/mcp
29
-
30
- # Multiple patterns
31
- npx mcp-filter --exclude "playwright*" --exclude "unsafe_*" -- npx @playwright/mcp
32
-
33
- # Use with any MCP server
34
- npx mcp-filter --exclude "debug*" -- node my-mcp-server.js
12
+ ```json
13
+ {
14
+ "mcpServers": {
15
+ "playwright-safe": {
16
+ "command": "npx",
17
+ "args": [
18
+ "mcp-filter",
19
+ "--exclude", "browser_close",
20
+ "--exclude", "browser_evaluate",
21
+ "--include", "browser_*",
22
+ "--",
23
+ "npx", "@playwright/mcp@latest"
24
+ ]
25
+ }
26
+ }
27
+ }
35
28
  ```
36
29
 
37
- ## Options
38
-
39
- - `--exclude <pattern>` - Exclude tools/resources/prompts matching this pattern
40
- - `--include <pattern>` - Include ONLY tools/resources/prompts matching this pattern (whitelist mode)
41
- - `--` - Separates filter options from upstream server command
42
-
43
- Both options can be specified multiple times and combined together.
44
-
45
- **Filtering style:** rsync-style evaluation where patterns are evaluated in the order specified, and first match wins.
30
+ This allows all `browser_*` tools **except** `browser_close` and `browser_evaluate`.
46
31
 
47
- ## Filtering Modes
32
+ ## Why?
48
33
 
49
- ### Exclude Mode (--exclude only)
34
+ - **Security** - Block dangerous tools (eval, delete, admin operations)
35
+ - **Control** - Whitelist only the tools your agent needs
36
+ - **Works everywhere** - Proxy any MCP server (local or remote)
50
37
 
51
- Blocks specific items, allows everything else:
38
+ ## Installation
52
39
 
53
40
  ```bash
54
- # Block browser_close and browser_evaluate tools
55
- npx mcp-filter --exclude "browser_close" --exclude "browser_evaluate" -- npx @playwright/mcp
41
+ npx mcp-filter [options] -- <server-command>
42
+ # or install globally
43
+ npm install -g mcp-filter
56
44
  ```
57
45
 
58
- ### Include Mode (--include only)
46
+ ## How Patterns Work
59
47
 
60
- Allows ONLY specified items, blocks everything else:
48
+ Use `--include` and `--exclude` with glob patterns:
61
49
 
62
50
  ```bash
63
- # Only allow safe, read-only browser tools
64
- npx mcp-filter --include "browser_navigate" --include "browser_screenshot" -- npx @playwright/mcp
51
+ --include "browser_*" # Allow all browser_* tools
52
+ --exclude "browser_close" # Block browser_close
53
+ --exclude "delete_*" # Block all delete_* tools
65
54
  ```
66
55
 
67
- ### Combination Mode (--include + --exclude)
68
-
69
- **Rsync-style filtering**: patterns evaluated in order, first match wins.
70
-
71
- ⚠️ **Common mistake**: Putting `--include` before `--exclude` means the exclude never applies!
56
+ **Order matters!** Patterns are evaluated in order, first match wins:
72
57
 
73
58
  ```bash
74
- # Example 1: Include first, then exclude (DOES NOT WORK AS EXPECTED!)
75
- npx mcp-filter --include "browser_*" --exclude "browser_close" -- npx @playwright/mcp
76
- # Result: All browser_* tools are INCLUDED (browser_* matched first)
77
- # browser_close is also included because it matches browser_* first
78
- # The --exclude "browser_close" is never evaluated!
79
-
80
- # Example 2: Exclude first, then include (CORRECT way to exclude exceptions!)
81
- npx mcp-filter --exclude "browser_close" --include "browser_*" -- npx @playwright/mcp
82
- # Result: browser_close is EXCLUDED (matched exclude first)
83
- # Other browser_* tools are included
84
-
85
- # Example 3: Multiple exclusions, then broad include (recommended pattern)
86
- npx mcp-filter --exclude "browser_close" --exclude "browser_evaluate" --include "browser_*" -- npx @playwright/mcp
87
- # Result: browser_close and browser_evaluate excluded (matched first)
88
- # All other browser_* tools included
89
- ```
90
-
91
- **Key principle**: Order matters! The first pattern that matches determines if the item is included or excluded.
92
-
93
- ## Pattern Examples
94
-
95
- Patterns use glob syntax (via minimatch):
96
-
97
- - `playwright*` - Match all items starting with "playwright"
98
- - `*_admin` - Match all items ending with "\_admin"
99
- - `test_*_debug` - Match items with pattern in middle
100
- - `exact_name` - Match exact name
101
- - `browser_*` - Match all browser-related tools
102
- - `*` - Match everything
103
-
104
- ## Rsync-Style Filtering
59
+ # CORRECT: exclude first, then include
60
+ --exclude "browser_close" --include "browser_*"
61
+ # Result: browser_close blocked, other browser_* allowed
105
62
 
106
- mcp-filter uses rsync-style pattern evaluation:
107
-
108
- 1. **Order matters**: Patterns are evaluated in the order you specify them
109
- 2. **First match wins**: Once a pattern matches, that determines the outcome
110
- 3. **Default behavior**:
111
- - If no patterns specified: allow everything (passthrough)
112
- - If only `--include`: items not matching any include are excluded (whitelist mode)
113
- - If only `--exclude`: items not matching any exclude are included
114
- - If mixed: items not matching any pattern use whitelist mode if includes exist
115
-
116
- **Example workflow**:
117
-
118
- ```bash
119
- # Put more specific patterns first
120
- npx mcp-filter \
121
- --exclude "browser_close" \
122
- --exclude "browser_evaluate" \
123
- --include "browser_*" \
124
- -- npx @playwright/mcp
125
-
126
- # This works because:
127
- # 1. browser_close matches --exclude "browser_close" first → excluded
128
- # 2. browser_evaluate matches --exclude "browser_evaluate" first → excluded
129
- # 3. browser_navigate matches --include "browser_*" → included
130
- # 4. other_tool doesn't match any pattern, but --include exists → excluded (whitelist mode)
63
+ # WRONG: include first (exclude never matches!)
64
+ --include "browser_*" --exclude "browser_close"
65
+ # Result: ALL browser_* allowed (browser_* matches first)
131
66
  ```
132
67
 
133
- ## Using with Claude Code
68
+ ## Configuration
134
69
 
135
- ### Adding Filtered MCP Servers
70
+ ### JSON Config (Claude Desktop, Cursor, VS Code)
136
71
 
137
- Add filtered MCP servers to Claude Code using the `claude mcp add` command:
72
+ Each argument must be a **separate string** in the array:
138
73
 
139
- ```bash
140
- # Basic syntax
141
- claude mcp add <name> -- npx mcp-filter [filter-options] -- <upstream-command>
142
-
143
- # Example: Safe Playwright with read-only browser access
144
- claude mcp add playwright-safe -- \
145
- npx mcp-filter \
146
- --include "browser_navigate" \
147
- --include "browser_screenshot" \
148
- --include "browser_snapshot" \
149
- -- npx @playwright/mcp@latest
150
-
151
- # Example: Block dangerous operations
152
- claude mcp add playwright-filtered -- \
153
- npx mcp-filter \
154
- --exclude "browser_close" \
155
- --exclude "browser_evaluate" \
156
- -- npx @playwright/mcp@latest
157
-
158
- # Example: Include category with exceptions (rsync-style)
159
- claude mcp add playwright -- \
160
- npx mcp-filter \
161
- --exclude "browser_close" \
162
- --exclude "browser_evaluate" \
163
- --include "browser_*" \
164
- -- npx @playwright/mcp@latest
74
+ ```json
75
+ {
76
+ "mcpServers": {
77
+ "my-server": {
78
+ "command": "npx",
79
+ "args": [
80
+ "mcp-filter",
81
+ "--exclude", "dangerous_*",
82
+ "--include", "safe_*",
83
+ "--",
84
+ "npx", "your-mcp-server"
85
+ ]
86
+ }
87
+ }
88
+ }
165
89
  ```
166
90
 
167
- **Understanding the command structure:**
168
-
169
- - First `--` separates Claude's options from the mcp-filter command
170
- - Second `--` separates mcp-filter options from the upstream MCP server command
171
-
172
- ### Scope Options
91
+ **Config file locations:**
92
+ - Claude Desktop: `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
93
+ - Cursor: `.cursor/mcp.json` or `~/.cursor/mcp.json`
173
94
 
174
- Choose where to store the configuration:
95
+ ### CLI Usage
175
96
 
176
97
  ```bash
177
- # Local scope (default): Only you, only this project
178
- claude mcp add playwright-safe -- npx mcp-filter --include "browser_*" -- npx @playwright/mcp@latest
98
+ # Local server (stdio)
99
+ npx mcp-filter --exclude "admin_*" -- npx @playwright/mcp
179
100
 
180
- # User scope: Available across all your projects
181
- claude mcp add --scope user playwright-safe -- \
182
- npx mcp-filter --include "browser_*" -- npx @playwright/mcp@latest
101
+ # Remote server (HTTP)
102
+ npx mcp-filter --exclude "delete_*" --upstream-url https://mcp.example.com/mcp
183
103
 
184
- # Project scope: Share with team via .mcp.json (checked into git)
185
- claude mcp add --scope project playwright-safe -- \
186
- npx mcp-filter --include "browser_*" -- npx @playwright/mcp@latest
104
+ # With authentication header
105
+ npx mcp-filter --exclude "admin_*" \
106
+ --upstream-url https://api.example.com/mcp \
107
+ --header "Authorization: Bearer token"
187
108
  ```
188
109
 
189
- **Security Note**: Claude Code prompts for approval before using project-scoped servers from `.mcp.json` files. To reset approval choices, use `claude mcp reset-project-choices`.
190
-
191
- ### Managing Filtered Servers
192
-
193
- ```bash
194
- # List all configured servers
195
- claude mcp list
196
-
197
- # Get details for a specific server
198
- claude mcp get playwright-safe
110
+ ## Common Mistakes
199
111
 
200
- # Remove a server
201
- claude mcp remove playwright-safe
112
+ ### JSON args must be separate strings
202
113
 
203
- # Check server status in Claude Code
204
- /mcp
114
+ **WRONG:**
115
+ ```json
116
+ "args": ["mcp-filter", "--include browser_* --", "npx", "server"]
205
117
  ```
206
118
 
207
- ### Practical Examples
208
-
209
- **Monitoring agent (read-only)**
210
-
211
- ```bash
212
- claude mcp add browser-monitor -- \
213
- npx mcp-filter \
214
- --include "browser_navigate" \
215
- --include "browser_snapshot" \
216
- --include "browser_console_messages" \
217
- --include "browser_network_requests" \
218
- --include "browser_take_screenshot" \
219
- -- npx @playwright/mcp@latest
119
+ **CORRECT:**
120
+ ```json
121
+ "args": ["mcp-filter", "--include", "browser_*", "--", "npx", "server"]
220
122
  ```
221
123
 
222
- **Testing agent (no destructive actions)**
124
+ The shell splits arguments for you. JSON doesn't - you must split them manually.
223
125
 
224
- ```bash
225
- claude mcp add browser-test -- \
226
- npx mcp-filter \
227
- --exclude "browser_close" \
228
- --exclude "browser_tabs" \
229
- --exclude "browser_evaluate" \
230
- --include "browser_*" \
231
- -- npx @playwright/mcp@latest
232
- ```
126
+ mcp-filter detects this and shows a helpful error:
233
127
 
234
- Note: Exclude patterns must come BEFORE the include pattern to match first.
128
+ ```
129
+ Malformed argument: "--include browser_* --"
235
130
 
236
- **Production debugging (safe operations only)**
131
+ WRONG:
132
+ "args": ["--include browser_* --", ...]
237
133
 
238
- ```bash
239
- # Add as user-scoped for use across projects
240
- claude mcp add --scope user prod-debugger -- \
241
- npx mcp-filter \
242
- --exclude "browser_click" \
243
- --exclude "browser_type" \
244
- --exclude "browser_evaluate" \
245
- --exclude "browser_fill_form" \
246
- --include "browser_*" \
247
- -- npx @playwright/mcp@latest
134
+ CORRECT:
135
+ "args": ["--include", "browser_*", "--", ...]
248
136
  ```
249
137
 
250
- ### Updating Server Configuration
138
+ ### Pattern order matters
251
139
 
252
- To update filter rules, remove and re-add the server:
140
+ Put `--exclude` patterns **before** `--include` to create exceptions:
253
141
 
254
142
  ```bash
255
- # Remove existing configuration
256
- claude mcp remove playwright-safe
257
-
258
- # Add with new filter rules
259
- claude mcp add playwright-safe -- \
260
- npx mcp-filter \
261
- --include "browser_navigate" \
262
- --include "browser_screenshot" \
263
- -- npx @playwright/mcp@latest
143
+ # Block browser_close, allow other browser_* tools
144
+ --exclude "browser_close" --include "browser_*"
264
145
  ```
265
146
 
266
- ## Using with Cursor IDE
147
+ ## Options Reference
267
148
 
268
- Add to your `.cursor/mcp.json` or `~/.cursor/mcp.json`:
149
+ | Option | Description |
150
+ |--------|-------------|
151
+ | `--include <pattern>` | Include items matching pattern (whitelist) |
152
+ | `--exclude <pattern>` | Exclude items matching pattern (blocklist) |
153
+ | `--upstream-url <url>` | Connect to remote HTTP/SSE server |
154
+ | `--transport <type>` | Transport: `stdio`, `http`, `sse` (auto-detected) |
155
+ | `--header <header>` | HTTP header (format: `"Key: Value"`) |
156
+ | `--help` | Show help |
269
157
 
270
- ### Example 1: Exclude specific dangerous tools
158
+ Options can be repeated. Patterns use glob syntax via [minimatch](https://github.com/isaacs/minimatch).
271
159
 
272
- ```json
273
- {
274
- "mcpServers": {
275
- "playwright": {
276
- "command": "npx",
277
- "args": [
278
- "mcp-filter",
279
- "--exclude",
280
- "browser_close",
281
- "--exclude",
282
- "browser_evaluate",
283
- "--",
284
- "npx",
285
- "@playwright/mcp@latest"
286
- ]
287
- }
288
- }
289
- }
290
- ```
291
-
292
- ### Example 2: Include safe tools only
160
+ ## How It Works
293
161
 
294
- ```json
295
- {
296
- "mcpServers": {
297
- "playwright-safe": {
298
- "command": "npx",
299
- "args": [
300
- "mcp-filter",
301
- "--include",
302
- "browser_navigate",
303
- "--include",
304
- "browser_screenshot",
305
- "--include",
306
- "browser_snapshot",
307
- "--",
308
- "npx",
309
- "@playwright/mcp@latest"
310
- ]
311
- }
312
- }
313
- }
314
162
  ```
315
-
316
- ### Example 3: Include category with exceptions (rsync-style)
317
-
318
- ```json
319
- {
320
- "mcpServers": {
321
- "playwright-filtered": {
322
- "command": "npx",
323
- "args": [
324
- "mcp-filter",
325
- "--exclude",
326
- "browser_close",
327
- "--exclude",
328
- "browser_evaluate",
329
- "--include",
330
- "browser_*",
331
- "--",
332
- "npx",
333
- "@playwright/mcp@latest"
334
- ]
335
- }
336
- }
337
- }
163
+ MCP Client → mcp-filter → Upstream MCP Server
164
+
165
+ Filters tools/list
166
+ Blocks excluded calls
338
167
  ```
339
168
 
340
- Note: Exclude patterns come first to match before the broader include pattern.
341
-
342
- After adding the configuration, restart Cursor completely to apply the changes.
343
-
344
- ## How It Works
345
-
346
- mcp-filter acts as a proxy between an MCP client and an upstream MCP server:
347
-
348
- 1. Spawns the upstream MCP server as a subprocess
349
- 2. Connects to it as an MCP client
350
- 3. Exposes a filtered MCP server interface
351
- 4. Filters `tools/list`, `resources/list`, and `prompts/list` responses
352
- 5. Blocks calls to filtered items with error responses
169
+ 1. Proxies requests between your MCP client and upstream server
170
+ 2. Filters `tools/list`, `resources/list`, `prompts/list` responses
171
+ 3. Blocks calls to filtered items with error responses
353
172
 
354
173
  ## Development
355
174
 
356
175
  ```bash
357
- # Install dependencies
358
176
  pnpm install
359
-
360
- # Build
361
177
  pnpm run build
362
-
363
- # Run tests
364
178
  pnpm test
365
-
366
- # Test locally
367
- ./dist/index.js --exclude "playwright*" -- npx tsx test-server.ts
368
179
  ```
369
180
 
370
181
  ## Links
371
182
 
372
183
  - [npm package](https://www.npmjs.com/package/mcp-filter)
373
- - [GitHub repository](https://github.com/baranovxyz/mcp-filter)
184
+ - [GitHub](https://github.com/baranovxyz/mcp-filter)
374
185
 
375
186
  ## License
376
187
 
package/dist/cli.d.ts CHANGED
@@ -1,10 +1,3 @@
1
- export interface FilterPattern {
2
- type: "include" | "exclude";
3
- pattern: string;
4
- }
5
- export interface FilterConfig {
6
- patterns: FilterPattern[];
7
- upstreamCommand: string[];
8
- }
1
+ import { FilterConfig } from "./types.js";
9
2
  export declare function parseArgs(args: string[]): FilterConfig;
10
3
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,YAAY,CAkDtD"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAGb,MAAM,YAAY,CAAC;AAwCpB,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,YAAY,CAoKtD"}
package/dist/cli.js CHANGED
@@ -1,6 +1,43 @@
1
+ /**
2
+ * Validates arguments for common JSON configuration mistakes.
3
+ * In JSON configs, each argument must be a separate array element.
4
+ * This catches cases like ["--include pattern"] instead of ["--include", "pattern"].
5
+ */
6
+ function validateArgs(args) {
7
+ for (const arg of args) {
8
+ // Detect combined flag+value: "--include pattern" or "--exclude pattern"
9
+ if (/^--(include|exclude)\s+/.test(arg)) {
10
+ const parts = arg.split(/\s+/);
11
+ const flag = parts[0];
12
+ const pattern = parts.slice(1).join(" ");
13
+ throw new Error(`Malformed argument: "${arg}"\n\n` +
14
+ `In JSON config, each argument must be a separate string.\n\n` +
15
+ `WRONG:\n` +
16
+ ` "args": ["${arg}", ...]\n\n` +
17
+ `CORRECT:\n` +
18
+ ` "args": ["${flag}", "${pattern}", ...]\n\n` +
19
+ `Split the argument into separate array elements.`);
20
+ }
21
+ // Detect multiple flags in one string: "--include pattern --" or "--exclude foo --include bar"
22
+ if (arg.startsWith("--") && / --/.test(arg)) {
23
+ throw new Error(`Malformed argument: "${arg}"\n\n` +
24
+ `Multiple flags found in single argument. In JSON config, each must be separate.\n\n` +
25
+ `WRONG:\n` +
26
+ ` "args": ["${arg}", ...]\n\n` +
27
+ `CORRECT:\n` +
28
+ ` "args": ["--include", "pattern", "--", ...]\n\n` +
29
+ `Split into separate array elements.`);
30
+ }
31
+ }
32
+ }
1
33
  export function parseArgs(args) {
34
+ // Validate for common JSON config mistakes before parsing
35
+ validateArgs(args);
2
36
  const patterns = [];
3
37
  const upstreamCommand = [];
38
+ let upstreamUrl;
39
+ let explicitTransport;
40
+ const headers = {};
4
41
  let inUpstreamCommand = false;
5
42
  for (let i = 0; i < args.length; i++) {
6
43
  const arg = args[i];
@@ -28,14 +65,107 @@ export function parseArgs(args) {
28
65
  patterns.push({ type: "include", pattern });
29
66
  continue;
30
67
  }
68
+ if (arg === "--upstream-url") {
69
+ const url = args[++i];
70
+ if (!url) {
71
+ throw new Error("--upstream-url requires a URL argument");
72
+ }
73
+ upstreamUrl = url;
74
+ continue;
75
+ }
76
+ if (arg === "--transport") {
77
+ const transport = args[++i];
78
+ if (!transport) {
79
+ throw new Error("--transport requires a transport type argument");
80
+ }
81
+ if (transport !== "stdio" && transport !== "http" && transport !== "sse") {
82
+ throw new Error(`Invalid transport type: ${transport}. Must be one of: stdio, http, sse`);
83
+ }
84
+ explicitTransport = transport;
85
+ continue;
86
+ }
87
+ if (arg === "--header") {
88
+ const header = args[++i];
89
+ if (!header) {
90
+ throw new Error("--header requires a header value");
91
+ }
92
+ const colonIndex = header.indexOf(":");
93
+ if (colonIndex === -1) {
94
+ throw new Error(`Invalid header format: ${header}. Expected format: "Key: Value"`);
95
+ }
96
+ const key = header.slice(0, colonIndex).trim();
97
+ const value = header.slice(colonIndex + 1).trim();
98
+ headers[key] = value;
99
+ continue;
100
+ }
101
+ if (arg === "--help" || arg === "-h") {
102
+ throw new Error("help");
103
+ }
31
104
  throw new Error(`Unknown argument: ${arg}`);
32
105
  }
33
- if (upstreamCommand.length === 0) {
34
- throw new Error("No upstream command specified. Use -- to separate filter args from upstream command");
106
+ // Validate: cannot specify both URL and command
107
+ if (upstreamUrl && upstreamCommand.length > 0) {
108
+ throw new Error("Cannot specify both --upstream-url and command after --. Use one or the other.");
109
+ }
110
+ // Build transport config
111
+ let transportConfig;
112
+ if (upstreamUrl) {
113
+ // URL-based transport (http or sse)
114
+ let transportType;
115
+ if (explicitTransport) {
116
+ if (explicitTransport === "stdio") {
117
+ throw new Error("--transport stdio cannot be used with --upstream-url. Use command after -- instead.");
118
+ }
119
+ transportType = explicitTransport;
120
+ }
121
+ else {
122
+ // Auto-detect: default to http
123
+ transportType = "http";
124
+ }
125
+ // Validate URL format
126
+ try {
127
+ new URL(upstreamUrl);
128
+ }
129
+ catch (e) {
130
+ throw new Error(`Invalid URL: ${upstreamUrl}`);
131
+ }
132
+ if (transportType === "http") {
133
+ transportConfig = {
134
+ type: "http",
135
+ url: upstreamUrl,
136
+ headers: Object.keys(headers).length > 0 ? headers : undefined,
137
+ };
138
+ }
139
+ else {
140
+ transportConfig = {
141
+ type: "sse",
142
+ url: upstreamUrl,
143
+ headers: Object.keys(headers).length > 0 ? headers : undefined,
144
+ };
145
+ }
146
+ }
147
+ else if (upstreamCommand.length > 0) {
148
+ // Command-based transport (stdio)
149
+ if (explicitTransport && explicitTransport !== "stdio") {
150
+ throw new Error(`--transport ${explicitTransport} requires --upstream-url. Use --transport stdio or omit --transport for command-based servers.`);
151
+ }
152
+ if (Object.keys(headers).length > 0) {
153
+ throw new Error("--header can only be used with --upstream-url");
154
+ }
155
+ transportConfig = {
156
+ type: "stdio",
157
+ command: upstreamCommand,
158
+ env: process.env,
159
+ };
160
+ }
161
+ else {
162
+ throw new Error("No upstream server specified. Use either:\n" +
163
+ " --upstream-url <url> for HTTP/SSE servers\n" +
164
+ " -- <command> for stdio servers");
35
165
  }
36
166
  return {
37
167
  patterns,
38
- upstreamCommand,
168
+ transportConfig,
39
169
  };
40
170
  }
41
171
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,QAAQ,GAAoB,EAAE,CAAC;IACrC,MAAM,eAAe,GAAa,EAAE,CAAC;IAErC,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAE9B,KAAK,IA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AC;IACH,CAAC;SAAM,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtC,kCAAkC;QAClC,IAAI,iBAAiB,IAAI,iBAAiB,KAAK,OAAO,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CACb,eAAe,iBAAiB,gGAAgG,CACjI,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QAED,eAAe,GAAG;YAChB,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,eAAe;YACxB,GAAG,EAAE,OAAO,CAAC,GAA6B;SAC3C,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CACb,6CAA6C;YAC3C,+CAA+C;YAC/C,kCAAkC,CACrC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ;QACR,eAAe;KAChB,CAAC;AACJ,CAAC"}
package/dist/filter.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FilterPattern } from "./cli.js";
1
+ import { FilterPattern } from "./types.js";
2
2
  export declare class Filter {
3
3
  private patterns;
4
4
  private hasIncludePatterns;
@@ -1 +1 @@
1
- {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../src/filter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,qBAAa,MAAM;IAGL,OAAO,CAAC,QAAQ;IAF5B,OAAO,CAAC,kBAAkB,CAAU;gBAEhB,QAAQ,EAAE,aAAa,EAAE;IAI7C,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAepC,UAAU,CAAC,CAAC,SAAS;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE;CAGxD"}
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../src/filter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,qBAAa,MAAM;IAGL,OAAO,CAAC,QAAQ;IAF5B,OAAO,CAAC,kBAAkB,CAAU;gBAEhB,QAAQ,EAAE,aAAa,EAAE;IAI7C,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAepC,UAAU,CAAC,CAAC,SAAS;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE;CAGxD"}
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
- import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
4
3
  import { parseArgs } from "./cli.js";
5
4
  import { Filter } from "./filter.js";
5
+ import { logger } from "./logger.js";
6
6
  import { ProxyServer } from "./proxy.js";
7
+ import { createClientTransport } from "./transport.js";
7
8
  async function main() {
8
9
  // Parse command line arguments
9
10
  const args = process.argv.slice(2);
@@ -12,52 +13,69 @@ async function main() {
12
13
  config = parseArgs(args);
13
14
  }
14
15
  catch (error) {
15
- console.error(`Error: ${error.message}`);
16
- console.error("Usage: mcp-filter [--exclude <pattern>]... [--include <pattern>]... -- <upstream-command> [args...]");
17
- console.error("Examples:");
18
- console.error(' mcp-filter --exclude "playwright*" -- npx @playwright/mcp');
19
- console.error(' mcp-filter --include "browser_navigate" --include "browser_screenshot" -- npx @playwright/mcp');
20
- console.error(' mcp-filter --include "browser_*" --exclude "browser_close" -- npx @playwright/mcp');
16
+ const helpText = `Usage:
17
+ mcp-filter [options] -- <command> [args...] # stdio transport
18
+ mcp-filter [options] --upstream-url <url> # HTTP transport
19
+
20
+ Options:
21
+ --exclude <pattern> Exclude items matching pattern
22
+ --include <pattern> Include items matching pattern
23
+ --upstream-url <url> Connect to HTTP/SSE server (mutually exclusive with --)
24
+ --transport <type> Transport type: stdio, http, sse (auto-detected if omitted)
25
+ --header <header> Add HTTP header (format: 'Key: Value', HTTP/SSE only)
26
+ --help, -h Show this help message
27
+
28
+ Examples:
29
+ # Stdio transport (local servers)
30
+ mcp-filter --exclude "test*" -- npx tsx test-server.ts
31
+
32
+ # HTTP transport (remote servers)
33
+ mcp-filter --exclude "dangerous_*" --upstream-url https://mcp.notion.com/mcp
34
+
35
+ # SSE transport (deprecated, legacy servers)
36
+ mcp-filter --transport sse --upstream-url https://mcp.asana.com/sse`;
37
+ if (error.message === "help") {
38
+ logger.log(helpText);
39
+ process.exit(0);
40
+ }
41
+ logger.error(error.message);
42
+ logger.log(helpText);
21
43
  process.exit(1);
22
44
  }
23
- console.error(`Starting MCP filter with ${config.patterns.length} pattern(s)`);
24
- config.patterns.forEach((p) => console.error(` ${p.type === "include" ? "Include" : "Exclude"}: ${p.pattern}`));
45
+ logger.info(`Starting MCP filter with ${config.patterns.length} pattern(s)`);
46
+ config.patterns.forEach((p) => logger.info(` ${p.type === "include" ? "Include" : "Exclude"}: ${p.pattern}`));
25
47
  const hasInclude = config.patterns.some((p) => p.type === "include");
26
48
  const hasExclude = config.patterns.some((p) => p.type === "exclude");
27
49
  if (hasInclude && hasExclude) {
28
- console.error("Note: Using rsync-style filtering - patterns evaluated in order, first match wins.");
50
+ logger.info("Note: Using rsync-style filtering - patterns evaluated in order, first match wins.");
29
51
  }
52
+ logger.info(`Transport: ${config.transportConfig.type}`);
30
53
  // Create filter
31
54
  const filter = new Filter(config.patterns);
32
55
  // Create proxy server
33
56
  const proxy = new ProxyServer({
34
57
  name: "mcp-filter",
35
- version: "0.2.0",
58
+ version: "0.6.0",
36
59
  }, filter);
37
- // Connect client to upstream server via subprocess stdio
38
- // StdioClientTransport spawns and manages the subprocess
39
- const clientTransport = new StdioClientTransport({
40
- command: config.upstreamCommand[0],
41
- args: config.upstreamCommand.slice(1),
42
- env: process.env, // Pass current environment
43
- stderr: "inherit", // Forward upstream stderr to our stderr
44
- });
60
+ // Connect client to upstream server
61
+ // Transport factory handles creating the appropriate transport (stdio, http, sse)
62
+ const clientTransport = createClientTransport(config.transportConfig);
45
63
  await proxy.getClient().connect(clientTransport);
46
- console.error("Connected to upstream server");
64
+ logger.success("Connected to upstream server");
47
65
  // Connect server to current process stdio (for the MCP client calling us)
48
66
  const serverTransport = new StdioServerTransport();
49
67
  await proxy.getServer().connect(serverTransport);
50
- console.error("MCP filter proxy ready");
68
+ logger.success("MCP filter proxy ready");
51
69
  // Handle cleanup
52
70
  const cleanup = () => {
53
- console.error("Shutting down...");
71
+ logger.info("Shutting down...");
54
72
  process.exit(0);
55
73
  };
56
74
  process.on("SIGINT", cleanup);
57
75
  process.on("SIGTERM", cleanup);
58
76
  }
59
77
  main().catch((error) => {
60
- console.error("Fatal error:", error);
78
+ logger.fatal(error);
61
79
  process.exit(1);
62
80
  });
63
81
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnC,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,C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CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const logger: import("consola").ConsolaInstance;
2
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,mCAEjB,CAAC"}
package/dist/logger.js ADDED
@@ -0,0 +1,6 @@
1
+ import { createConsola } from "consola";
2
+ // Create logger that outputs to stderr to not interfere with MCP JSON-RPC on stdout
3
+ export const logger = createConsola({
4
+ stderr: process.stderr,
5
+ });
6
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,oFAAoF;AACpF,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC,MAAM;CACvB,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
2
+ import type { TransportConfig } from "./types.js";
3
+ /**
4
+ * Creates a client transport based on the provided configuration.
5
+ *
6
+ * @param config - The transport configuration (stdio, http, or sse)
7
+ * @returns A configured Transport instance
8
+ * @throws Error if the configuration is invalid or transport creation fails
9
+ */
10
+ export declare function createClientTransport(config: TransportConfig): Transport;
11
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAI1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAsDxE"}
@@ -0,0 +1,57 @@
1
+ import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
2
+ import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
3
+ import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
4
+ /**
5
+ * Creates a client transport based on the provided configuration.
6
+ *
7
+ * @param config - The transport configuration (stdio, http, or sse)
8
+ * @returns A configured Transport instance
9
+ * @throws Error if the configuration is invalid or transport creation fails
10
+ */
11
+ export function createClientTransport(config) {
12
+ switch (config.type) {
13
+ case "stdio": {
14
+ if (config.command.length === 0) {
15
+ throw new Error("Stdio transport requires a command");
16
+ }
17
+ return new StdioClientTransport({
18
+ command: config.command[0],
19
+ args: config.command.slice(1),
20
+ env: config.env || process.env,
21
+ stderr: "inherit",
22
+ });
23
+ }
24
+ case "http": {
25
+ let url;
26
+ try {
27
+ url = new URL(config.url);
28
+ }
29
+ catch (e) {
30
+ throw new Error(`Invalid HTTP URL: ${config.url}`);
31
+ }
32
+ // Add custom headers to requestInit if provided
33
+ const requestInit = config.headers && Object.keys(config.headers).length > 0
34
+ ? { headers: config.headers }
35
+ : undefined;
36
+ return new StreamableHTTPClientTransport(url, { requestInit });
37
+ }
38
+ case "sse": {
39
+ console.warn("⚠️ WARNING: SSE transport is deprecated as of protocol version 2024-11-05. " +
40
+ "Consider using HTTP transport instead for better performance and compatibility.");
41
+ let url;
42
+ try {
43
+ url = new URL(config.url);
44
+ }
45
+ catch (e) {
46
+ throw new Error(`Invalid SSE URL: ${config.url}`);
47
+ }
48
+ return new SSEClientTransport(url);
49
+ }
50
+ default: {
51
+ // TypeScript exhaustiveness check
52
+ const _exhaustive = config;
53
+ throw new Error(`Unknown transport type: ${_exhaustive.type}`);
54
+ }
55
+ }
56
+ }
57
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAGnG;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAuB;IAC3D,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAChC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;YACxD,CAAC;YAED,OAAO,IAAI,oBAAoB,CAAC;gBAC9B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC1B,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC7B,GAAG,EAAE,MAAM,CAAC,GAAG,IAAK,OAAO,CAAC,GAA8B;gBAC1D,MAAM,EAAE,SAAS;aAClB,CAAC,CAAC;QACL,CAAC;QAED,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,IAAI,GAAQ,CAAC;YACb,IAAI,CAAC;gBACH,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,qBAAqB,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;YACrD,CAAC;YAED,gDAAgD;YAChD,MAAM,WAAW,GACf,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC;gBACtD,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;gBAC7B,CAAC,CAAC,SAAS,CAAC;YAEhB,OAAO,IAAI,6BAA6B,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QACjE,CAAC;QAED,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,OAAO,CAAC,IAAI,CACV,8EAA8E;gBAC5E,iFAAiF,CACpF,CAAC;YAEF,IAAI,GAAQ,CAAC;YACb,IAAI,CAAC;gBACH,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;YACpD,CAAC;YAED,OAAO,IAAI,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACR,kCAAkC;YAClC,MAAM,WAAW,GAAU,MAAM,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,2BAA4B,WAAmB,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,26 @@
1
+ export interface FilterPattern {
2
+ type: "include" | "exclude";
3
+ pattern: string;
4
+ }
5
+ export type TransportType = "stdio" | "http" | "sse";
6
+ export interface StdioConfig {
7
+ type: "stdio";
8
+ command: string[];
9
+ env?: Record<string, string>;
10
+ }
11
+ export interface HttpConfig {
12
+ type: "http";
13
+ url: string;
14
+ headers?: Record<string, string>;
15
+ }
16
+ export interface SseConfig {
17
+ type: "sse";
18
+ url: string;
19
+ headers?: Record<string, string>;
20
+ }
21
+ export type TransportConfig = StdioConfig | HttpConfig | SseConfig;
22
+ export interface FilterConfig {
23
+ patterns: FilterPattern[];
24
+ transportConfig: TransportConfig;
25
+ }
26
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAErD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;AAEnE,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,eAAe,EAAE,eAAe,CAAC;CAClC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-filter",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "MCP server proxy to filter tools, resources, and prompts from upstream MCP servers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,6 +12,14 @@
12
12
  "CHANGELOG.md",
13
13
  "LICENSE"
14
14
  ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "dev": "tsc --watch",
18
+ "test": "vitest run",
19
+ "test:watch": "vitest --watch",
20
+ "test:coverage": "vitest --coverage",
21
+ "prepublishOnly": "pnpm test && pnpm run build"
22
+ },
15
23
  "keywords": [
16
24
  "mcp",
17
25
  "model-context-protocol",
@@ -29,13 +37,14 @@
29
37
  "url": "https://github.com/baranovxyz/mcp-filter/issues"
30
38
  },
31
39
  "dependencies": {
40
+ "consola": "3.4.2",
32
41
  "minimatch": "10.0.1"
33
42
  },
34
43
  "peerDependencies": {
35
- "@modelcontextprotocol/sdk": "1.0.0"
44
+ "@modelcontextprotocol/sdk": ">=1.10.0"
36
45
  },
37
46
  "devDependencies": {
38
- "@modelcontextprotocol/sdk": "1.0.4",
47
+ "@modelcontextprotocol/sdk": "1.22.0",
39
48
  "@types/node": "22.10.5",
40
49
  "@vitest/coverage-v8": "2.1.8",
41
50
  "typescript": "5.7.3",
@@ -44,12 +53,5 @@
44
53
  },
45
54
  "engines": {
46
55
  "node": ">=18"
47
- },
48
- "scripts": {
49
- "build": "tsc",
50
- "dev": "tsc --watch",
51
- "test": "vitest run",
52
- "test:watch": "vitest --watch",
53
- "test:coverage": "vitest --coverage"
54
56
  }
55
- }
57
+ }