midnight-mcp 0.2.19 → 0.2.20
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/dist/bin.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
startHttpServer,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-F4KM42XU.js";
|
|
6
6
|
import {
|
|
7
7
|
setOutputFormat
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RCQYFKD3.js";
|
|
9
9
|
|
|
10
10
|
// src/bin.ts
|
|
11
11
|
import { config } from "dotenv";
|
|
@@ -13,7 +13,7 @@ import { resolve } from "path";
|
|
|
13
13
|
import yargs from "yargs";
|
|
14
14
|
import { hideBin } from "yargs/helpers";
|
|
15
15
|
config({ path: resolve(process.cwd(), ".env") });
|
|
16
|
-
var CURRENT_VERSION = "0.2.
|
|
16
|
+
var CURRENT_VERSION = "0.2.20";
|
|
17
17
|
process.on("uncaughtException", (error) => {
|
|
18
18
|
console.error("Uncaught exception:", error);
|
|
19
19
|
process.exit(1);
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
validateNumber,
|
|
26
26
|
validateQuery,
|
|
27
27
|
vectorStore
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-RCQYFKD3.js";
|
|
29
29
|
|
|
30
30
|
// src/tools/search/schemas.ts
|
|
31
31
|
import { z } from "zod";
|
|
@@ -1698,7 +1698,14 @@ var REPO_ALIASES = {
|
|
|
1698
1698
|
lucentlabs: { owner: "statera-protocol", repo: "statera-protocol-midnight" },
|
|
1699
1699
|
stablecoin: { owner: "statera-protocol", repo: "statera-protocol-midnight" },
|
|
1700
1700
|
"midnight-bank": { owner: "nel349", repo: "midnight-bank" },
|
|
1701
|
-
bank: { owner: "nel349", repo: "midnight-bank" }
|
|
1701
|
+
bank: { owner: "nel349", repo: "midnight-bank" },
|
|
1702
|
+
// Third-Party / Community (NOT official Midnight, not in midnight-awesome-dapps)
|
|
1703
|
+
// effectstream is a multi-chain Web3 engine (EVM, Midnight, Bitcoin, Cardano,
|
|
1704
|
+
// Avail, Celestia, NEAR). Only its Midnight pieces are relevant here:
|
|
1705
|
+
// @effectstream/midnight-contracts and the evm-midnight-v2 / zswap-da templates.
|
|
1706
|
+
// NOTE: repo currently has NO LICENSE — treat indexed content as reference only.
|
|
1707
|
+
effectstream: { owner: "effectstream", repo: "effectstream" },
|
|
1708
|
+
"effect-stream": { owner: "effectstream", repo: "effectstream" }
|
|
1702
1709
|
};
|
|
1703
1710
|
var EXAMPLES = [
|
|
1704
1711
|
{
|
|
@@ -6930,6 +6937,19 @@ var transports = {
|
|
|
6930
6937
|
streamable: {},
|
|
6931
6938
|
sse: {}
|
|
6932
6939
|
};
|
|
6940
|
+
function buildAllowlist(port) {
|
|
6941
|
+
const hosts = [`127.0.0.1:${port}`, `localhost:${port}`];
|
|
6942
|
+
const origins = hosts.flatMap((host) => [
|
|
6943
|
+
`http://${host}`,
|
|
6944
|
+
`https://${host}`
|
|
6945
|
+
]);
|
|
6946
|
+
return { allowedHosts: hosts, allowedOrigins: origins };
|
|
6947
|
+
}
|
|
6948
|
+
function isRebindingBlocked(host, origin, allowedHosts, allowedOrigins) {
|
|
6949
|
+
if (host && !allowedHosts.includes(host)) return true;
|
|
6950
|
+
if (origin && !allowedOrigins.includes(origin)) return true;
|
|
6951
|
+
return false;
|
|
6952
|
+
}
|
|
6933
6953
|
async function closeTransports(transportMap) {
|
|
6934
6954
|
const closePromises = Object.values(transportMap).map(
|
|
6935
6955
|
(transport) => transport.close?.().catch(() => {
|
|
@@ -6940,6 +6960,7 @@ async function closeTransports(transportMap) {
|
|
|
6940
6960
|
async function startHttpServer(port = 3e3) {
|
|
6941
6961
|
const mcpServer = await initializeServer();
|
|
6942
6962
|
const app = express();
|
|
6963
|
+
const { allowedHosts, allowedOrigins } = buildAllowlist(port);
|
|
6943
6964
|
app.use("/mcp", express.json());
|
|
6944
6965
|
app.get("/health", (_req, res) => {
|
|
6945
6966
|
res.json({
|
|
@@ -6956,6 +6977,10 @@ async function startHttpServer(port = 3e3) {
|
|
|
6956
6977
|
} else if (!sessionId && isInitializeRequest(req.body)) {
|
|
6957
6978
|
transport = new StreamableHTTPServerTransport({
|
|
6958
6979
|
sessionIdGenerator: () => randomUUID(),
|
|
6980
|
+
// Block DNS-rebinding attacks from browser pages (loopback allowlist).
|
|
6981
|
+
enableDnsRebindingProtection: true,
|
|
6982
|
+
allowedHosts,
|
|
6983
|
+
allowedOrigins,
|
|
6959
6984
|
onsessioninitialized: (newSessionId) => {
|
|
6960
6985
|
transports.streamable[newSessionId] = transport;
|
|
6961
6986
|
logger.debug(`New streamable session: ${newSessionId}`);
|
|
@@ -6993,9 +7018,20 @@ async function startHttpServer(port = 3e3) {
|
|
|
6993
7018
|
}
|
|
6994
7019
|
await transport.handleRequest(req, res, req.body);
|
|
6995
7020
|
});
|
|
6996
|
-
app.get("/sse", async (
|
|
7021
|
+
app.get("/sse", async (req, res) => {
|
|
7022
|
+
const host = req.headers.host;
|
|
7023
|
+
const origin = req.headers.origin;
|
|
7024
|
+
if (isRebindingBlocked(host, origin, allowedHosts, allowedOrigins)) {
|
|
7025
|
+
logger.warn(`Rejected SSE connection`, { host, origin });
|
|
7026
|
+
res.status(403).send("Forbidden: invalid Host or Origin");
|
|
7027
|
+
return;
|
|
7028
|
+
}
|
|
6997
7029
|
logger.debug("New SSE connection");
|
|
6998
|
-
const transport = new SSEServerTransport("/messages", res
|
|
7030
|
+
const transport = new SSEServerTransport("/messages", res, {
|
|
7031
|
+
enableDnsRebindingProtection: true,
|
|
7032
|
+
allowedHosts,
|
|
7033
|
+
allowedOrigins
|
|
7034
|
+
});
|
|
6999
7035
|
transports.sse[transport.sessionId] = transport;
|
|
7000
7036
|
res.on("close", () => {
|
|
7001
7037
|
delete transports.sse[transport.sessionId];
|
|
@@ -11253,4 +11289,4 @@ export {
|
|
|
11253
11289
|
startServer,
|
|
11254
11290
|
startHttpServer
|
|
11255
11291
|
};
|
|
11256
|
-
//# sourceMappingURL=chunk-
|
|
11292
|
+
//# sourceMappingURL=chunk-F4KM42XU.js.map
|
|
@@ -1624,7 +1624,7 @@ var releaseTracker = new ReleaseTracker();
|
|
|
1624
1624
|
|
|
1625
1625
|
// src/utils/health.ts
|
|
1626
1626
|
var startTime = Date.now();
|
|
1627
|
-
var VERSION = "0.2.
|
|
1627
|
+
var VERSION = "0.2.20";
|
|
1628
1628
|
async function checkGitHubAPI() {
|
|
1629
1629
|
const start = Date.now();
|
|
1630
1630
|
try {
|
|
@@ -1652,7 +1652,7 @@ async function checkGitHubAPI() {
|
|
|
1652
1652
|
}
|
|
1653
1653
|
async function checkVectorStore() {
|
|
1654
1654
|
try {
|
|
1655
|
-
const { vectorStore: vectorStore2 } = await import("./db-
|
|
1655
|
+
const { vectorStore: vectorStore2 } = await import("./db-VCUUBGDV.js");
|
|
1656
1656
|
if (vectorStore2) {
|
|
1657
1657
|
return {
|
|
1658
1658
|
status: "pass",
|
|
@@ -2128,7 +2128,7 @@ function serialize(data) {
|
|
|
2128
2128
|
}
|
|
2129
2129
|
|
|
2130
2130
|
// src/utils/version.ts
|
|
2131
|
-
var CURRENT_VERSION = "0.2.
|
|
2131
|
+
var CURRENT_VERSION = "0.2.20";
|
|
2132
2132
|
|
|
2133
2133
|
// src/db/vectorStore.ts
|
|
2134
2134
|
var VectorStore = class {
|
|
@@ -2351,4 +2351,4 @@ export {
|
|
|
2351
2351
|
serialize,
|
|
2352
2352
|
CURRENT_VERSION
|
|
2353
2353
|
};
|
|
2354
|
-
//# sourceMappingURL=chunk-
|
|
2354
|
+
//# sourceMappingURL=chunk-RCQYFKD3.js.map
|
package/dist/index.js
CHANGED
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
promptDefinitions,
|
|
10
10
|
startHttpServer,
|
|
11
11
|
startServer
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-F4KM42XU.js";
|
|
13
13
|
import {
|
|
14
14
|
logger
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RCQYFKD3.js";
|
|
16
16
|
export {
|
|
17
17
|
allResources,
|
|
18
18
|
allTools,
|
package/package.json
CHANGED