edoardo 1.0.4 → 1.0.5
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/package.json +1 -1
- package/server/standalone.js +16 -12
package/package.json
CHANGED
package/server/standalone.js
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import express from 'express';
|
|
13
|
-
import cors from 'cors';
|
|
14
13
|
import { spawn } from 'child_process';
|
|
15
14
|
import { fileURLToPath } from 'url';
|
|
16
15
|
import { dirname, join } from 'path';
|
|
@@ -29,19 +28,24 @@ const stdioServers = new Map();
|
|
|
29
28
|
|
|
30
29
|
// ============ CORS (must be first for all requests!) ============
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
// Manual CORS middleware - handles all requests including preflight
|
|
32
|
+
app.use((req, res, next) => {
|
|
33
|
+
const origin = req.headers.origin;
|
|
34
|
+
|
|
35
|
+
// Allow all origins (for standalone deployment)
|
|
36
|
+
res.setHeader('Access-Control-Allow-Origin', origin || '*');
|
|
37
|
+
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
|
38
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
|
|
39
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-MCP-Endpoint, X-MCP-Auth-Type, X-MCP-Auth-Token, X-MCP-Extra-Config, X-MCP-Type, X-MCP-Command, X-MCP-Args, X-MCP-Allowed-Paths');
|
|
40
|
+
res.setHeader('Access-Control-Max-Age', '86400');
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
// Handle preflight OPTIONS request
|
|
43
|
+
if (req.method === 'OPTIONS') {
|
|
44
|
+
return res.status(204).end();
|
|
45
|
+
}
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
next();
|
|
48
|
+
});
|
|
45
49
|
|
|
46
50
|
app.use(express.json());
|
|
47
51
|
|