@modootoday/pmcp 0.8.1 → 0.8.3
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 +7 -6
- package/dist/{chunk-K7BX33LH.js → chunk-2VWT5IW3.js} +2 -2
- package/dist/{chunk-HB4VJ5VW.js → chunk-LCB3ZIPN.js} +2 -2
- package/dist/{chunk-MO3LLVVY.js → chunk-MP3KQDP3.js} +2 -2
- package/dist/{chunk-DTQAN33I.js → chunk-OWRJWWMP.js} +2 -2
- package/dist/{chunk-STBBSQ3R.js → chunk-WXDC24UC.js} +2 -2
- package/dist/cli.js +6 -6
- package/dist/http.d.ts +4 -1
- package/dist/http.js +21 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/stdio.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -191,12 +191,13 @@ export default { fetch: (request: Request) => skills.fetch(request) };
|
|
|
191
191
|
|
|
192
192
|
The handler checks requests before they reach MCP:
|
|
193
193
|
|
|
194
|
-
| Option | Default | Effect
|
|
195
|
-
| ----------------- | ------- |
|
|
196
|
-
| `allowedOrigins` | none | A request with an `Origin` other than the server's own gets 403. Listed origins are served with CORS headers, and their preflight is answered. Requests without `Origin` are not from a browser page and pass. |
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
194
|
+
| Option | Default | Effect |
|
|
195
|
+
| ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
196
|
+
| `allowedOrigins` | none | A request with an `Origin` other than the server's own gets 403. Listed origins are served with CORS headers, and their preflight is answered. `"*"` admits any origin. Requests without `Origin` are not from a browser page and pass. |
|
|
197
|
+
| `publicOrigins` | none | The server's own origins as browsers see them, when a proxy ends TLS and the request URL is `http://`. Without it, a same-site page behind such a proxy gets 403. |
|
|
198
|
+
| `allowedHosts` | any | When set, a `Host` outside the list gets 403 (DNS rebinding). |
|
|
199
|
+
| `maxRequestBytes` | 1 MiB | A larger body gets 413; a declared length is refused before reading. |
|
|
200
|
+
| `rateLimit` | off | `{ perMinute }` per caller id; past it, 429 with `retry-after`. |
|
|
200
201
|
|
|
201
202
|
An MCP config (`.mcp.json`) is never served as written: every `env` and `headers` value is
|
|
202
203
|
replaced with `<redacted>`, whichever entry reaches the file, and listed digests describe
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSkillServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LCB3ZIPN.js";
|
|
4
4
|
|
|
5
5
|
// src/stdio.ts
|
|
6
6
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
@@ -38,4 +38,4 @@ export {
|
|
|
38
38
|
serve,
|
|
39
39
|
main
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
41
|
+
//# sourceMappingURL=chunk-2VWT5IW3.js.map
|
|
@@ -1590,7 +1590,7 @@ function registerReadTool(server, tools) {
|
|
|
1590
1590
|
|
|
1591
1591
|
// src/mcp.ts
|
|
1592
1592
|
var SERVER_NAME = "pmcp";
|
|
1593
|
-
var SERVER_VERSION = "0.8.
|
|
1593
|
+
var SERVER_VERSION = "0.8.3";
|
|
1594
1594
|
function registerSkillTools(server, tools) {
|
|
1595
1595
|
registerCatalogTool(server, tools);
|
|
1596
1596
|
registerFindTool(server, tools);
|
|
@@ -1661,4 +1661,4 @@ export {
|
|
|
1661
1661
|
registerSkillTools,
|
|
1662
1662
|
createSkillServer
|
|
1663
1663
|
};
|
|
1664
|
-
//# sourceMappingURL=chunk-
|
|
1664
|
+
//# sourceMappingURL=chunk-LCB3ZIPN.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normaliseIntent
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LCB3ZIPN.js";
|
|
4
4
|
|
|
5
5
|
// src/cache.ts
|
|
6
6
|
async function openDatabase(path) {
|
|
@@ -131,4 +131,4 @@ export {
|
|
|
131
131
|
DEFAULT_INTENT_CACHE_LIMIT,
|
|
132
132
|
openIntentCache
|
|
133
133
|
};
|
|
134
|
-
//# sourceMappingURL=chunk-
|
|
134
|
+
//# sourceMappingURL=chunk-MP3KQDP3.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
frontmatterObject,
|
|
3
3
|
readCatalog,
|
|
4
4
|
specProblems
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LCB3ZIPN.js";
|
|
6
6
|
|
|
7
7
|
// src/config.ts
|
|
8
8
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -1139,4 +1139,4 @@ export {
|
|
|
1139
1139
|
validateSkillDir,
|
|
1140
1140
|
validateCatalog
|
|
1141
1141
|
};
|
|
1142
|
-
//# sourceMappingURL=chunk-
|
|
1142
|
+
//# sourceMappingURL=chunk-OWRJWWMP.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openDatabase
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MP3KQDP3.js";
|
|
4
4
|
|
|
5
5
|
// src/embed.ts
|
|
6
6
|
var DEFAULT_MODEL_ID = "Xenova/multilingual-e5-small";
|
|
@@ -157,4 +157,4 @@ export {
|
|
|
157
157
|
encodeEntries,
|
|
158
158
|
openEntryVectors
|
|
159
159
|
};
|
|
160
|
-
//# sourceMappingURL=chunk-
|
|
160
|
+
//# sourceMappingURL=chunk-WXDC24UC.js.map
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
loadEmbedder,
|
|
4
4
|
openEntryVectors
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WXDC24UC.js";
|
|
6
6
|
import {
|
|
7
7
|
ConfigError,
|
|
8
8
|
ProjectError,
|
|
@@ -17,15 +17,15 @@ import {
|
|
|
17
17
|
splitFrontmatter,
|
|
18
18
|
validateCatalog,
|
|
19
19
|
validateSkillDir
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-OWRJWWMP.js";
|
|
21
|
+
import "./chunk-MP3KQDP3.js";
|
|
22
22
|
import {
|
|
23
23
|
serve
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-2VWT5IW3.js";
|
|
25
25
|
import {
|
|
26
26
|
kindOf,
|
|
27
27
|
readCatalog
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-LCB3ZIPN.js";
|
|
29
29
|
|
|
30
30
|
// src/cli/command.ts
|
|
31
31
|
var ArgumentError = class extends Error {
|
|
@@ -2347,7 +2347,7 @@ function dispatch(argv, options = {}) {
|
|
|
2347
2347
|
}
|
|
2348
2348
|
return run(command, rest, { ui, env, cwd });
|
|
2349
2349
|
}
|
|
2350
|
-
var VERSION = "0.8.
|
|
2350
|
+
var VERSION = "0.8.3";
|
|
2351
2351
|
async function run(command, argv, context) {
|
|
2352
2352
|
try {
|
|
2353
2353
|
return await command.run({
|
package/dist/http.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ interface SkillCaller {
|
|
|
74
74
|
readonly claims?: Readonly<Record<string, unknown>>;
|
|
75
75
|
}
|
|
76
76
|
interface SkillHttpOptions extends SkillServerOptions {
|
|
77
|
+
/** Gets the Request the host's fetch received; read headers only, the body is still unread. */
|
|
77
78
|
readonly authorize: (request: Request) => SkillCaller | undefined | Promise<SkillCaller | undefined>;
|
|
78
79
|
/** Tiers a caller may list and load. Package skills without a tier count as open. */
|
|
79
80
|
readonly tiersFor?: (caller: SkillCaller) => readonly string[];
|
|
@@ -88,8 +89,10 @@ interface SkillHttpOptions extends SkillServerOptions {
|
|
|
88
89
|
* here, so "private" unless the host knows every caller sees the same list.
|
|
89
90
|
*/
|
|
90
91
|
readonly cacheScope?: "public" | "private";
|
|
91
|
-
/** Browser origins, besides the server's own, whose pages may call; others get 403. */
|
|
92
|
+
/** Browser origins, besides the server's own, whose pages may call; others get 403. "*" admits any. */
|
|
92
93
|
readonly allowedOrigins?: readonly string[];
|
|
94
|
+
/** The server's own public origins when a proxy ends TLS, e.g. "https://skills.example.com". */
|
|
95
|
+
readonly publicOrigins?: readonly string[];
|
|
93
96
|
/** Host header values the server answers to; unset means any. */
|
|
94
97
|
readonly allowedHosts?: readonly string[];
|
|
95
98
|
/** Largest request body accepted; larger ones get 413. */
|
package/dist/http.js
CHANGED
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
DEFAULT_MODEL_ID,
|
|
3
3
|
encodeEntries,
|
|
4
4
|
loadEmbedder
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-WXDC24UC.js";
|
|
6
|
+
import "./chunk-MP3KQDP3.js";
|
|
7
7
|
import {
|
|
8
8
|
createSkillServer,
|
|
9
9
|
readCatalog
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LCB3ZIPN.js";
|
|
11
11
|
|
|
12
12
|
// src/http.ts
|
|
13
13
|
import {
|
|
@@ -22,11 +22,15 @@ var json = (status, body, headers = {}) => new Response(JSON.stringify(body), {
|
|
|
22
22
|
status,
|
|
23
23
|
headers: { "content-type": "application/json", ...headers }
|
|
24
24
|
});
|
|
25
|
-
function checkOrigin(request, allowedOrigins = []) {
|
|
25
|
+
function checkOrigin(request, allowedOrigins = [], publicOrigins = []) {
|
|
26
26
|
const origin = request.headers.get("origin");
|
|
27
27
|
if (origin === null) return { kind: "none" };
|
|
28
|
-
if (origin === new URL(request.url).origin)
|
|
29
|
-
|
|
28
|
+
if (origin === new URL(request.url).origin || publicOrigins.includes(origin)) {
|
|
29
|
+
return { kind: "same" };
|
|
30
|
+
}
|
|
31
|
+
if (allowedOrigins.includes(origin) || allowedOrigins.includes("*")) {
|
|
32
|
+
return { kind: "allowed", origin };
|
|
33
|
+
}
|
|
30
34
|
return {
|
|
31
35
|
kind: "refused",
|
|
32
36
|
response: json(403, { error: "origin_not_allowed" })
|
|
@@ -162,12 +166,7 @@ function createSkillHttpHandler(options) {
|
|
|
162
166
|
};
|
|
163
167
|
const limit = options.rateLimit ? createRateLimiter(options.rateLimit) : void 0;
|
|
164
168
|
const serve = async (request) => {
|
|
165
|
-
const
|
|
166
|
-
request,
|
|
167
|
-
options.maxRequestBytes ?? DEFAULT_MAX_REQUEST_BYTES
|
|
168
|
-
);
|
|
169
|
-
if (capped instanceof Response) return capped;
|
|
170
|
-
const caller = await options.authorize(capped);
|
|
169
|
+
const caller = await options.authorize(request);
|
|
171
170
|
if (!caller) {
|
|
172
171
|
return new Response(JSON.stringify({ error: "unauthorized" }), {
|
|
173
172
|
status: 401,
|
|
@@ -179,6 +178,11 @@ function createSkillHttpHandler(options) {
|
|
|
179
178
|
}
|
|
180
179
|
const limited = limit?.(caller.id);
|
|
181
180
|
if (limited) return limited;
|
|
181
|
+
const capped = await capBody(
|
|
182
|
+
request,
|
|
183
|
+
options.maxRequestBytes ?? DEFAULT_MAX_REQUEST_BYTES
|
|
184
|
+
);
|
|
185
|
+
if (capped instanceof Response) return capped;
|
|
182
186
|
return handlerFor(tiersFor(caller)).fetch(capped, {
|
|
183
187
|
authInfo: {
|
|
184
188
|
token: "",
|
|
@@ -192,7 +196,11 @@ function createSkillHttpHandler(options) {
|
|
|
192
196
|
async fetch(request) {
|
|
193
197
|
const wrongHost = checkHost(request, options.allowedHosts);
|
|
194
198
|
if (wrongHost) return wrongHost;
|
|
195
|
-
const origin = checkOrigin(
|
|
199
|
+
const origin = checkOrigin(
|
|
200
|
+
request,
|
|
201
|
+
options.allowedOrigins,
|
|
202
|
+
options.publicOrigins
|
|
203
|
+
);
|
|
196
204
|
if (origin.kind === "refused") return origin.response;
|
|
197
205
|
if (origin.kind !== "allowed") return serve(request);
|
|
198
206
|
if (request.method === "OPTIONS") return preflight(origin.origin);
|
package/dist/index.d.ts
CHANGED
|
@@ -304,7 +304,7 @@ declare function resolveSkillFileUri(uri: string, entries: readonly SkillEntry[]
|
|
|
304
304
|
|
|
305
305
|
/** Reported to the host on connect. */
|
|
306
306
|
declare const SERVER_NAME = "pmcp";
|
|
307
|
-
declare const SERVER_VERSION = "0.8.
|
|
307
|
+
declare const SERVER_VERSION = "0.8.3";
|
|
308
308
|
/**
|
|
309
309
|
* Registers the skill_* tools on a server.
|
|
310
310
|
*
|
package/dist/index.js
CHANGED
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
readSpec,
|
|
15
15
|
validateCatalog,
|
|
16
16
|
validateSkillDir
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-OWRJWWMP.js";
|
|
18
18
|
import {
|
|
19
19
|
DEFAULT_INTENT_CACHE_LIMIT,
|
|
20
20
|
openIntentCache
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-MP3KQDP3.js";
|
|
22
22
|
import {
|
|
23
23
|
ASSET_KINDS,
|
|
24
24
|
CATALOG_PAGE_MAX,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
skillFileUri,
|
|
71
71
|
specProblems,
|
|
72
72
|
withoutBody
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-LCB3ZIPN.js";
|
|
74
74
|
export {
|
|
75
75
|
ASSET_KINDS,
|
|
76
76
|
CATALOG_PAGE_MAX,
|
package/dist/stdio.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modootoday/pmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"license": "Elastic-2.0",
|
|
5
5
|
"author": "modootoday",
|
|
6
6
|
"description": "An MCP server that finds the skills your installed packages already ship. Reads SKILL.md out of node_modules by shape rather than by path, so it sees the skills, .agent, .claude, .gemini and .codex conventions alike, and keeps session startup flat as the number of installed skills grows.",
|