🚀 The fast, Pythonic way to build MCP servers and clients.
Clarify app visibility and configurable security guarantees (#5409)
Jeremiah Lowin769a370e4aa2
diff --git a/SECURITY.md b/SECURITY.mdindex 7b9d6ac9d..fa10c54be 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -24,6 +24,14 @@ The following are **out of scope**:- Limitations of upstream identity providers that FastMCP cannot control.- Issues that require the attacker to already have server-side access or control of the MCP server configuration.+### Security Boundaries++MCP Apps tool visibility (`AppConfig.visibility`, including `["app"]`) declares the intended audience and is **not a security boundary**. Hosts use it to filter the model's tool list, but FastMCP cannot distinguish model and app callers on the same MCP connection. Direct calls to app tools remain subject to the server's authentication and authorization checks. Tool names and hashed app-tool identities are routing identifiers, not secrets or access controls.++Security guarantees depend on the protections configured for the deployment. An HTTP server with `auth=None` does not require bearer-token authentication. Setting `require_authorization_consent=False` or `"external"` removes the OAuth proxy's consent and browser-binding protections against confused deputy attacks; `"external"` acknowledges external enforcement and suppresses a warning, but FastMCP does not provide or verify that enforcement. Other options that disable a protection or delegate it externally likewise remove that protection from FastMCP's guarantees.++Reports demonstrating a failure of an enabled authentication or authorization check, or another configured protection, remain in scope. Calling an app-visible tool directly or exercising a deliberately disabled protection does not by itself demonstrate a security bypass.+## Disclosure ProcessWhen we receive a valid report:diff --git a/docs/apps/architecture.mdx b/docs/apps/architecture.mdxindex 727697094..c7f316be3 100644--- a/docs/apps/architecture.mdx+++ b/docs/apps/architecture.mdx@@ -39,6 +39,8 @@ The tool and renderer are linked through a `resourceUri` field in the metadata.Second, it sets `meta["ui"]["visibility"]` to control who can see each tool. Entry points default to `["model"]` (LLM-visible). Backend tools default to `["app"]` (UI-only). Hosts use this to filter the tool list.+This metadata is not a security boundary: FastMCP accepts direct MCP calls to app tools regardless of the declared audience, subject to authentication and authorization. The MCP connection does not identify whether a call originated from the model or the UI. See [Tool visibility](/apps/low-level#tool-visibility).+## SerializationWhen a Prefab tool runs, its return value — a `PrefabApp` or a bare `Component` — becomes a JSON blob the renderer can interpret.@@ -99,6 +101,8 @@ When one identity is claimed by more than one tool — which happens when the saAuthorization still applies. The hashed path skips name and visibility transforms, but auth checks still run against the tool's `auth` config before execution.+Hashed tool names provide stable routing identities, not secrets or access controls. Knowing a hashed name grants no additional authorization, and hiding it from a model's tool list does not restrict access.+### Provider delegation`get_tool_by_hash` is defined on the `Provider` base class and overridden by aggregate and wrapped providers. Aggregate providers fan out the lookup across child providers in parallel. Wrapped providers (like `FastMCPProvider`, which wraps a nested `FastMCP` server) delegate to the inner server's hashed lookup. Backend tools are reachable through any depth of composition.diff --git a/docs/apps/fastmcp-app.mdx b/docs/apps/fastmcp-app.mdxindex 7e769eee0..94df30683 100644--- a/docs/apps/fastmcp-app.mdx+++ b/docs/apps/fastmcp-app.mdx@@ -78,7 +78,7 @@ def notes_app() -> PrefabApp:mcp = FastMCP("Notes Server", providers=[app])```-The model sees one tool: `notes_app`. Calling it opens the UI. When the user submits the form, `CallTool("add_note")` fires, the server saves the note, returns the updated list, and `SetState("notes", RESULT)` writes that list back into state. `ForEach("notes")` re-renders. The model never sees `add_note` — it's UI-only.+With a host that honors app visibility, the model sees one tool: `notes_app`. Calling it opens the UI. When the user submits the form, `CallTool("add_note")` fires, the server saves the note, returns the updated list, and `SetState("notes", RESULT)` writes that list back into state. `ForEach("notes")` re-renders. `add_note` is omitted from the model's tool list.## Why not just `@mcp.tool(app=True)`?@@ -90,6 +90,8 @@ A fair question. Any [Interactive Tool](/apps/prefab) can call a server tool —`FastMCPApp` owns these concerns. Entry points register as model-visible, backend tools register as UI-only, and hosts act on those declarations to decide what the model sees.+App tool visibility is not a security boundary. Backend tools remain callable through direct MCP requests by clients that know their names, subject to the server's authentication and authorization checks. Use [authorization](/servers/authorization) and server-side validation to enforce access and approval requirements; [visibility metadata](/apps/low-level#tool-visibility) only declares the intended audience.+Composition is handled by never writing the name down. `CallTool` takes a function reference, and FastMCP resolves it when the UI is serialized — to whatever that tool is actually called by then. Mount the server under a namespace and the button calls `notes_add_note`; put a gateway in front and it calls whatever the gateway lists. Since you never wrote a name, renaming cannot break it. [The architecture page](/apps/architecture) covers how that resolution works.The one rule that comes with this: **an app name must be unique within a server.** Composing the same app twice breaks its UI — two copies of `FastMCPApp("notes")` are indistinguishable no matter what namespaces you mount them under, so FastMCP declines to bind rather than picking one. Name apps for what they serve: `FastMCPApp("notes-acme")` and `FastMCPApp("notes-globex")`. [The architecture page](/apps/architecture) explains why identity works this way.@@ -98,7 +100,7 @@ The rest of this page covers each piece in turn.## `@app.ui()` — entry points-Entry points are what the model sees. They return a `PrefabApp` and default to `visibility=["model"]`, showing up in the LLM tool list but not callable from within the UI.+Entry points are what the model sees. They return a `PrefabApp` and default to `visibility=["model"]`, asking hosts to include them in the LLM tool list and reject calls to them from the UI.```python@app.ui()@@ -114,7 +116,7 @@ def dashboard() -> PrefabApp:## `@app.tool()` — backend tools-Backend tools do the work. By default they're visible only to the UI (`visibility=["app"]`), not the model.+Backend tools do the work. By default they declare `visibility=["app"]`, asking hosts to expose them to the UI and omit them from the model's tool list.```python@app.tool()diff --git a/docs/apps/low-level.mdx b/docs/apps/low-level.mdxindex 0cd1b0ea1..4fc6a1c64 100644--- a/docs/apps/low-level.mdx+++ b/docs/apps/low-level.mdx@@ -69,17 +69,26 @@ def my_tool() -> str:The `visibility` field controls where a tool appears:-- `["model"]` — visible to the LLM (the default behavior)+- `["model"]` — visible to the LLM- `["app"]` — callable from within the app UI, kept out of the LLM's tool list- `["model", "app"]` — both+Omitting `visibility` defaults to both audiences.+This is useful when you have tools that only make sense as part of the app's interactive flow, not as standalone LLM actions.+**App tool visibility is not a security boundary.** `visibility=["app"]` asks the host to omit a tool from the model's tool list; it does not authorize callers or prevent direct `tools/call` requests. The server cannot distinguish a model-originated request from an app-originated request on the same MCP connection. Any client that knows the tool's name can call it, subject to the server's [authentication](/servers/auth/authentication) and [authorization](/servers/authorization) checks. Enforce sensitive operations with those checks and server-side validation, rather than relying on visibility.+Visibility is a declaration, and on `tools/list` the host does the filtering — the division the MCP Apps specification defines. Every tool is advertised carrying its `visibility` metadata, which is also what lets a proxy or gateway forward it: an intermediary can only route to a tool it can see.-That division assumes a host stands between the server and the model. Where one doesn't, FastMCP applies the declaration itself. [Tool search](/servers/transforms/tool-search) and code mode reach the model as ordinary tool output rather than as an advertised listing, and their call-tool proxies execute a name the model supplies — nothing downstream can filter either, so app-only tools are excluded from both. The app's own UI still reaches its backends, because a UI calling by identity is not the model.+FastMCP also applies the declaration to its own model-facing surfaces. [Tool search](/servers/transforms/tool-search) and code mode exclude app-only tools from their results and call-tool proxies. This keeps the model's discovery consistent with the declared audience; direct MCP calls still use the server's authentication and authorization rules.```python+from fastmcp import FastMCP+from fastmcp.apps import AppConfig++mcp = FastMCP("My App Server")+@mcp.tool(app=AppConfig(resource_uri="ui://my-app/view.html",@@ -87,8 +96,8 @@ That division assumes a host stands between the server and the model. Where one))def refresh_data() -> str:- """Only callable from the app UI, not by the LLM."""- return fetch_latest()+ """Refresh data for the app UI."""+ return "Latest data"```### AppConfig fieldsdiff --git a/docs/deployment/http.mdx b/docs/deployment/http.mdxindex 2b0cec239..a5f34ee0c 100644--- a/docs/deployment/http.mdx+++ b/docs/deployment/http.mdx@@ -147,7 +147,7 @@ export FASTMCP_HTTP_ALLOWED_HOSTS='["mcp.example.com"]'export FASTMCP_HTTP_ALLOWED_ORIGINS='["https://app.example.com"]'```-Use `host_origin_protection="auto"` to protect localhost-bound direct servers while allowing ASGI, serverless, and reverse-proxy deployments to keep their existing Host handling unless they configure explicit trust rules. Use `host_origin_protection=False` to keep the request guard disabled.+Use `host_origin_protection="auto"` to protect localhost-bound direct servers while allowing ASGI, serverless, and reverse-proxy deployments to keep their existing Host handling unless they configure explicit trust rules. The default `host_origin_protection=False` disables the request guard: FastMCP then provides no Host/Origin validation or DNS-rebinding protection for this endpoint. This reduces protection compared with `True`; if you rely on a reverse proxy for these checks, you must configure and enforce them there. Authentication and CORS serve separate purposes and do not replace Host/Origin validation.### Gateway Routing Headersdiff --git a/docs/more/settings.mdx b/docs/more/settings.mdxindex e6ea0f584..7f0fe5df5 100644--- a/docs/more/settings.mdx+++ b/docs/more/settings.mdx@@ -43,7 +43,7 @@ These control how the server listens when running with an HTTP transport.| `FASTMCP_STREAMABLE_HTTP_PATH` | `str` | `/mcp` | Path for Streamable HTTP endpoint. || `FASTMCP_STATELESS_HTTP` | `bool` | `false` | Enable stateless HTTP mode (new transport per request). Useful for multi-worker deployments. || `FASTMCP_JSON_RESPONSE` | `bool` | `false` | Use JSON responses instead of SSE for Streamable HTTP. |-| `FASTMCP_HTTP_HOST_ORIGIN_PROTECTION` | `bool \| "auto"` | `false` | Validate `Host` and browser `Origin` headers for Streamable HTTP requests. `auto` protects localhost-bound servers and explicit host/origin allowlists. |+| `FASTMCP_HTTP_HOST_ORIGIN_PROTECTION` | `bool \| "auto"` | `false` | Validate `Host` and browser `Origin` headers for Streamable HTTP requests. `auto` protects localhost-bound servers and explicit host/origin allowlists. `false` disables this guard and FastMCP's DNS-rebinding protection for the endpoint. || `FASTMCP_HTTP_ALLOWED_HOSTS` | `list[str] \| null` | `null` | Additional trusted hostnames when Host and Origin protection is enabled. Use a JSON array, such as `["mcp.example.com"]`. || `FASTMCP_HTTP_ALLOWED_ORIGINS` | `list[str] \| null` | `null` | Browser origins trusted when Host and Origin protection is enabled. Configure CORS separately for cross-origin browser reads. Use a JSON array, such as `["https://app.example.com"]`. || `FASTMCP_HTTP_SESSION_IDLE_TIMEOUT` | `float \| null` | `null` | Seconds a Streamable HTTP session may remain idle before it is terminated. The deadline resets on every request. When `null`, sessions never expire from inactivity. Not supported in stateless mode. |@@ -93,6 +93,8 @@ These control FastMCP's SSRF protection for the outbound fetches it makes duringBy default, FastMCP protects its OAuth and JWKS fetches against [SSRF](https://owasp.org/www-community/attacks/Server_Side_Request_Forgery) by resolving the target hostname, rejecting any address that maps to a private, loopback, link-local, or reserved IP, and then pinning the connection to that validated IP.+Setting `FASTMCP_SSRF_TRUST_PROXY=true` disables FastMCP's local DNS/IP checks and connection pinning. This reduces SSRF protection unless the configured proxy enforces equivalent destination restrictions. FastMCP verifies that a proxy is configured, but does not verify its security policy.+This breaks when a corporate `CONNECT` proxy is the only egress path: the container often cannot resolve external DNS at all (only the proxy can), and even when it can, pinning to the IP makes TLS verification fail because public certificates list hostnames, not IP addresses.Set `FASTMCP_SSRF_TRUST_PROXY=true` when a trusted proxy is your mandated egress. FastMCP then skips DNS resolution and the IP blocklist entirely and makes a single request to the hostname URL, explicitly routed through the proxy named by the standard `HTTPS_PROXY` / `ALL_PROXY` environment variables (checked in that order). The HTTPS-only and hostname checks still apply.diff --git a/docs/servers/auth/authentication.mdx b/docs/servers/auth/authentication.mdxindex a948a647c..c1cd927cf 100644--- a/docs/servers/auth/authentication.mdx+++ b/docs/servers/auth/authentication.mdx@@ -15,6 +15,8 @@ Authentication in MCP presents unique challenges that differ from traditional weAuthentication applies only to FastMCP's HTTP-based transports (`http` and `sse`). The STDIO transport inherits security from its local execution environment.</Tip>+FastMCP servers default to `auth=None`. For HTTP transports, this means the MCP endpoint accepts requests without bearer-token authentication, and components without authorization checks are accessible to anyone who can reach it. Configure an `AuthProvider` for a protected endpoint. If you enforce authentication in a gateway instead, you are responsible for that protection and for preventing direct access to the server; FastMCP does not verify the gateway's enforcement.+<Warning>**Authentication is rapidly evolving in MCP.** The specification and best practices are changing quickly. FastMCP aims to provide stable, secure patterns that adapt to these changes while keeping your code simple and maintainable.</Warning>@@ -257,4 +259,4 @@ The authentication approach you choose depends on your existing infrastructure,**Full OAuth implementation should be avoided unless you have compelling reasons that external providers cannot address.** Air-gapped environments, specialized compliance requirements, or unique organizational constraints might justify this approach, but it requires significant security expertise and ongoing maintenance commitment. The complexity extends far beyond initial implementation to include threat monitoring, security updates, and keeping pace with evolving attack vectors.-FastMCP's architecture supports migration between these approaches as your requirements evolve. You can integrate with existing token systems initially and migrate to external identity providers as your application scales, or implement custom solutions when your requirements outgrow standard patterns.\ No newline at end of file+FastMCP's architecture supports migration between these approaches as your requirements evolve. You can integrate with existing token systems initially and migrate to external identity providers as your application scales, or implement custom solutions when your requirements outgrow standard patterns.diff --git a/docs/servers/auth/oauth-proxy.mdx b/docs/servers/auth/oauth-proxy.mdxindex 33e4848eb..1abc98a60 100644--- a/docs/servers/auth/oauth-proxy.mdx+++ b/docs/servers/auth/oauth-proxy.mdx@@ -13,7 +13,7 @@ The OAuth proxy enables FastMCP servers to authenticate with OAuth providers thaMCP clients expect to register automatically and obtain credentials on the fly, but traditional providers require manual app registration through their developer consoles. The OAuth proxy bridges this gap by presenting a DCR-compliant interface to MCP clients while using your pre-registered credentials with the upstream provider. When a client attempts to register, the proxy returns your fixed credentials. When a client initiates authorization, the proxy handles the complexity of callback forwarding—storing the client's dynamic callback URL, using its own fixed callback with the provider, then forwarding back to the client after token exchange.-This approach enables any MCP client (whether using random localhost ports or fixed URLs like Claude.ai) to authenticate with any traditional OAuth provider, all while maintaining full OAuth 2.1 and PKCE security.+This approach enables any MCP client (whether using random localhost ports or fixed URLs like Claude.ai) to authenticate with traditional OAuth providers. By default, the proxy applies consent and browser-binding protections and forwards PKCE upstream. Options that disable these checks reduce the corresponding security protections, as described below.<Note>For providers that support OIDC discovery (Auth0, Google with OIDC@@ -321,7 +321,7 @@ auth = OAuthProxy(..., client_storage=MemoryStore())Ordinary upstream OAuth consent is generally not equivalent. It typically authorizes FastMCP's shared upstream application without identifying the downstream MCP client or binding approval to that client's transaction. Use `"external"` only when your surrounding authorization system supplies those protections.**`False` — disable entirely:**- Authorization proceeds directly to the upstream provider without any consent UI. Logs a security warning. Only for local development or testing.+ Authorization proceeds directly to the upstream provider without FastMCP's consent UI or browser-binding checks. This removes the proxy's protections against confused deputy and AS-in-the-middle attacks. Logs a security warning. Only for local development or testing.```python# Development/testing only - skip consent screen@@ -338,13 +338,15 @@ auth = OAuthProxy(..., client_storage=MemoryStore())```<Warning>- Both `False` and `"external"` disable FastMCP's consent and browser-binding protections. `False` warns about this configuration; `"external"` suppresses the warning because it is an operator acknowledgment that equivalent protections exist elsewhere. Prefer the default `True` unless you own that external authorization flow.+ Both `False` and `"external"` disable FastMCP's consent and browser-binding protections and reduce security unless equivalent checks are enforced elsewhere. `"external"` changes logging, not the authorization path: it does not make the flow safe, and FastMCP does not verify the external protections. Without equivalent enforcement, these modes leave the flow exposed to confused deputy and AS-in-the-middle attacks. Prefer the default `True`.</Warning></ParamField><ParamField body="consent_csp_policy" type="str | None" default="None">Content Security Policy for the consent page.+ Setting `""` removes FastMCP's consent-page CSP, and a custom policy replaces the built-in policy. Disabling or weakening it reduces browser protections against content injection unless your deployment supplies an equivalent CSP header; FastMCP does not verify that header.+- `None` (default): Uses the built-in CSP policy with appropriate directives for form submission- Empty string `""`: Disables CSP entirely (no meta tag rendered)- Custom string: Uses the provided value as the CSP policy@@ -479,7 +481,7 @@ The client initiates OAuth by redirecting to the proxy's `/authorize` endpoint.3. Shows the user a consent page with the client's details, redirect URI, and requested scopes4. If the user approves (or the client was previously approved), sets a consent binding cookie and redirects to the upstream provider using the fixed callback URL-This dual-PKCE approach maintains end-to-end security at both the client-to-proxy and proxy-to-provider layers. The consent step protects against confused deputy attacks by ensuring you explicitly approve each client before it can complete authorization, and the consent binding cookie ensures that only the browser that approved consent can complete the callback.+With the default configuration, this dual-PKCE approach protects both the client-to-proxy and proxy-to-provider layers. The consent step protects against confused deputy attacks by requiring explicit client approval, and the consent binding cookie ensures that only the browser that approved consent can complete the callback. `require_authorization_consent=False` and `"external"` skip both consent and cookie verification; `"remember"` can silently approve return visits and provides weaker protection than `True`.### Callback Phase@@ -559,6 +561,8 @@ The proxy issues its own refresh tokens that map to upstream refresh tokens. WheThe OAuth proxy automatically handles PKCE (Proof Key for Code Exchange) when working with providers that support or require it. The proxy generates its own PKCE parameters to send upstream while separately validating the client's PKCE, ensuring end-to-end security at both layers.+Setting `forward_pkce=False` removes PKCE from the proxy-to-provider exchange, reducing protection against upstream authorization-code interception. Client-to-proxy PKCE remains enforced. Use this override only for an upstream provider that cannot support PKCE.+This is enabled by default via the `forward_pkce` parameter and works seamlessly with providers like Google, Azure AD, and GitHub. Only disable it for legacy providers that don't support PKCE:```python@@ -781,6 +785,8 @@ Configure the following parameters together: provide a unique `jwt_signing_key`A confused deputy attack allows a malicious client to steal your authorization by tricking you into granting it access under your identity.+The consent and browser-session protections described here apply when `require_authorization_consent` is `True` or `"remember"`. Setting it to `False` or `"external"` disables both protections. Ordinary upstream OAuth consent generally approves FastMCP's shared upstream application, not the downstream MCP client's transaction, so it does not replace these checks.+The OAuth proxy works by bridging DCR clients to traditional auth providers, which means that multiple MCP clients connect through a single upstream OAuth application. An attacker can exploit this shared application by registering a malicious client with their own redirect URI, then sending you an authorization link. When you click it, your browser goes through the OAuth flow—but since you may have already authorized this OAuth app before, the provider might auto-approve the request. The authorization code then gets sent to the attacker's redirect URI instead of a legitimate client, giving them access under your credentials.#### Mitigationdiff --git a/docs/servers/auth/oidc-proxy.mdx b/docs/servers/auth/oidc-proxy.mdxindex be4bcb22d..3a7314a4b 100644--- a/docs/servers/auth/oidc-proxy.mdx+++ b/docs/servers/auth/oidc-proxy.mdx@@ -207,11 +207,15 @@ auth = OIDCProxy(<ParamField body="require_authorization_consent" type='bool | Literal["remember", "external"]' default="True">Consent screen behavior for authorization requests. Accepts `True` (default; always prompt — strongest protection), `"remember"` (silent consent on return visits via signed cookie, gated by `Sec-Fetch-Site` to block AS-in-the-middle attacks), `"external"` (same authorization path as `False`, but the warning is suppressed because the operator asserts that equivalent protections are enforced externally), or `False` (disable entirely; local/testing only). See the [OAuthProxy documentation](/servers/auth/oauth-proxy) for full details on each mode and the security trade-offs.++ `False` and `"external"` disable FastMCP's consent and browser-binding checks, reducing protection against confused deputy and AS-in-the-middle attacks unless equivalent checks are enforced elsewhere. FastMCP does not provide or verify external enforcement. `"remember"` is also weaker than the default `True`, since its cross-site detection is a browser heuristic.</ParamField><ParamField body="consent_csp_policy" type="str | None" default="None">Content Security Policy for the consent page.+ Disabling or weakening this policy reduces browser protections against content injection unless your deployment supplies an equivalent CSP header; FastMCP does not verify that header.+- `None` (default): Uses the built-in CSP policy with appropriate directives for form submission- Empty string `""`: Disables CSP entirely (no meta tag rendered)- Custom string: Uses the provided value as the CSP policydiff --git a/docs/servers/authorization.mdx b/docs/servers/authorization.mdxindex 823ba8ff0..ab278be02 100644--- a/docs/servers/authorization.mdx+++ b/docs/servers/authorization.mdx@@ -14,7 +14,7 @@ Authorization controls what authenticated users can do with your FastMCP server.The authorization model centers on a simple concept: callable functions that receive context about the current request and return `True` to allow access or `False` to deny it. Multiple checks combine with AND logic, meaning all checks must pass for access to be granted.<Note>-Authorization relies on OAuth tokens which are only available with HTTP transports (SSE, Streamable HTTP). In STDIO mode, there's no OAuth mechanism, so `get_access_token()` returns `None` and all auth checks are skipped.+Authorization relies on OAuth tokens which are only available with HTTP transports (SSE, Streamable HTTP). In STDIO mode, there's no OAuth mechanism, so `get_access_token()` returns `None` and all auth checks are skipped. STDIO access is controlled by the local execution environment; component auth checks do not restrict the process connected over STDIO.</Note><Note>diff --git a/docs/servers/transforms/tool-search.mdx b/docs/servers/transforms/tool-search.mdxindex 815bea09e..4631eac37 100644--- a/docs/servers/transforms/tool-search.mdx+++ b/docs/servers/transforms/tool-search.mdx@@ -206,7 +206,7 @@ Tools discovered through search can also be called directly via `client.call_tooSearch results respect the full authorization pipeline. Tools filtered by middleware, visibility transforms, or component-level auth checks won't appear in search results.-App-only tools are excluded too. A [MCP app](/apps/overview) can declare backend tools that only its UI may call, and normally the host keeps those from the model. A search result is tool output rather than an advertised listing, so no host filtering applies to it — the exclusion happens here instead. The `call_tool` proxy enforces the same boundary, since it executes a name the model supplies.+App-only tools are excluded too. A [MCP app](/apps/overview) can declare backend tools intended for its UI, and hosts use that declaration to omit them from the model's tool list. A search result is tool output rather than an advertised listing, so the search transform applies that filtering itself. Its `call_tool` proxy also excludes app-only tools. [App visibility is not a security boundary](/apps/low-level#tool-visibility): clients can still call these tools directly through MCP, subject to the server's authentication and authorization checks.The search tool queries `list_tools()` through the complete pipeline at search time, so the same filtering that controls what a client sees in the listing also controls what they can discover through search.diff --git a/fastmcp_slim/fastmcp/apps/config.py b/fastmcp_slim/fastmcp/apps/config.pyindex 1686d8626..4930c25d9 100644--- a/fastmcp_slim/fastmcp/apps/config.py+++ b/fastmcp_slim/fastmcp/apps/config.py@@ -90,6 +90,11 @@ class AppConfig(BaseModel):to render and where the tool appears. On resources, those fields mustbe left unset (the resource itself is the UI).+ `visibility` declares the intended audience; it is not a security boundary.+ Direct MCP calls remain subject to authentication and authorization,+ regardless of visibility. The server cannot distinguish model and app+ callers on the same connection.+All fields use ``exclude_none`` serialization so only explicitly-setvalues appear on the wire. Aliases match the MCP Apps wire format(camelCase).@@ -101,9 +106,13 @@ class AppConfig(BaseModel):serialization_alias="resourceUri",description="URI of the UI resource (typically ui:// scheme). Tools only.",)+ # Audience metadata, not access control: direct tools/call remains possible.visibility: list[Literal["app", "model"]] | None = Field(default=None,- description="Where this tool is visible: 'app', 'model', or both. Tools only.",+ description=(+ "Intended audience: 'app', 'model', or both. Tools only. "+ "Not a security boundary; direct calls use the server's authorization rules."+ ),)csp: ResourceCSP | None = Field(default=None, description="Content Security Policy for the app iframe"@@ -186,7 +195,10 @@ def app_config_to_meta_dict(app: AppConfig | dict[str, Any]) -> dict[str, Any]:def is_model_visible(component: FastMCPComponent) -> bool:- """Whether a component may be shown to, or invoked by, the model.+ """Whether a component belongs on model-facing discovery and proxy surfaces.++ This is audience filtering, not authorization. Direct MCP calls do not+ use this predicate and cannot identify model versus app callers.Visibility is a declaration, and the MCP Apps spec puts the filtering onthe host — so ``tools/list`` carries app-only tools and the host keepsdiff --git a/fastmcp_slim/fastmcp/server/auth/oauth_proxy/proxy.py b/fastmcp_slim/fastmcp/server/auth/oauth_proxy/proxy.pyindex fe2d06f73..669fa9f03 100644--- a/fastmcp_slim/fastmcp/server/auth/oauth_proxy/proxy.py+++ b/fastmcp_slim/fastmcp/server/auth/oauth_proxy/proxy.py@@ -373,6 +373,8 @@ class OAuthProxy(OAuthProvider, ConsentMixin):valid_scopes: List of all the possible valid scopes for a client.These are advertised to clients through the `/.well-known` endpoints. Defaults to `required_scopes` if not provided.forward_pkce: Whether to forward PKCE to upstream server (default True).+ False removes protection against authorization-code interception+ on the upstream exchange; client-to-proxy PKCE still applies.Enable for providers that support/require PKCE (Google, Azure, AWS, etc.).Disable only if upstream provider doesn't support PKCE.token_endpoint_auth_method: Token endpoint authentication method for upstream server.@@ -402,12 +404,17 @@ class OAuthProxy(OAuthProvider, ConsentMixin):suppress the warning as an operator acknowledgment that equivalentconsent and transaction-binding protections are enforced externally.FastMCP does not provide or verify those external protections.+ Both False and "external" remove FastMCP's consent and browser+ binding checks, reducing security unless equivalent checks exist+ elsewhere; ordinary upstream consent is not equivalent.- False: skip consent entirely. SECURITY WARNING: only set toFalse for local development or testing environments.consent_csp_policy: Content Security Policy for the consent page.If None (default), uses the built-in CSP policy with appropriate directives.If empty string "", disables CSP entirely (no meta tag is rendered).If a non-empty string, uses that as the CSP policy value.+ Disabling or weakening CSP reduces browser content-injection+ protections unless the deployment supplies an equivalent CSP header.This allows organizations with their own CSP policies to override or disablethe built-in CSP directives.fallback_access_token_expiry_seconds: Expiry time to use when upstream provider@@ -1207,7 +1214,9 @@ class OAuthProxy(OAuthProvider, ConsentMixin):ttl=15 * 60, # Auto-expire after 15 minutes)- # If consent is disabled or handled externally, skip consent screen.+ # False and "external" both remove FastMCP's consent and browser-binding+ # protections against confused deputy attacks. "external" only suppresses+ # the warning; FastMCP does not provide or verify external enforcement.# "remember" mode still routes through /consent so cookie lookup and# Sec-Fetch-Site gating can run.if self._require_authorization_consent in (False, "external"):@@ -2730,6 +2739,8 @@ class OAuthProxy(OAuthProvider, ConsentMixin):# IdP URL) won't have this cookie and will be rejected. "remember"# mode still issues consent tokens (on silent approval or HTML# approval), so both code paths need binding verification.+ # False and "external" intentionally skip this security check, so+ # those modes require equivalent protection outside FastMCP.if self._require_authorization_consent in (True, "remember"):consent_token = transaction_model.consent_tokenif not consent_token:diff --git a/fastmcp_slim/fastmcp/server/auth/oauth_proxy/ui.py b/fastmcp_slim/fastmcp/server/auth/oauth_proxy/ui.pyindex 4ae6b5fb5..12f01dc6b 100644--- a/fastmcp_slim/fastmcp/server/auth/oauth_proxy/ui.py+++ b/fastmcp_slim/fastmcp/server/auth/oauth_proxy/ui.py@@ -193,7 +193,8 @@ def create_consent_html(# Determine CSP policy to use# If csp_policy is None, build the default CSP policy- # If csp_policy is empty string, CSP will be disabled entirely in create_page+ # An empty policy removes this page's CSP protection against content injection.+ # A deployment-supplied CSP header may replace it, but is not verified here.# If csp_policy is a non-empty string, use it as-isif csp_policy is None:# The consent form posts to itself (action="") and all subsequent redirectsdiff --git a/fastmcp_slim/fastmcp/server/auth/oidc_proxy.py b/fastmcp_slim/fastmcp/server/auth/oidc_proxy.pyindex 1075ac77c..a9a898a0a 100644--- a/fastmcp_slim/fastmcp/server/auth/oidc_proxy.py+++ b/fastmcp_slim/fastmcp/server/auth/oidc_proxy.py@@ -367,11 +367,16 @@ class OIDCProxy(OAuthProxy):When "external", authorization follows the same direct path as False,but the warning is suppressed as an operator acknowledgment thatequivalent protections are enforced externally.+ False and "external" disable FastMCP's consent and browser-binding+ protections, reducing security unless equivalent checks exist elsewhere.+ FastMCP does not provide or verify those external checks.SECURITY WARNING: Only set to False for local development or testing environments.consent_csp_policy: Content Security Policy for the consent page.If None (default), uses the built-in CSP policy with appropriate directives.If empty string "", disables CSP entirely (no meta tag is rendered).If a non-empty string, uses that as the CSP policy value.+ Disabling or weakening CSP reduces browser content-injection protections+ unless the deployment supplies an equivalent CSP header.extra_authorize_params: Additional parameters to forward to the upstream authorization endpoint.Useful for provider-specific parameters like prompt=consent or access_type=offline.Example: {"prompt": "consent", "access_type": "offline"}diff --git a/fastmcp_slim/fastmcp/server/auth/ssrf.py b/fastmcp_slim/fastmcp/server/auth/ssrf.pyindex 40da15a47..8a26960ee 100644--- a/fastmcp_slim/fastmcp/server/auth/ssrf.py+++ b/fastmcp_slim/fastmcp/server/auth/ssrf.py@@ -13,6 +13,10 @@ passed to httpx2 explicitly with ``trust_env`` disabled, so the request is provarouted through the proxy rather than predicted to be — NO_PROXY is not evaluated inthis mode. If no proxy is configured, the fetch is refused rather than sent directwith the blocklist disabled.++Proxy-trust mode removes FastMCP's DNS/IP checks and pinning. SSRF protection+then depends on the proxy's destination restrictions, which FastMCP does not+verify; configuring a proxy alone does not establish equivalent protection."""from __future__ import annotationsdiff --git a/fastmcp_slim/fastmcp/server/http.py b/fastmcp_slim/fastmcp/server/http.pyindex 7bd8fff99..9e3dc0dd6 100644--- a/fastmcp_slim/fastmcp/server/http.py+++ b/fastmcp_slim/fastmcp/server/http.py@@ -495,7 +495,8 @@ def create_sse_app())else:- # No auth required+ # auth=None removes bearer-token enforcement. A gateway's authentication+ # is outside FastMCP's guarantees and must prevent direct unauthenticated access.async def sse_endpoint(request: Request) -> Response:return await handle_sse(request.scope, request.receive, request._send)@@ -630,7 +631,8 @@ def create_streamable_http_app())else:- # No auth required+ # auth=None removes bearer-token enforcement. A gateway's authentication+ # is outside FastMCP's guarantees and must prevent direct unauthenticated access.http_methods = ["POST", "DELETE"] if stateless_http else Noneserver_routes.append(Route(@@ -649,6 +651,8 @@ def create_streamable_http_app(if host_origin_protection not in (True, False, "auto"):raise ValueError("host_origin_protection must be True, False, or 'auto'.")+ # False removes FastMCP's Host/Origin guard. The SDK guard is also disabled+ # below, so DNS-rebinding protection then depends on the deployment.if host_origin_protection is not False:server_middleware.insert(0,diff --git a/fastmcp_slim/fastmcp/server/server.py b/fastmcp_slim/fastmcp/server/server.pyindex bc95e2c33..c6cfd1057 100644--- a/fastmcp_slim/fastmcp/server/server.py+++ b/fastmcp_slim/fastmcp/server/server.py@@ -241,6 +241,8 @@ def _get_auth_context() -> tuple[bool, Any]:is_stdio = _current_transport.get() == "stdio"if is_stdio:+ # STDIO trusts the local execution environment; component authorization+ # provides no access restriction on this transport.return (True, None)from fastmcp.server.dependencies import get_access_token