deps

すべての MCP コンポーネントが共有する依存性プロバイダー: AppContext、get_app_context、get_client。

Dependency-injected values shared by the MCP components.

FastMCP resolves parameters declared as Depends(get_...) (or annotated with Context) when the component runs, and hides them from the component's input schema. Tools, resources and prompts therefore declare exactly what they need instead of digging into the request context themselves. AppContext is the single value the server lifespan yields, and every provider reads from it.

The insiders/routing providers read the request headers instead: an HTTP client opts into the experimental surface with the configured insiders header and describes its route with the configured routing headers. Over stdio there is no HTTP request at all, so the header lookup resolves to an empty mapping, the insiders surface stays disabled and behaviour is unchanged.

class novelai_image_mcp.deps.AppContext(client, settings)[ソース]

ベースクラス: object

Shared state yielded by the lifespan to every MCP request.

パラメータ:
client: NovelAIClient
settings: NovelAISettings
novelai_image_mcp.deps.get_app_context(ctx=CurrentContext())[ソース]

Return the lifespan AppContext for the current request.

パラメータ:

ctx (Context)

戻り値の型:

AppContext

novelai_image_mcp.deps.get_client(app=Depends(get_app_context))[ソース]

Return the shared NovelAIClient for the current request.

パラメータ:

app (AppContext)

戻り値の型:

NovelAIClient

novelai_image_mcp.deps.get_effective_features(config=Depends(get_insiders_config))[ソース]

Return the names of the features active for this request.

The header decides per request; MCP_INSIDERS_DISABLED_FEATURES is the operator kill switch and wins over anything a client sends.

パラメータ:

config (InsidersConfig)

戻り値の型:

frozenset[str]

novelai_image_mcp.deps.get_insiders_config(headers=CurrentHeaders())[ソース]

Parse the insiders opt-in header for the current request.

CurrentHeaders() resolves to an empty mapping when there is no HTTP request, so over stdio the insiders surface stays disabled and behaviour is unchanged.

パラメータ:

headers (dict[str, str])

戻り値の型:

InsidersConfig

novelai_image_mcp.deps.get_route_scoped_output()[ソース]

True when generated images belong under a per-route subdirectory.

戻り値の型:

bool

novelai_image_mcp.deps.get_routing_context(headers=CurrentHeaders())[ソース]

Resolve the routing context for the current request.

Routing is attempted only when the model-routing feature is active; otherwise the disabled context is returned and every routing field stays None.

パラメータ:

headers (dict[str, str])

戻り値の型:

RoutingContext