mcp-xray-pilot 0.10.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.
Files changed (153) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +502 -0
  3. package/data/docs/_index.json +533 -0
  4. package/data/docs/basic__api.md +148 -0
  5. package/data/docs/basic__dns.md +366 -0
  6. package/data/docs/basic__fakedns.md +202 -0
  7. package/data/docs/basic__geodata.md +64 -0
  8. package/data/docs/basic__inbound.md +159 -0
  9. package/data/docs/basic__index.md +136 -0
  10. package/data/docs/basic__log.md +67 -0
  11. package/data/docs/basic__metrics.md +262 -0
  12. package/data/docs/basic__observatory.md +115 -0
  13. package/data/docs/basic__outbound.md +164 -0
  14. package/data/docs/basic__policy.md +140 -0
  15. package/data/docs/basic__reverse.md +268 -0
  16. package/data/docs/basic__routing.md +474 -0
  17. package/data/docs/basic__stats.md +61 -0
  18. package/data/docs/basic__transport.md +1283 -0
  19. package/data/docs/features__features_browser_dialer.md +61 -0
  20. package/data/docs/features__features_env.md +66 -0
  21. package/data/docs/features__features_fallback.md +110 -0
  22. package/data/docs/features__features_index.md +17 -0
  23. package/data/docs/features__features_multiple.md +144 -0
  24. package/data/docs/features__features_xtls.md +13 -0
  25. package/data/docs/inbounds__inbounds_dokodemo.md +11 -0
  26. package/data/docs/inbounds__inbounds_http.md +80 -0
  27. package/data/docs/inbounds__inbounds_hysteria.md +60 -0
  28. package/data/docs/inbounds__inbounds_index.md +22 -0
  29. package/data/docs/inbounds__inbounds_shadowsocks.md +118 -0
  30. package/data/docs/inbounds__inbounds_socks.md +87 -0
  31. package/data/docs/inbounds__inbounds_trojan.md +78 -0
  32. package/data/docs/inbounds__inbounds_tun.md +47 -0
  33. package/data/docs/inbounds__inbounds_tunnel.md +86 -0
  34. package/data/docs/inbounds__inbounds_vless.md +135 -0
  35. package/data/docs/inbounds__inbounds_vmess.md +95 -0
  36. package/data/docs/inbounds__inbounds_wireguard.md +78 -0
  37. package/data/docs/outbounds__outbounds_blackhole.md +42 -0
  38. package/data/docs/outbounds__outbounds_dns.md +97 -0
  39. package/data/docs/outbounds__outbounds_freedom.md +170 -0
  40. package/data/docs/outbounds__outbounds_http.md +70 -0
  41. package/data/docs/outbounds__outbounds_hysteria.md +39 -0
  42. package/data/docs/outbounds__outbounds_index.md +24 -0
  43. package/data/docs/outbounds__outbounds_loopback.md +65 -0
  44. package/data/docs/outbounds__outbounds_shadowsocks.md +105 -0
  45. package/data/docs/outbounds__outbounds_socks.md +58 -0
  46. package/data/docs/outbounds__outbounds_trojan.md +49 -0
  47. package/data/docs/outbounds__outbounds_vless.md +122 -0
  48. package/data/docs/outbounds__outbounds_vmess.md +76 -0
  49. package/data/docs/outbounds__outbounds_wireguard.md +141 -0
  50. package/data/docs/transports__transports_grpc.md +137 -0
  51. package/data/docs/transports__transports_h2.md +11 -0
  52. package/data/docs/transports__transports_http.md +11 -0
  53. package/data/docs/transports__transports_httpupgrade.md +61 -0
  54. package/data/docs/transports__transports_hysteria.md +110 -0
  55. package/data/docs/transports__transports_index.md +19 -0
  56. package/data/docs/transports__transports_mkcp.md +125 -0
  57. package/data/docs/transports__transports_quic.md +11 -0
  58. package/data/docs/transports__transports_raw.md +156 -0
  59. package/data/docs/transports__transports_splithttp.md +11 -0
  60. package/data/docs/transports__transports_tcp.md +11 -0
  61. package/data/docs/transports__transports_websocket.md +75 -0
  62. package/data/docs/transports__transports_xhttp.md +11 -0
  63. package/dist/data/compatibility.js +170 -0
  64. package/dist/data/compatibility.js.map +1 -0
  65. package/dist/data/geocatalogue.js +191 -0
  66. package/dist/data/geocatalogue.js.map +1 -0
  67. package/dist/docs.js +339 -0
  68. package/dist/docs.js.map +1 -0
  69. package/dist/handlers.js +217 -0
  70. package/dist/handlers.js.map +1 -0
  71. package/dist/index.js +66 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/lint.js +737 -0
  74. package/dist/lint.js.map +1 -0
  75. package/dist/schemas/protocols/blackhole.js +16 -0
  76. package/dist/schemas/protocols/blackhole.js.map +1 -0
  77. package/dist/schemas/protocols/common.js +32 -0
  78. package/dist/schemas/protocols/common.js.map +1 -0
  79. package/dist/schemas/protocols/dns.js +14 -0
  80. package/dist/schemas/protocols/dns.js.map +1 -0
  81. package/dist/schemas/protocols/dokodemo.js +17 -0
  82. package/dist/schemas/protocols/dokodemo.js.map +1 -0
  83. package/dist/schemas/protocols/freedom.js +45 -0
  84. package/dist/schemas/protocols/freedom.js.map +1 -0
  85. package/dist/schemas/protocols/http.js +38 -0
  86. package/dist/schemas/protocols/http.js.map +1 -0
  87. package/dist/schemas/protocols/hysteria.js +51 -0
  88. package/dist/schemas/protocols/hysteria.js.map +1 -0
  89. package/dist/schemas/protocols/index.js +50 -0
  90. package/dist/schemas/protocols/index.js.map +1 -0
  91. package/dist/schemas/protocols/loopback.js +11 -0
  92. package/dist/schemas/protocols/loopback.js.map +1 -0
  93. package/dist/schemas/protocols/shadowsocks.js +60 -0
  94. package/dist/schemas/protocols/shadowsocks.js.map +1 -0
  95. package/dist/schemas/protocols/socks.js +42 -0
  96. package/dist/schemas/protocols/socks.js.map +1 -0
  97. package/dist/schemas/protocols/trojan.js +34 -0
  98. package/dist/schemas/protocols/trojan.js.map +1 -0
  99. package/dist/schemas/protocols/tun.js +19 -0
  100. package/dist/schemas/protocols/tun.js.map +1 -0
  101. package/dist/schemas/protocols/vless.js +44 -0
  102. package/dist/schemas/protocols/vless.js.map +1 -0
  103. package/dist/schemas/protocols/vmess.js +48 -0
  104. package/dist/schemas/protocols/vmess.js.map +1 -0
  105. package/dist/schemas/protocols/wireguard.js +34 -0
  106. package/dist/schemas/protocols/wireguard.js.map +1 -0
  107. package/dist/schemas/security/index.js +16 -0
  108. package/dist/schemas/security/index.js.map +1 -0
  109. package/dist/schemas/security/reality.js +35 -0
  110. package/dist/schemas/security/reality.js.map +1 -0
  111. package/dist/schemas/security/tls.js +46 -0
  112. package/dist/schemas/security/tls.js.map +1 -0
  113. package/dist/schemas/security/xtls.js +17 -0
  114. package/dist/schemas/security/xtls.js.map +1 -0
  115. package/dist/schemas/transports/grpc.js +18 -0
  116. package/dist/schemas/transports/grpc.js.map +1 -0
  117. package/dist/schemas/transports/httpupgrade.js +14 -0
  118. package/dist/schemas/transports/httpupgrade.js.map +1 -0
  119. package/dist/schemas/transports/hysteria.js +25 -0
  120. package/dist/schemas/transports/hysteria.js.map +1 -0
  121. package/dist/schemas/transports/index.js +32 -0
  122. package/dist/schemas/transports/index.js.map +1 -0
  123. package/dist/schemas/transports/mkcp.js +34 -0
  124. package/dist/schemas/transports/mkcp.js.map +1 -0
  125. package/dist/schemas/transports/raw.js +19 -0
  126. package/dist/schemas/transports/raw.js.map +1 -0
  127. package/dist/schemas/transports/websocket.js +15 -0
  128. package/dist/schemas/transports/websocket.js.map +1 -0
  129. package/dist/schemas/transports/xhttp.js +34 -0
  130. package/dist/schemas/transports/xhttp.js.map +1 -0
  131. package/dist/search.js +78 -0
  132. package/dist/search.js.map +1 -0
  133. package/dist/state.js +87 -0
  134. package/dist/state.js.map +1 -0
  135. package/dist/tools.js +274 -0
  136. package/dist/tools.js.map +1 -0
  137. package/dist/tools_impl/diff.js +55 -0
  138. package/dist/tools_impl/diff.js.map +1 -0
  139. package/dist/tools_impl/github.js +416 -0
  140. package/dist/tools_impl/github.js.map +1 -0
  141. package/dist/tools_impl/merge.js +181 -0
  142. package/dist/tools_impl/merge.js.map +1 -0
  143. package/dist/tools_impl/refresh.js +46 -0
  144. package/dist/tools_impl/refresh.js.map +1 -0
  145. package/dist/tools_impl/suggest.js +169 -0
  146. package/dist/tools_impl/suggest.js.map +1 -0
  147. package/dist/types.js +10 -0
  148. package/dist/types.js.map +1 -0
  149. package/dist/utils.js +81 -0
  150. package/dist/utils.js.map +1 -0
  151. package/dist/validate.js +408 -0
  152. package/dist/validate.js.map +1 -0
  153. package/package.json +62 -0
@@ -0,0 +1,268 @@
1
+ ---
2
+ url: https://xtls.github.io/en/config/reverse.html
3
+ source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/reverse.md
4
+ title: Reverse Proxy
5
+ category: basic
6
+ slug: reverse
7
+ fetched_at: 2026-05-04T18:42:41.609Z
8
+ ---
9
+ # Reverse Proxy
10
+
11
+ A reverse proxy can forward traffic from the server side to the client side, effectively performing reverse traffic forwarding.
12
+
13
+ ::: tip
14
+ This reverse proxy is a general-purpose reverse proxy (it does not limit the proxy protocol type). The configuration is more complex. Do not confuse it with the VLESS simplified reverse configuration (refer to the relevant sections in the VLESS inbound/outbound documentation).
15
+ :::
16
+
17
+ Its underlying protocol is Mux.cool, but the direction is reversed: the server initiates requests to the client.
18
+
19
+ The general working principle of the reverse proxy is as follows:
20
+
21
+ - Assume there is a web server on Host A. This host does not have a public IP and cannot be accessed directly from the public internet. There is another Host B, which is accessible from the public internet. We need to use B as the entry point to forward traffic from B to A.
22
+ - Configure Xray on Host B to receive external requests; this is called the `portal`.
23
+ - Configure Xray on Host A to bridge the forwarding from B to the web server; this is called the `bridge`.
24
+
25
+ - `bridge`
26
+ - The `bridge` actively establishes a connection to the `portal` to register a reverse tunnel. The destination address (domain) of this connection can be defined by the user.
27
+ - After receiving public traffic forwarded by the `portal`, the `bridge` sends it intact to the web server on Host A. Naturally, this step requires configuration in the routing module.
28
+ - Upon receiving a response, the `bridge` returns the response intact to the `portal`.
29
+
30
+ - `portal`
31
+ - If the `portal` receives a request and the domain matches, it indicates response data sent by the `bridge`. This connection will be used to establish the reverse tunnel.
32
+ - If the `portal` receives a request and the domain does _not_ match, it indicates a connection from a public user. This connection data will be forwarded to the bridge.
33
+
34
+ - The `bridge` performs dynamic load balancing based on traffic volume.
35
+
36
+ ::: tip
37
+ As mentioned above, the reverse proxy has [Mux](../development/protocols/muxcool.md) enabled by default. Please do not enable Mux again on the outbounds used by it.
38
+ :::
39
+
40
+ ::: warning
41
+ The reverse proxy function is currently in the testing stage and may have some issues.
42
+ :::
43
+
44
+ ## ReverseObject
45
+
46
+ `ReverseObject` corresponds to the `reverse` item in the configuration file.
47
+
48
+ ```json
49
+ {
50
+ "reverse": {
51
+ "bridges": [
52
+ {
53
+ "tag": "bridge",
54
+ "domain": "reverse-proxy.xray.internal"
55
+ }
56
+ ],
57
+ "portals": [
58
+ {
59
+ "tag": "portal",
60
+ "domain": "reverse-proxy.xray.internal"
61
+ }
62
+ ]
63
+ }
64
+ }
65
+ ```
66
+
67
+ > `bridges`: \[[BridgeObject](#bridgeobject)\]
68
+
69
+ An array, where each item represents a `bridge`. The configuration for each `bridge` is a [BridgeObject](#bridgeobject).
70
+
71
+ > `portals`: \[[PortalObject](#portalobject)\]
72
+
73
+ An array, where each item represents a `portal`. The configuration for each `portal` is a [PortalObject](#bridgeobject).
74
+
75
+ ### BridgeObject
76
+
77
+ ```json
78
+ {
79
+ "tag": "bridge",
80
+ "domain": "reverse-proxy.xray.internal"
81
+ }
82
+ ```
83
+
84
+ > `tag`: string
85
+
86
+ All connections initiated by the `bridge` will carry this tag. It can be identified using `inboundTag` in the [Routing Configuration](./routing.md).
87
+
88
+ > `domain`: string
89
+
90
+ Specifies a domain name. Connections established by the `bridge` to the `portal` will be sent using this domain.
91
+ This domain is used solely for communication between the `bridge` and the `portal` and does not need to exist in reality.
92
+
93
+ ### PortalObject
94
+
95
+ ```json
96
+ {
97
+ "tag": "portal",
98
+ "domain": "reverse-proxy.xray.internal"
99
+ }
100
+ ```
101
+
102
+ > `tag`: string
103
+
104
+ The identifier for the `portal`. Use `outboundTag` in the [Routing Configuration](./routing.md) to forward traffic to this `portal`.
105
+
106
+ > `domain`: string
107
+
108
+ A domain name. When the `portal` receives traffic, if the target domain of the traffic matches this domain, the `portal` considers the current connection to be a communication connection sent by the `bridge`. Other traffic will be treated as traffic that needs to be forwarded. The job of the `portal` is to identify these two types of connections and perform the corresponding forwarding.
109
+
110
+ ::: tip
111
+ A single Xray instance can act as a `bridge`, a `portal`, or both simultaneously to suit different scenario requirements.
112
+ :::
113
+
114
+ ## Complete Configuration Example
115
+
116
+ ::: tip
117
+ During operation, it is recommended to enable the `bridge` first, and then enable the `portal`.
118
+ :::
119
+
120
+ ### Bridge Configuration
121
+
122
+ The `bridge` usually requires two outbounds: one for connecting to the `portal` and another for sending actual traffic. This means you need to use routing to distinguish between the two types of traffic.
123
+
124
+ Reverse Proxy Configuration:
125
+
126
+ ```json
127
+ "reverse": {
128
+ "bridges": [
129
+ {
130
+ "tag": "bridge",
131
+ "domain": "reverse-proxy.xray.internal"
132
+ }
133
+ ]
134
+ }
135
+ ```
136
+
137
+ Outbounds:
138
+
139
+ ```json
140
+ {
141
+ // Forward to web server
142
+ "tag": "out",
143
+ "protocol": "freedom",
144
+ "settings": {
145
+ "redirect": "127.0.0.1:80",
146
+ // Allow only TCP 127.0.0.1:80 and block all other targets
147
+ "finalRules": [
148
+ {
149
+ "action": "allow",
150
+ "network": "tcp",
151
+ "port": 80,
152
+ "ip": ["127.0.0.1/32"]
153
+ },
154
+ {
155
+ "action": "block"
156
+ }
157
+ ]
158
+ }
159
+ }
160
+ ```
161
+
162
+ ```json
163
+ {
164
+ // Connect to portal
165
+ "protocol": "vmess",
166
+ "settings": {
167
+ "address": "IP Address of Portal",
168
+ "port": 1024,
169
+ "id": "5783a3e7-e373-51cd-8642-c83782b807c5"
170
+ },
171
+ "tag": "interconn"
172
+ }
173
+ ```
174
+
175
+ Routing Configuration:
176
+
177
+ ```json
178
+ {
179
+ "rules": [
180
+ {
181
+ // Requests initiated by the bridge with the configured domain indicate an attempt
182
+ // to establish a reverse tunnel to the portal.
183
+ // Therefore, route to interconn (connect to portal).
184
+ "inboundTag": ["bridge"],
185
+ "domain": ["full:reverse-proxy.xray.internal"],
186
+ "outboundTag": "interconn"
187
+ },
188
+ {
189
+ // Traffic coming from the portal will also exit from the bridge, but without the domain above.
190
+ // Therefore, route to out (forward to the web server).
191
+ "inboundTag": ["bridge"],
192
+ "outboundTag": "out"
193
+ }
194
+ ]
195
+ }
196
+ ```
197
+
198
+ ### Portal Configuration
199
+
200
+ The `portal` usually requires two inbounds: one to receive connections from the `bridge` and another to receive actual traffic. You also need to use routing to distinguish between the two types of traffic.
201
+
202
+ Reverse Proxy Configuration:
203
+
204
+ ```json
205
+ "reverse": {
206
+ "portals": [
207
+ {
208
+ "tag": "portal",
209
+ "domain": "reverse-proxy.xray.internal" // Must be the same as the bridge configuration
210
+ }
211
+ ]
212
+ }
213
+ ```
214
+
215
+ Inbounds:
216
+
217
+ ```json
218
+ {
219
+ // Directly receive requests from the public internet
220
+ "tag": "external",
221
+ "port": 80,
222
+ "protocol": "dokodemo-door",
223
+ "settings": {
224
+ "address": "127.0.0.1",
225
+ "port": 80,
226
+ "network": "tcp"
227
+ }
228
+ }
229
+ ```
230
+
231
+ ```json
232
+ {
233
+ // Receive requests from the bridge attempting to establish a reverse tunnel
234
+ "tag": "interconn",
235
+ "port": 1024,
236
+ "protocol": "vmess",
237
+ "settings": {
238
+ "clients": [
239
+ {
240
+ "id": "5783a3e7-e373-51cd-8642-c83782b807c5"
241
+ }
242
+ ]
243
+ }
244
+ }
245
+ ```
246
+
247
+ Routing Configuration:
248
+
249
+ ```json
250
+ {
251
+ "rules": [
252
+ {
253
+ // If the inbound is external, it indicates a request from the public internet.
254
+ // Route to portal, which will eventually forward to the bridge.
255
+ "inboundTag": ["external"],
256
+ "outboundTag": "portal"
257
+ },
258
+ {
259
+ // If the inbound is interconn, it indicates a request from the bridge to establish a reverse tunnel.
260
+ // Route to portal, which will eventually forward to the corresponding public client.
261
+ // Note: The request entering here will carry the domain configured earlier,
262
+ // so the portal can distinguish between the two types of requests routed to it.
263
+ "inboundTag": ["interconn"],
264
+ "outboundTag": "portal"
265
+ }
266
+ ]
267
+ }
268
+ ```