@runpod/mcp-server 4.8.0 → 4.9.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/CHANGELOG.md +6 -0
- package/README.md +6 -0
- package/dist/alp.cjs +319 -0
- package/dist/alp.cjs.map +1 -0
- package/dist/alp.d.cts +20 -0
- package/dist/alp.d.ts +20 -0
- package/dist/alp.mjs +25 -0
- package/dist/alp.mjs.map +1 -0
- package/dist/chunk-577IYCJT.mjs +53 -0
- package/dist/chunk-577IYCJT.mjs.map +1 -0
- package/dist/chunk-H3NZYQIB.mjs +236 -0
- package/dist/chunk-H3NZYQIB.mjs.map +1 -0
- package/dist/chunk-VKLWTK4O.mjs +10671 -0
- package/dist/chunk-VKLWTK4O.mjs.map +1 -0
- package/dist/hosted.cjs +11272 -0
- package/dist/hosted.cjs.map +1 -0
- package/dist/hosted.d.cts +58 -0
- package/dist/hosted.d.ts +58 -0
- package/dist/hosted.mjs +241 -0
- package/dist/hosted.mjs.map +1 -0
- package/dist/http-BaACCis6.d.cts +75 -0
- package/dist/http-BcFDW7LG.d.ts +75 -0
- package/dist/http.cjs +1 -1
- package/dist/http.d.cts +5 -77
- package/dist/http.d.ts +5 -77
- package/dist/http.mjs +13 -10589
- package/dist/http.mjs.map +1 -1
- package/dist/sink-Cm8lp16D.d.cts +17 -0
- package/dist/sink-Cm8lp16D.d.ts +17 -0
- package/dist/stdio.cjs +1 -1
- package/dist/stdio.mjs +1 -1
- package/package.json +11 -1
package/dist/http.d.ts
CHANGED
|
@@ -1,77 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
status: 'valid';
|
|
7
|
-
accountId?: string;
|
|
8
|
-
} | {
|
|
9
|
-
status: 'invalid';
|
|
10
|
-
reason: string;
|
|
11
|
-
} | {
|
|
12
|
-
status: 'unknown';
|
|
13
|
-
};
|
|
14
|
-
type CredentialChecker = (token: string) => Promise<CredentialVerdict>;
|
|
15
|
-
interface CredentialCheckerHandle {
|
|
16
|
-
verify: CredentialChecker;
|
|
17
|
-
invalidate: (token: string) => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
declare const ONCE_PER_ACCOUNT_ROUTES: readonly ["referral"];
|
|
21
|
-
type OncePerAccountRoute = (typeof ONCE_PER_ACCOUNT_ROUTES)[number];
|
|
22
|
-
|
|
23
|
-
interface HandleMcpRequestOptions {
|
|
24
|
-
serverVersion?: string;
|
|
25
|
-
verifyCredential?: CredentialChecker;
|
|
26
|
-
invalidateCredential?: (token: string) => void;
|
|
27
|
-
/** Once-per-account lookup behind the referral ask (src/alp/answered.ts).
|
|
28
|
-
* Resolve, never reject: a rejection is treated as an unknown verdict. */
|
|
29
|
-
hasAnswered?: (identity: string, route: OncePerAccountRoute) => Promise<boolean | null>;
|
|
30
|
-
}
|
|
31
|
-
interface RpcSummary {
|
|
32
|
-
rpc?: string;
|
|
33
|
-
client?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Extract the bearer token from an HTTP request's Authorization header.
|
|
38
|
-
* Returns null if the header is missing or malformed.
|
|
39
|
-
*/
|
|
40
|
-
declare function extractBearerToken(req: IncomingMessage): string | null;
|
|
41
|
-
declare function getBaseUrl(req: {
|
|
42
|
-
headers: {
|
|
43
|
-
host?: string;
|
|
44
|
-
'x-forwarded-proto'?: string | string[];
|
|
45
|
-
};
|
|
46
|
-
}): string;
|
|
47
|
-
declare function requestProfile(req: {
|
|
48
|
-
url?: string;
|
|
49
|
-
}): ServerProfile;
|
|
50
|
-
declare const defaultCredentialChecker: CredentialCheckerHandle;
|
|
51
|
-
declare function parseMcpMessages(body: unknown): JSONRPCMessage[];
|
|
52
|
-
declare function bodyIsCheckable(body: unknown): boolean;
|
|
53
|
-
declare function prefersJsonResponse(messages: JSONRPCMessage[]): boolean;
|
|
54
|
-
declare function requestLogSampleRate(env?: NodeJS.ProcessEnv): number;
|
|
55
|
-
declare function summarizeRpc(messages: JSONRPCMessage[]): RpcSummary;
|
|
56
|
-
/**
|
|
57
|
-
* Handle an incoming HTTP request as a streamable MCP session.
|
|
58
|
-
*
|
|
59
|
-
* Each request gets its own McpServer + transport. The caller's Bearer token
|
|
60
|
-
* is forwarded directly to the Runpod API as the credential — it may be a
|
|
61
|
-
* Runpod API key (set manually by the caller) or a token obtained through the
|
|
62
|
-
* OAuth "Sign in with Runpod" flow. The server holds no credential of its own
|
|
63
|
-
* and never shares one across users.
|
|
64
|
-
*
|
|
65
|
-
* The token is pre-flight verified (cached) before the MCP request is
|
|
66
|
-
* handled: a dead credential — e.g. an OAuth-minted key revoked mid-session —
|
|
67
|
-
* must surface as an HTTP 401 + WWW-Authenticate so
|
|
68
|
-
* OAuth-capable clients re-run their auth flow automatically. Without this,
|
|
69
|
-
* the upstream 401 is wrapped into a 200 JSON-RPC tool error and the client
|
|
70
|
-
* never re-authenticates. Set MCP_SKIP_CREDENTIAL_CHECK=true to disable.
|
|
71
|
-
*
|
|
72
|
-
* The gate also self-disables when the REST hosts are overridden without a
|
|
73
|
-
* matching RUNPOD_AUTHED_GRAPHQL_URL — see credentialCheckMayBeWrongEnvironment.
|
|
74
|
-
*/
|
|
75
|
-
declare function handleMcpRequest(req: IncomingMessage, res: ServerResponse, opts?: HandleMcpRequestOptions): Promise<void>;
|
|
76
|
-
|
|
77
|
-
export { bodyIsCheckable, defaultCredentialChecker, extractBearerToken, getBaseUrl, handleMcpRequest, parseMcpMessages, prefersJsonResponse, requestLogSampleRate, requestProfile, summarizeRpc };
|
|
1
|
+
import '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export { b as bodyIsCheckable, d as defaultCredentialChecker, e as extractBearerToken, g as getBaseUrl, h as handleMcpRequest, p as parseMcpMessages, a as prefersJsonResponse, c as requestLogSampleRate, r as requestProfile, s as summarizeRpc } from './http-BcFDW7LG.js';
|
|
3
|
+
import './specgen/profile.js';
|
|
4
|
+
import 'node:http';
|
|
5
|
+
import './sink-Cm8lp16D.js';
|