@lokiplay/mcp 0.1.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/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Loki Play contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @lokiplay/mcp
|
|
2
|
+
|
|
3
|
+
Resources, tool definitions, and request handling helpers for integrating Loki
|
|
4
|
+
with MCP hosts.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm install @lokiplay/mcp
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
The package exports Loki integration resources, supported tool metadata, and
|
|
11
|
+
`callLokiTool` for dispatching calls to an implementation of `LokiMcpApi`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const lokiResources: readonly [{
|
|
2
|
+
readonly uri: "loki://docs/integration";
|
|
3
|
+
readonly name: "Loki integration guide";
|
|
4
|
+
readonly mimeType: "text/markdown";
|
|
5
|
+
readonly text: string;
|
|
6
|
+
}, {
|
|
7
|
+
readonly uri: "loki://schemas/game-manifest";
|
|
8
|
+
readonly name: "game.json schema";
|
|
9
|
+
readonly mimeType: "application/json";
|
|
10
|
+
readonly text: string;
|
|
11
|
+
}];
|
|
12
|
+
export declare const lokiTools: readonly [{
|
|
13
|
+
readonly name: "create_project";
|
|
14
|
+
readonly description: "Create a Loki project in an authenticated organization.";
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "validate_manifest";
|
|
17
|
+
readonly description: "Validate a Loki game.json manifest before deployment.";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "create_deployment_credential";
|
|
20
|
+
readonly description: "Issue a short-lived one-use credential for a project upload.";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "deployment_status";
|
|
23
|
+
readonly description: "Read deployment compatibility and activation status.";
|
|
24
|
+
}];
|
|
25
|
+
export interface LokiMcpApi {
|
|
26
|
+
createProject(input: {
|
|
27
|
+
organizationId: string;
|
|
28
|
+
name: string;
|
|
29
|
+
slug: string;
|
|
30
|
+
}): Promise<unknown>;
|
|
31
|
+
createDeploymentCredential(projectId: string): Promise<unknown>;
|
|
32
|
+
deploymentStatus(projectId: string, deploymentId: string): Promise<unknown>;
|
|
33
|
+
}
|
|
34
|
+
export declare function callLokiTool(api: LokiMcpApi, name: string, input: Record<string, unknown>): Promise<unknown>;
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;;;;;;;;EAuBhB,CAAC;AAEX,eAAO,MAAM,SAAS;;;;;;;;;;;;EAiBZ,CAAC;AAEX,MAAM,WAAW,UAAU;IACzB,aAAa,CAAC,KAAK,EAAE;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChE,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7E;AAED,wBAAsB,YAAY,CAChC,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,OAAO,CAAC,CAmClB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { GameManifestSchema } from "@lokiplay/protocol";
|
|
2
|
+
export const lokiResources = [
|
|
3
|
+
{
|
|
4
|
+
uri: "loki://docs/integration",
|
|
5
|
+
name: "Loki integration guide",
|
|
6
|
+
mimeType: "text/markdown",
|
|
7
|
+
text: [
|
|
8
|
+
"# Loki integration",
|
|
9
|
+
"Use @lokiplay/sdk and a host-authoritative room.",
|
|
10
|
+
"Production multiplayer requires a Loki-hosted build.",
|
|
11
|
+
"Never include backend source, secrets, localhost URLs, or creator ad scripts.",
|
|
12
|
+
].join("\n\n"),
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
uri: "loki://schemas/game-manifest",
|
|
16
|
+
name: "game.json schema",
|
|
17
|
+
mimeType: "application/json",
|
|
18
|
+
text: JSON.stringify({
|
|
19
|
+
schemaVersion: 1,
|
|
20
|
+
authority: "host",
|
|
21
|
+
maxPlayers: "1..16",
|
|
22
|
+
tickRate: "1..10",
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
export const lokiTools = [
|
|
27
|
+
{
|
|
28
|
+
name: "create_project",
|
|
29
|
+
description: "Create a Loki project in an authenticated organization.",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "validate_manifest",
|
|
33
|
+
description: "Validate a Loki game.json manifest before deployment.",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "create_deployment_credential",
|
|
37
|
+
description: "Issue a short-lived one-use credential for a project upload.",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "deployment_status",
|
|
41
|
+
description: "Read deployment compatibility and activation status.",
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
export async function callLokiTool(api, name, input) {
|
|
45
|
+
if (name === "create_project") {
|
|
46
|
+
if (typeof input.organizationId !== "string" ||
|
|
47
|
+
typeof input.name !== "string" ||
|
|
48
|
+
typeof input.slug !== "string") {
|
|
49
|
+
throw new Error("organizationId, name, and slug are required");
|
|
50
|
+
}
|
|
51
|
+
return api.createProject({
|
|
52
|
+
organizationId: input.organizationId,
|
|
53
|
+
name: input.name,
|
|
54
|
+
slug: input.slug,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (name === "validate_manifest") {
|
|
58
|
+
const manifest = GameManifestSchema.parse(input.manifest);
|
|
59
|
+
return { valid: true, manifest };
|
|
60
|
+
}
|
|
61
|
+
if (name === "create_deployment_credential") {
|
|
62
|
+
if (typeof input.projectId !== "string") {
|
|
63
|
+
throw new Error("projectId is required");
|
|
64
|
+
}
|
|
65
|
+
return api.createDeploymentCredential(input.projectId);
|
|
66
|
+
}
|
|
67
|
+
if (name === "deployment_status") {
|
|
68
|
+
if (typeof input.projectId !== "string" ||
|
|
69
|
+
typeof input.deploymentId !== "string") {
|
|
70
|
+
throw new Error("projectId and deploymentId are required");
|
|
71
|
+
}
|
|
72
|
+
return api.deploymentStatus(input.projectId, input.deploymentId);
|
|
73
|
+
}
|
|
74
|
+
throw new Error(`unknown Loki tool: ${name}`);
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;QACE,GAAG,EAAE,yBAAyB;QAC9B,IAAI,EAAE,wBAAwB;QAC9B,QAAQ,EAAE,eAAe;QACzB,IAAI,EAAE;YACJ,oBAAoB;YACpB,kDAAkD;YAClD,sDAAsD;YACtD,+EAA+E;SAChF,CAAC,IAAI,CAAC,MAAM,CAAC;KACf;IACD;QACE,GAAG,EAAE,8BAA8B;QACnC,IAAI,EAAE,kBAAkB;QACxB,QAAQ,EAAE,kBAAkB;QAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,aAAa,EAAE,CAAC;YAChB,SAAS,EAAE,MAAM;YACjB,UAAU,EAAE,OAAO;YACnB,QAAQ,EAAE,OAAO;SAClB,CAAC;KACH;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,yDAAyD;KACvE;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,uDAAuD;KACrE;IACD;QACE,IAAI,EAAE,8BAA8B;QACpC,WAAW,EAAE,8DAA8D;KAC5E;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,sDAAsD;KACpE;CACO,CAAC;AAYX,MAAM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AC,CAAC;IACnE,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;AAChD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lokiplay/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Loki resources and tool definitions for MCP integrations.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -b --force && node ../../scripts/rewrite-package-imports.mjs dist",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@lokiplay/protocol": "0.1.0"
|
|
32
|
+
}
|
|
33
|
+
}
|