@edgegap/mcp 0.3.3 → 0.5.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.
package/dist/skills.js ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The Edgegap agent skills, served by this MCP server.
3
+ *
4
+ * The skills (github.com/edgegap/edgegap-agent-skills) are the workflows,
5
+ * templates and pitfalls an agent needs to take a game from "works on my
6
+ * machine" to matched players on a dedicated server. Serving them here means
7
+ * every agent connected to Edgegap MCP has them, whether or not it can install
8
+ * SKILL.md skills itself.
9
+ *
10
+ * They are bundled at build time (src/skills.generated.ts, written by
11
+ * scripts/sync-skills.mjs at the commit pinned in scripts/skills-pin.txt), so
12
+ * the server needs no network or file system to serve them — the Cloudflare
13
+ * Worker has neither — and each release names exactly which skills it carries.
14
+ */
15
+ import { SKILLS_PACK } from './skills.generated.js';
16
+ export { SKILLS_PACK };
17
+ export function findSkill(name) {
18
+ return SKILLS_PACK.skills.find((s) => s.name === name);
19
+ }
20
+ /**
21
+ * Exact match on a bundled path only. Nothing is read from disk, and a path
22
+ * that is not in the bundle — "../x", an absolute path, a typo — is simply
23
+ * not found, so there is no traversal to defend against.
24
+ */
25
+ export function findSkillFile(skill, path = 'SKILL.md') {
26
+ const wanted = path.replace(/\\/g, '/').replace(/^\.\//, '');
27
+ return skill.files.find((f) => f.path === wanted);
28
+ }
29
+ /** "edgegap-skill://edgegap-unity/references/deploy.md" */
30
+ export function skillUri(skill, path) {
31
+ return `edgegap-skill://${skill}/${path}`;
32
+ }
33
+ export function mimeType(path) {
34
+ if (path.endsWith('.md'))
35
+ return 'text/markdown';
36
+ if (path.endsWith('.json'))
37
+ return 'application/json';
38
+ if (path.endsWith('.cs'))
39
+ return 'text/x-csharp';
40
+ if (/\.(h|cpp)$/.test(path))
41
+ return 'text/x-c++src';
42
+ if (path.endsWith('.xml'))
43
+ return 'application/xml';
44
+ return 'text/plain';
45
+ }
46
+ /** The skill's other files, so an agent knows what it can fetch next. */
47
+ export function fileIndex(skill) {
48
+ return skill.files.filter((f) => f.path !== 'SKILL.md').map((f) => f.path);
49
+ }