@digestseo/mcp-gsc 0.3.1 → 0.4.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/.dev.vars.example +12 -8
- package/CHANGELOG.md +80 -40
- package/LICENSE +21 -21
- package/README.md +111 -96
- package/SECURITY.md +73 -36
- package/SETUP.md +217 -199
- package/package.json +27 -13
- package/scripts/glama-start.mjs +14 -3
- package/src/access-mode.ts +59 -0
- package/src/access-token-lifecycle.ts +107 -0
- package/src/cannibalization-schema.ts +15 -0
- package/src/content-decay-schema.ts +8 -0
- package/src/crypto.ts +80 -58
- package/src/date-validation.ts +84 -0
- package/src/digest.ts +632 -648
- package/src/entrypoint.ts +39 -0
- package/src/google.ts +1205 -716
- package/src/index.ts +1431 -908
- package/src/indexed-pages-range.ts +54 -0
- package/src/indexing-property-authorization.ts +119 -0
- package/src/pending-auth-state.ts +87 -0
- package/src/quick-wins-schema.ts +27 -0
- package/src/storage.ts +65 -98
- package/src/tool-rate-limit.ts +231 -0
- package/src/tool-rate-limiter-do.ts +23 -0
- package/src/write-tool-annotations.ts +43 -0
- package/wrangler.example.jsonc +54 -35
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import authenticatedWorker, { mcpApiHandler, type Env } from './index';
|
|
2
|
+
|
|
3
|
+
export { GscMcpAgent, PendingAuthState, ToolRateLimiter } from './index';
|
|
4
|
+
|
|
5
|
+
type EntrypointEnv = Env & {
|
|
6
|
+
GLAMA_INSPECTION_MODE?: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type WorkerHandler = {
|
|
10
|
+
fetch(
|
|
11
|
+
request: Request,
|
|
12
|
+
env: EntrypointEnv,
|
|
13
|
+
ctx: ExecutionContext,
|
|
14
|
+
): Response | Promise<Response>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const inspectionWorker = mcpApiHandler as WorkerHandler;
|
|
18
|
+
|
|
19
|
+
const oauthWorker = authenticatedWorker as unknown as WorkerHandler;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Glama's release builder cannot complete an interactive OAuth flow, but it
|
|
23
|
+
* needs to initialize the MCP endpoint and call tools/list for static
|
|
24
|
+
* inspection. The bypass is deliberately opt-in, exact-value gated, and
|
|
25
|
+
* limited to /mcp. Tool handlers still have no authenticated agent props, so
|
|
26
|
+
* data-bearing calls fail closed.
|
|
27
|
+
*/
|
|
28
|
+
export default {
|
|
29
|
+
fetch(request: Request, env: EntrypointEnv, ctx: ExecutionContext) {
|
|
30
|
+
const inspectionEnabled = env.GLAMA_INSPECTION_MODE === 'true';
|
|
31
|
+
const isMcpEndpoint = new URL(request.url).pathname === '/mcp';
|
|
32
|
+
|
|
33
|
+
if (inspectionEnabled && isMcpEndpoint) {
|
|
34
|
+
return inspectionWorker.fetch(request, env, ctx);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return oauthWorker.fetch(request, env, ctx);
|
|
38
|
+
},
|
|
39
|
+
};
|