mcp-filter 0.3.0 → 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/CHANGELOG.md +47 -0
- package/dist/index.js +3 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.4.0] - 2025-10-08
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fixed connection failures caused by double-spawning upstream MCP server subprocess
|
|
12
|
+
- Fixed "command not found" errors with `npx` by properly passing environment variables
|
|
13
|
+
- Fixed stderr forwarding from upstream servers
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- Delegated subprocess management entirely to `StdioClientTransport` (breaking change in internal architecture)
|
|
17
|
+
- Improved error forwarding by using `stderr: "inherit"` instead of `"pipe"`
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
- Comprehensive integration tests for subprocess management and real-world MCP server compatibility
|
|
21
|
+
- Architecture validation tests to prevent regression of subprocess spawning anti-patterns
|
|
22
|
+
- Debugging guide for common MCP communication issues in CLAUDE.md
|
|
23
|
+
- ADR-003 documenting subprocess delegation pattern
|
|
24
|
+
- Claude Code configuration with custom slash commands
|
|
25
|
+
|
|
26
|
+
## [0.3.0] - 2025-01-XX
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- Rsync-style pattern evaluation (first match wins)
|
|
30
|
+
- Support for both `--include` and `--exclude` patterns
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- Pattern matching now evaluates in order with first-match-wins semantics
|
|
34
|
+
|
|
35
|
+
## [0.2.0] - 2025-01-XX
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
- Comprehensive documentation updates
|
|
39
|
+
- Testing infrastructure with Vitest
|
|
40
|
+
|
|
41
|
+
## [0.1.0] - 2025-01-XX
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
- Initial release
|
|
45
|
+
- Basic MCP proxy server with pattern-based filtering
|
|
46
|
+
- Support for filtering tools, resources, and prompts
|
|
47
|
+
- Glob pattern matching using minimatch
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { spawn } from "child_process";
|
|
3
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
3
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
5
4
|
import { parseArgs } from "./cli.js";
|
|
@@ -28,8 +27,6 @@ async function main() {
|
|
|
28
27
|
if (hasInclude && hasExclude) {
|
|
29
28
|
console.error("Note: Using rsync-style filtering - patterns evaluated in order, first match wins.");
|
|
30
29
|
}
|
|
31
|
-
// Spawn upstream server
|
|
32
|
-
const upstreamProcess = spawnUpstream(config.upstreamCommand);
|
|
33
30
|
// Create filter
|
|
34
31
|
const filter = new Filter(config.patterns);
|
|
35
32
|
// Create proxy server
|
|
@@ -38,10 +35,12 @@ async function main() {
|
|
|
38
35
|
version: "0.2.0",
|
|
39
36
|
}, filter);
|
|
40
37
|
// Connect client to upstream server via subprocess stdio
|
|
38
|
+
// StdioClientTransport spawns and manages the subprocess
|
|
41
39
|
const clientTransport = new StdioClientTransport({
|
|
42
40
|
command: config.upstreamCommand[0],
|
|
43
41
|
args: config.upstreamCommand.slice(1),
|
|
44
|
-
|
|
42
|
+
env: process.env, // Pass current environment
|
|
43
|
+
stderr: "inherit", // Forward upstream stderr to our stderr
|
|
45
44
|
});
|
|
46
45
|
await proxy.getClient().connect(clientTransport);
|
|
47
46
|
console.error("Connected to upstream server");
|
|
@@ -52,31 +51,11 @@ async function main() {
|
|
|
52
51
|
// Handle cleanup
|
|
53
52
|
const cleanup = () => {
|
|
54
53
|
console.error("Shutting down...");
|
|
55
|
-
upstreamProcess.kill();
|
|
56
54
|
process.exit(0);
|
|
57
55
|
};
|
|
58
56
|
process.on("SIGINT", cleanup);
|
|
59
57
|
process.on("SIGTERM", cleanup);
|
|
60
58
|
}
|
|
61
|
-
function spawnUpstream(command) {
|
|
62
|
-
const [cmd, ...args] = command;
|
|
63
|
-
const proc = spawn(cmd, args, {
|
|
64
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
65
|
-
});
|
|
66
|
-
// Forward stderr to our stderr
|
|
67
|
-
proc.stderr.on("data", (data) => {
|
|
68
|
-
process.stderr.write(data);
|
|
69
|
-
});
|
|
70
|
-
proc.on("error", (error) => {
|
|
71
|
-
console.error(`Failed to start upstream server: ${error.message}`);
|
|
72
|
-
process.exit(1);
|
|
73
|
-
});
|
|
74
|
-
proc.on("exit", (code) => {
|
|
75
|
-
console.error(`Upstream server exited with code ${code}`);
|
|
76
|
-
process.exit(code || 0);
|
|
77
|
-
});
|
|
78
|
-
return proc;
|
|
79
|
-
}
|
|
80
59
|
main().catch((error) => {
|
|
81
60
|
console.error("Fatal error:", error);
|
|
82
61
|
process.exit(1);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,
|
|
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,WA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;AACjC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-filter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "MCP server proxy to filter tools, resources, and prompts from upstream MCP servers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md",
|
|
12
|
+
"CHANGELOG.md",
|
|
12
13
|
"LICENSE"
|
|
13
14
|
],
|
|
14
15
|
"keywords": [
|