@creeperhost/modlens-mcp 1.6.21 → 1.6.23
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 +17 -5
- package/dist/hosted-oauth.d.ts +43 -0
- package/dist/hosted-oauth.d.ts.map +1 -0
- package/dist/hosted-oauth.js +633 -0
- package/dist/hosted-oauth.js.map +1 -0
- package/dist/hosted-policy.d.ts +7 -3
- package/dist/hosted-policy.d.ts.map +1 -1
- package/dist/hosted-policy.js +104 -7
- package/dist/hosted-policy.js.map +1 -1
- package/dist/minecraft.d.ts +2 -0
- package/dist/minecraft.d.ts.map +1 -1
- package/dist/minecraft.js +16 -0
- package/dist/minecraft.js.map +1 -1
- package/dist/repositories/mcVersion.d.ts +1 -0
- package/dist/repositories/mcVersion.d.ts.map +1 -1
- package/dist/repositories/mcVersion.js +11 -0
- package/dist/repositories/mcVersion.js.map +1 -1
- package/dist/runtime/companion.d.ts +3 -3
- package/dist/runtime/modlens-agent.jar +0 -0
- package/dist/runtime/protocol.d.ts +2 -2
- package/dist/server.js +74 -11
- package/dist/server.js.map +1 -1
- package/dist/tools/hosted-mc-index.d.ts +8 -0
- package/dist/tools/hosted-mc-index.d.ts.map +1 -0
- package/dist/tools/hosted-mc-index.js +92 -0
- package/dist/tools/hosted-mc-index.js.map +1 -0
- package/dist/tools/mc-fts.d.ts +2 -0
- package/dist/tools/mc-fts.d.ts.map +1 -1
- package/dist/tools/mc-fts.js +8 -0
- package/dist/tools/mc-fts.js.map +1 -1
- package/dist/tools/vanilla.d.ts +30 -1
- package/dist/tools/vanilla.d.ts.map +1 -1
- package/dist/tools/vanilla.js +184 -25
- package/dist/tools/vanilla.js.map +1 -1
- package/package.json +2 -1
- package/scripts/test-hosted-oauth.mjs +208 -0
- package/scripts/test-hosted-policy.mjs +67 -8
package/README.md
CHANGED
|
@@ -704,7 +704,7 @@ All tool actions have been consolidated into **24 grouped tools** to stay within
|
|
|
704
704
|
| action | Key params | Description |
|
|
705
705
|
|--------|-----------|-------------|
|
|
706
706
|
| `search_class` | version, query | Find class by name |
|
|
707
|
-
| `get_source` | version, className, startLine, endLine, maxLines | Read decompiled source |
|
|
707
|
+
| `get_source` | version, className, startLine, endLine, maxLines | Read decompiled source locally or for enabled teams; public HTTP prepares a private class index and returns status only |
|
|
708
708
|
| `bytecode` | version, className | Raw `javap` output |
|
|
709
709
|
| `class_members` | version, className | Methods/fields with mixin target strings |
|
|
710
710
|
| `find_refs` | version, target | Classes referencing a target |
|
|
@@ -712,7 +712,9 @@ All tool actions have been consolidated into **24 grouped tools** to stay within
|
|
|
712
712
|
| `diff` | versionA, versionB | Added/removed classes between MC versions |
|
|
713
713
|
| `decompile` | version, force | Bulk decompile MC JAR (background) |
|
|
714
714
|
| `decompile_status` | version | Poll bulk decompile job |
|
|
715
|
-
| `search_code` | version, query, searchType, isRegex, limit | Regex/text search across MC source |
|
|
715
|
+
| `search_code` | version, query, searchType, isRegex, limit | Regex/text search across MC source; public HTTP returns file and line only |
|
|
716
|
+
| `source_info` | version, className | Cached class availability and total line count, without source text |
|
|
717
|
+
| `index_status` | version | Full-version source index status, without source text |
|
|
716
718
|
| `index` | version, force | Index decompiled MC into PostgreSQL FTS |
|
|
717
719
|
| `search_indexed` | version, query, limit | Fast FTS search |
|
|
718
720
|
| `search_events` | version, query?, modloader? | Find Event subclasses in decompiled source |
|
|
@@ -1065,7 +1067,9 @@ node dist/cli.js check-updates 2
|
|
|
1065
1067
|
|
|
1066
1068
|
## Hosted access limits
|
|
1067
1069
|
|
|
1068
|
-
HTTP MCP (`MCP_PORT`) enables hosted limits by default
|
|
1070
|
+
HTTP MCP (`MCP_PORT`) enables hosted limits by default; local stdio retains full access. Public HTTP returns Minecraft class locations, members, references, mixin and version analysis, and source metadata, without Minecraft source text or bytecode. `source_info` reports cached line counts; `search_code` reports matching files and lines (`0` when no exact line is available). Line numbers may differ from a client's local decompilation.
|
|
1071
|
+
|
|
1072
|
+
The first hosted Minecraft request for a version queues private full-version decompilation and indexing. Public `get_source` prioritizes that class and returns preparation status instead of source; `index_status` reports full-version progress. Bulk commands, exports, raw JAR reads, host paths, filesystem administration, and KubeJS directory access remain local-only.
|
|
1069
1073
|
|
|
1070
1074
|
| Setting | Default | Scope |
|
|
1071
1075
|
| --- | --- | --- |
|
|
@@ -1078,7 +1082,9 @@ HTTP MCP (`MCP_PORT`) enables hosted limits by default. Local stdio retains its
|
|
|
1078
1082
|
|
|
1079
1083
|
The byte allowance includes all successful tool content, including metadata, search snippets and bytecode. It measures UTF-8 JSON content before transport compression. Cached files and inbound upload bytes are excluded. Each source text field has a 32 KiB cap. Searches with `limit`/`top` are capped at 50 results; responses exceeding the byte limit require a narrower query.
|
|
1080
1084
|
|
|
1081
|
-
Use `startLine` (1-based) and `maxLines` for `mc_source get_source/bytecode`, `mod source/decompile_class`, `mod_bytecode bytecode`, and `project source/bytecode`. A range may start anywhere; the hosted cap bounds its length.
|
|
1085
|
+
Use `startLine` (1-based) and `maxLines` for team `mc_source get_source/bytecode`, `mod source/decompile_class`, `mod_bytecode bytecode`, and `project source/bytecode`. A range may start anywhere; the hosted cap bounds its length. Minecraft source indexes populate automatically after the first hosted request for a version. Ingest mods through the operator's local interface; hosted clients can upload their own Gradle environment through `project`.
|
|
1086
|
+
|
|
1087
|
+
To allow Minecraft source for specific teams, set `MODLENS_HOSTED_MC_SOURCE=1` and `MODLENS_HOSTED_MC_SOURCE_TEAMS` to comma-separated team IDs. This requires `MODLENS_HOSTED_PROXY_SECRET`; the authenticated gateway must inject `x-modlens-team-id` for verified members and remove caller-provided `x-modlens-*` headers. Other users retain metadata-only Minecraft access. Team access uses the same source and usage limits above. Local stdio is unaffected.
|
|
1082
1088
|
|
|
1083
1089
|
### Mod source access
|
|
1084
1090
|
|
|
@@ -1092,7 +1098,13 @@ npx -y @creeperhost/modlens-mcp --local-mod --request-file local-request.json
|
|
|
1092
1098
|
|
|
1093
1099
|
### Bind allowances to authenticated accounts
|
|
1094
1100
|
|
|
1095
|
-
For public
|
|
1101
|
+
For built-in OAuth sign-in, set `MODLENS_HOSTED_AUTH=oauth` and configure `MODLENS_OAUTH_PUBLIC_URL` (the public `/mcp` URL), `MODLENS_OAUTH_ISSUER`, `MODLENS_OAUTH_CLIENT_ID`, `MODLENS_OAUTH_SCOPES`, and a stable base64-encoded 32-byte `MODLENS_OAUTH_STORAGE_KEY`. Set `MODLENS_OAUTH_PROFILE_URL` unless provider discovery supplies a userinfo endpoint. The provider must support authorization code with S256 PKCE and refresh tokens for persistent sign-in. Register `<public origin>/oauth/upstream/callback` as the provider client's redirect URI. `MODLENS_OAUTH_CLIENT_SECRET` is optional. `MODLENS_OAUTH_SUBJECT_FIELD` defaults to `sub`; optional `MODLENS_OAUTH_REQUIRED_FIELD` and `MODLENS_OAUTH_REQUIRED_VALUE` restrict access using a profile field. The OAuth routes and well-known metadata must be reachable through the public HTTPS origin. OAuth mode does not enable hosted Minecraft source.
|
|
1102
|
+
|
|
1103
|
+
OAuth clients, short-lived authorization state, grants, and tokens are stored in the configured database. A multi-replica deployment must point every replica at the same persistent database and use the same `MODLENS_OAUTH_STORAGE_KEY`; the embedded SQLite default is suitable only for a single replica. Otherwise, a browser redirect can land on a replica that cannot see the authorization created by the previous request and fail with `invalid_grant`.
|
|
1104
|
+
|
|
1105
|
+
The server writes structured OAuth lifecycle events to stderr with a short `flow` identifier. Failures also include an `incident` reference shown on browser-facing error pages, so one report can be matched to its server log. These events include the stage, route, status, error code, hashed client reference, and redirect origin where relevant; authorization codes, state values, PKCE material, tokens, provider profiles, and subjects are never logged.
|
|
1106
|
+
|
|
1107
|
+
For gateway authentication (the default HTTP mode), put an authenticated HTTPS gateway in front of the server. Set `MODLENS_HOSTED_PROXY_SECRET` to a random secret of at least 32 characters. The gateway must remove caller-provided `x-modlens-*` headers and inject:
|
|
1096
1108
|
|
|
1097
1109
|
- `x-modlens-proxy-secret`: the server's secret, never sent to clients.
|
|
1098
1110
|
- `x-modlens-user-id`: a stable, verified account identifier selected by the gateway. Reconnecting, rotating tokens, or using another client must retain this identifier.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import { getDb } from "./db.js";
|
|
3
|
+
type Database = Awaited<ReturnType<typeof getDb>>;
|
|
4
|
+
export declare class HostedOAuthError extends Error {
|
|
5
|
+
status: number;
|
|
6
|
+
code: string;
|
|
7
|
+
flowId?: string | undefined;
|
|
8
|
+
constructor(message: string, status?: number, code?: string, flowId?: string | undefined);
|
|
9
|
+
}
|
|
10
|
+
export declare class HostedOAuth {
|
|
11
|
+
private config;
|
|
12
|
+
private database;
|
|
13
|
+
private ready?;
|
|
14
|
+
private requestCounts;
|
|
15
|
+
private constructor();
|
|
16
|
+
private audit;
|
|
17
|
+
private clientRef;
|
|
18
|
+
logError(method: string | undefined, route: string, error: HostedOAuthError): string;
|
|
19
|
+
static create(env?: NodeJS.ProcessEnv, database?: () => Promise<Database>): Promise<HostedOAuth>;
|
|
20
|
+
private db;
|
|
21
|
+
private seal;
|
|
22
|
+
private open;
|
|
23
|
+
private putObject;
|
|
24
|
+
private putObjectAt;
|
|
25
|
+
private getObject;
|
|
26
|
+
private takeObject;
|
|
27
|
+
private client;
|
|
28
|
+
private upstreamToken;
|
|
29
|
+
private profile;
|
|
30
|
+
private callbackUrl;
|
|
31
|
+
private issuerUrl;
|
|
32
|
+
private metadataUrl;
|
|
33
|
+
challenge(res: ServerResponse): void;
|
|
34
|
+
browserError(res: ServerResponse, error: HostedOAuthError, incident?: string): void;
|
|
35
|
+
authenticate(req: IncomingMessage): Promise<string>;
|
|
36
|
+
private revoke;
|
|
37
|
+
private issue;
|
|
38
|
+
private limit;
|
|
39
|
+
handle(req: IncomingMessage, res: ServerResponse, url: URL): Promise<boolean>;
|
|
40
|
+
private metadataUrlPath;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=hosted-oauth.d.ts.map
|
|
@@ -0,0 +1 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