agents
Version:
A home for your AI agents
64 lines (62 loc) • 2.2 kB
TypeScript
import { n as CORSOptions } from "./types-D2naO3rA.js";
import {
CreateMcpHandlerOptions,
McpHandlerRequestOptions,
McpServerFactory,
ServerNotifier
} from "@modelcontextprotocol/server";
//#region src/mcp/server/auth-context.d.ts
interface McpAuthContext {
props: Record<string, unknown>;
}
declare function getMcpAuthContext(): McpAuthContext | undefined;
//#endregion
//#region src/mcp/server/handler-stateless.d.ts
interface CreateStatelessMcpHandlerOptions extends Omit<
CreateMcpHandlerOptions,
"bus"
> {
/** Exact pathname handled by this Worker wrapper. @default "/mcp" */
route?: string;
/** CORS headers applied by the Worker wrapper. Pass `false` to disable. */
corsOptions?: CORSOptions | false;
/**
* Restrict `Host` headers to these hostnames. Localhost and `workers.dev`
* endpoints receive matching defaults; custom domains rely on Cloudflare
* routing unless this option is set.
*/
allowedHostnames?: string[];
/**
* Restrict present browser `Origin` headers to these hostnames. Requests
* without an Origin (including non-browser MCP clients) remain valid. The
* default includes localhost-class Origins, the endpoint's `workers.dev`
* hostname, and a concrete `corsOptions.origin` hostname. Pass `"*"` only
* when equivalent Origin validation runs in trusted middleware upstream.
*/
allowedOriginHostnames?: string[] | "*";
/** Application props exposed through {@link getMcpAuthContext}. */
authContext?: McpAuthContext;
}
type StatelessMcpHandler = {
(request: Request, env: unknown, ctx: ExecutionContext): Promise<Response>;
fetch(
request: Request,
options?: McpHandlerRequestOptions
): Promise<Response>;
notify: ServerNotifier;
};
type StatelessMcpServerInput = McpServerFactory;
declare function createStatelessMcpHandler(
factory: StatelessMcpServerInput,
options?: CreateStatelessMcpHandlerOptions
): StatelessMcpHandler;
//#endregion
export {
McpAuthContext as a,
createStatelessMcpHandler as i,
StatelessMcpHandler as n,
getMcpAuthContext as o,
StatelessMcpServerInput as r,
CreateStatelessMcpHandlerOptions as t
};
//# sourceMappingURL=handler-stateless-C90kD5_R.d.ts.map