@modelcontextprotocol/server-everything 2.3.0 → 2.3.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 CHANGED
@@ -17,7 +17,7 @@ The resource collections (`demo://resource/collection/summer-specials`, and the
17
17
 
18
18
  The server info and every tool, prompt, resource and resource template carry a pair of [icons](docs/features.md#icons), one for a light theme and one for a dark theme, so a client can show the variant that suits its own background.
19
19
 
20
- The `get-env` tool returns the server's environment variables, but masks the value of any credential-like name (a `KEY`, `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `CREDENTIAL`, `AUTH` or `COOKIE` segment, such as `OPENAI_API_KEY`) as `"<redacted>"`. To see every value unmasked while debugging, start the server with `GET_ENV_INCLUDE_SECRETS=1` (or `true`). Leave it unset otherwise: with it set, every credential in the server's environment reaches the model's context.
20
+ The `get-env` tool returns the server's environment variables, but masks the value of any credential-like name (one with a `KEY`, `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `CREDENTIAL`, `AUTH` or `COOKIE` segment between underscores, in any case: whole segments, not substrings, so `OPENAI_API_KEY` is masked and `APIKEY` is not) as `"<redacted>"`. To see every value unmasked while debugging, start the server with `GET_ENV_INCLUDE_SECRETS=1` (or `true`). Leave it unset otherwise: with it set, every credential in the server's environment reaches the model's context.
21
21
 
22
22
  ## Protocol versions
23
23
 
@@ -39,7 +39,7 @@ The `gzip-file-as-resource` tool fetches the URL it is given, so these environme
39
39
  | `GZIP_ALLOWED_DOMAINS` | empty (any name) | Comma-separated host names; a host must be one of them or a subdomain of one. Checked on the caller's URL and on every redirect hop |
40
40
  | `GZIP_ALLOW_PRIVATE_IPS` | off | Set to `1` or `true` to allow loopback, private (RFC 1918), CGNAT, link-local (cloud metadata) and other non-public addresses |
41
41
 
42
- By default the tool refuses a URL whose host resolves to a non-public address, and follows at most five redirects, checking each hop the same way. `GZIP_ALLOWED_DOMAINS` filters names, not addresses: a listed name that resolves to a private address is still refused unless `GZIP_ALLOW_PRIVATE_IPS` is set. The address is checked before the request and resolved again when it is made, so a DNS answer that changes in between (DNS rebinding) is not caught. `data:` URLs are not fetched, so neither check applies to them.
42
+ By default the tool refuses a URL whose host resolves to a non-public address, and follows at most five redirects, checking each hop the same way. An IPv6 address that wraps an IPv4 one (IPv4-mapped, IPv4-translated, or in the NAT64 prefix `64:ff9b::/96`) is judged by that IPv4, and any other IPv6 address outside global unicast (`2000::/3`) is refused. `GZIP_ALLOWED_DOMAINS` filters names, not addresses: a listed name that resolves to a private address is still refused unless `GZIP_ALLOW_PRIVATE_IPS` is set. The address is checked before the request and resolved again when it is made, so a DNS answer that changes in between (DNS rebinding) is not caught. `data:` URLs are not fetched, so neither check applies to them.
43
43
 
44
44
  ## Requirements
45
45
 
@@ -45,9 +45,9 @@ const MAX_REDIRECTS = 5;
45
45
  const REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);
46
46
  // Addresses that are not public destinations: the IANA special-purpose ranges
47
47
  // the fetch server refuses (src/fetch's _NON_PUBLIC_NETWORKS), plus
48
- // multicast. BlockList judges an IPv4-mapped IPv6 address (::ffff:a.b.c.d) by
49
- // the IPv4 rules, so those need no ranges of their own. The well-known NAT64
50
- // prefix (64:ff9b::/96) is not unwrapped and so passes as public.
48
+ // multicast. An IPv6 address that carries an IPv4 destination is unwrapped
49
+ // and judged by that IPv4 first (see IPV4_CARRIERS), so these ranges need no
50
+ // IPv6 copies of the IPv4 ones.
51
51
  const NON_PUBLIC_ADDRESSES = new BlockList();
52
52
  for (const [network, prefix] of [
53
53
  ["0.0.0.0", 8], // "this network", including the unspecified address
@@ -69,15 +69,20 @@ for (const [network, prefix] of [
69
69
  NON_PUBLIC_ADDRESSES.addSubnet(network, prefix, "ipv4");
70
70
  }
71
71
  for (const [network, prefix] of [
72
- ["::", 128], // unspecified
73
- ["::1", 128], // loopback
72
+ // IPv4-compatible IPv6 (RFC 4291 2.5.5.1), deprecated and never routed;
73
+ // it also holds the unspecified (::) and loopback (::1) addresses.
74
+ ["::", 96],
74
75
  ["64:ff9b:1::", 48], // local-use NAT64
75
76
  ["100::", 64], // discard-only
76
77
  ["2001::", 23], // IETF protocol assignments (Teredo among them)
77
78
  ["2001:db8::", 32], // documentation
78
79
  ["2002::", 16], // 6to4
80
+ ["3fff::", 20], // documentation (RFC 9637)
79
81
  ["fc00::", 7], // unique local (AWS's fd00:ec2::254)
80
82
  ["fe80::", 10], // link-local
83
+ // Deprecated site-local (RFC 3879). Outside 2000::/3 as well, but listed so
84
+ // it is refused by name.
85
+ ["fec0::", 10],
81
86
  ["ff00::", 8], // multicast
82
87
  ]) {
83
88
  NON_PUBLIC_ADDRESSES.addSubnet(network, prefix, "ipv6");
@@ -97,11 +102,56 @@ for (const [network, prefix] of [
97
102
  ]) {
98
103
  PUBLIC_EXCEPTIONS.addSubnet(network, prefix, "ipv6");
99
104
  }
105
+ // IPv6 ranges whose low 32 bits are the IPv4 destination: IPv4-mapped
106
+ // (::ffff:0:0/96), IPv4-translated (RFC 6145, ::ffff:0:0:0/96), which a
107
+ // stateless translator forwards to that IPv4, and the well-known NAT64 prefix
108
+ // (RFC 6052, 64:ff9b::/96), which a NAT64 gateway forwards to it. An address
109
+ // in one is judged by the IPv4 it wraps, as the fetch server judges it, so a
110
+ // public IPv4 stays reachable through NAT64 and a private one is refused.
111
+ const IPV4_CARRIERS = new BlockList();
112
+ for (const network of ["::ffff:0:0", "::ffff:0:0:0", "64:ff9b::"]) {
113
+ IPV4_CARRIERS.addSubnet(network, 96, "ipv6");
114
+ }
115
+ // IPv6 global unicast (RFC 4291 2.4). The rest of the IPv6 space is reserved,
116
+ // unique or site-local, link-local or multicast, none of it a public
117
+ // destination, so an IPv6 address outside it is refused: a range missing from
118
+ // NON_PUBLIC_ADDRESSES cannot pass as public.
119
+ const IPV6_GLOBAL_UNICAST = new BlockList();
120
+ IPV6_GLOBAL_UNICAST.addSubnet("2000::", 3, "ipv6");
121
+ /**
122
+ * The IPv4 address held in the low 32 bits of a valid IPv6 address, as
123
+ * dotted quad.
124
+ */
125
+ function lowIPv4(address) {
126
+ // A resolver may spell those bits as a trailing dotted quad (::ffff:1.2.3.4)
127
+ const tail = address.slice(address.lastIndexOf(":") + 1);
128
+ if (tail.includes("."))
129
+ return tail;
130
+ const [head, rest] = address.split("::");
131
+ const groups = rest === undefined
132
+ ? head.split(":")
133
+ : [
134
+ ...(head ? head.split(":") : []),
135
+ ...Array(8).fill("0"),
136
+ ...(rest ? rest.split(":") : []),
137
+ ].slice(-8);
138
+ const high = parseInt(groups[6], 16);
139
+ const low = parseInt(groups[7], 16);
140
+ return [high >> 8, high & 255, low >> 8, low & 255].join(".");
141
+ }
100
142
  /** True when `address` is not a public destination. */
101
- function isNonPublic(address, family) {
102
- const type = family === 6 ? "ipv6" : "ipv4";
103
- return (!PUBLIC_EXCEPTIONS.check(address, type) &&
104
- NON_PUBLIC_ADDRESSES.check(address, type));
143
+ export function isNonPublic(address, family) {
144
+ if (family !== 6) {
145
+ return (!PUBLIC_EXCEPTIONS.check(address, "ipv4") &&
146
+ NON_PUBLIC_ADDRESSES.check(address, "ipv4"));
147
+ }
148
+ if (IPV4_CARRIERS.check(address, "ipv6")) {
149
+ return isNonPublic(lowIPv4(address), 4);
150
+ }
151
+ if (PUBLIC_EXCEPTIONS.check(address, "ipv6"))
152
+ return false;
153
+ return (NON_PUBLIC_ADDRESSES.check(address, "ipv6") ||
154
+ !IPV6_GLOBAL_UNICAST.check(address, "ipv6"));
105
155
  }
106
156
  /**
107
157
  * Settles as `promise` does, or rejects with the signal's reason as soon as it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelcontextprotocol/server-everything",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "MCP server that exercises all the features of the MCP protocol",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "mcpName": "io.github.modelcontextprotocol/server-everything",