UNPKG

mcp-use

Version:

Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents, Clients and Servers with support for ChatGPT Apps, Code Mode, OAuth, Notifications, Sampling, Observability and more.

34 lines 1.15 kB
/** * Extended Hono Context types for MCP server */ import type { Context as HonoContext } from "hono"; import type { AuthInfo } from "../oauth/utils.js"; /** * Base MCP Context without OAuth */ export interface McpContextBase extends HonoContext { auth?: never; } /** * MCP Context with OAuth configured * * When OAuth is configured, the auth property is automatically populated * by the OAuth middleware and guaranteed to be available in tool callbacks. */ export interface McpContextWithAuth extends HonoContext { /** * Authentication information from OAuth provider * * Includes user info, JWT payload, access token, scopes, and permissions. * Always available when OAuth is configured since tools are protected by default. * * TypeScript knows this is always defined (non-undefined) when OAuth is configured. */ auth: AuthInfo; readonly __hasOAuth?: true; } /** * Conditional MCP Context type based on OAuth configuration */ export type McpContext<HasOAuth extends boolean = false> = HasOAuth extends true ? McpContextWithAuth : McpContextBase; //# sourceMappingURL=context.d.ts.map