Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/PrefectHQ/fastmcp
/ functions
Functions
12,199 in github.com/PrefectHQ/fastmcp
⨍
Functions
12,199
◇
Types & classes
1,854
↳
Endpoints
123
↓ 13 callers
Function
task_redis_prefix
Return the Redis key prefix that owns a given scope. Authenticated tasks live under ``fastmcp:task:auth:{enc_scope}``; anonymous tasks live u
fastmcp_tasks/fastmcp_tasks/keys.py:197
↓ 12 callers
Function
_is_http_target
Return True if the resolved target will use an HTTP-based transport. MCPConfig dicts are excluded because ``MCPConfigTransport`` manages indi
fastmcp_slim/fastmcp/cli/client.py:158
↓ 12 callers
Function
_make_token
( *, token: str = "tok", client_id: str = "client-1", scopes: list[str] | None = None, exp
tests/utilities/test_token_cache.py:11
↓ 12 callers
Method
_matches
Check if this transform applies to the component. All specified criteria must match (intersection semantics). An empty rule (no crite
fastmcp_slim/fastmcp/server/transforms/visibility.py:125
↓ 12 callers
Function
_parse_mcp_config
Parse an mcpServers-style JSON file into discovered servers.
fastmcp_slim/fastmcp/cli/discovery.py:129
↓ 12 callers
Method
_prepare_scopes_for_upstream_refresh
Prepare scopes for Azure token refresh. Azure requires fully-qualified scopes and only allows ONE resource per token request (AADSTS2
fastmcp_slim/fastmcp/server/auth/providers/azure.py:522
↓ 12 callers
Function
_replace_ref_with_defs
Replace openapi $ref with jsonschema $defs recursively. Examples: - {"type": "object", "properties": {"$ref": "#/components/schemas/..."
fastmcp_slim/fastmcp/utilities/openapi/schemas.py:76
↓ 12 callers
Method
add_prompt
Add a prompt to the server. Args: prompt: A Prompt instance or @prompt-decorated function to add Returns: Th
fastmcp_slim/fastmcp/server/server.py:2091
↓ 12 callers
Method
assert_called
Assert that a hook was called a specific number of times.
tests/server/middleware/test_middleware_nested.py:76
↓ 12 callers
Function
auth_scope
Bind (or clear) the auth context so `get_task_scope` sees a caller.
tests/tasks/task_helpers.py:72
↓ 12 callers
Method
convert_result
Convert a raw result to ToolResult. Handles ToolResult passthrough and converts raw values using the tool's attributes (output_schema
fastmcp_slim/fastmcp/tools/base.py:367
↓ 12 callers
Function
create_command
Generate a CIMD document for hosting. Create a Client ID Metadata Document that you can host at an HTTPS URL. The URL where you host this doc
fastmcp_slim/fastmcp/cli/cimd.py:32
↓ 12 callers
Function
drive_auth_flow
Drive an httpx auth flow to completion, feeding each yield to responder.
tests/client/auth/test_client_credentials.py:98
↓ 12 callers
Function
extract_components
Extract all MCP components from a module. Scans all module attributes for instances of Tool, Resource, ResourceTemplate, or Prompt objects cr
fastmcp_slim/fastmcp/server/providers/filesystem_discovery.py:285
↓ 12 callers
Method
generate
Generate an RSA key pair for testing. Returns: RSAKeyPair: Generated key pair
fastmcp_slim/fastmcp/server/auth/providers/jwt.py:103
↓ 12 callers
Function
generate_cli_command
Generate a standalone CLI script from an MCP server. Connects to the server, reads its tools/resources/prompts, and writes a Python script th
fastmcp_slim/fastmcp/cli/generate.py:670
↓ 12 callers
Function
get_log_lines
Get log lines from a caplog fixture.
tests/server/middleware/test_logging.py:27
↓ 12 callers
Function
get_server
Get the current FastMCP server instance directly. In a background-task worker the tasks extension's resolver is consulted first, so a mounted
fastmcp_slim/fastmcp/server/dependencies.py:457
↓ 12 callers
Function
make_upstream
()
tests/server/providers/proxy/test_server_metadata.py:141
↓ 12 callers
Function
parse_task_key
Parse Docket task key to extract metadata. Args: task_key: Encoded task key from Docket Returns: Dict with keys: ``task_scop
fastmcp_tasks/fastmcp_tasks/keys.py:118
↓ 12 callers
Function
parse_tool_arguments
Build a tool-call argument dict from CLI inputs. A single JSON object argument is treated as the full argument dict. ``--input-json`` provide
fastmcp_slim/fastmcp/cli/client.py:298
↓ 12 callers
Method
ping
()
tests/client/client/test_mode_negotiation.py:97
↓ 12 callers
Method
read_resource_mcp
Send a resources/read request and return the complete MCP protocol result. Args: uri (AnyUrl | str): The URI of the resource to r
fastmcp_slim/fastmcp/client/mixins/resources.py:215
↓ 12 callers
Method
supports_tasks
Check if this component supports task execution.
fastmcp_slim/fastmcp/utilities/tasks.py:60
↓ 12 callers
Function
use_horizon_api
( monkeypatch: pytest.MonkeyPatch, )
tests/cli/deploy/test_command.py:84
↓ 12 callers
Function
validate_url
Validate URL for SSRF and resolve to IPs. Args: url: URL to validate require_path: If True, require non-root path (for CIMD)
fastmcp_slim/fastmcp/server/auth/ssrf.py:274
↓ 11 callers
Function
_adder
()
tests/server/middleware/test_message_visibility.py:59
↓ 11 callers
Method
_app
(marker: str = "x", app_name: str = "contacts")
tests/server/providers/test_prefab_roundtrip.py:261
↓ 11 callers
Method
_convert_to_anthropic_messages
( messages: Sequence[SamplingMessage], )
fastmcp_slim/fastmcp/client/sampling/handlers/anthropic.py:177
↓ 11 callers
Method
_get_resource_url
Get the actual resource URL being protected. Uses ``resource_base_url`` if set; otherwise falls back to ``base_url``. Args:
fastmcp_slim/fastmcp/server/auth/auth.py:456
↓ 11 callers
Function
_idp_jwks
Build a JWKS document from an RSA key pair's public key.
tests/server/auth/oauth_proxy/test_identity_assertion.py:47
↓ 11 callers
Function
_schema_to_python_type
Convert a JSON Schema to a Python type annotation. Returns (type_annotation, needs_json_parsing).
fastmcp_slim/fastmcp/cli/generate.py:69
↓ 11 callers
Function
build_task_key
Build Docket task key with embedded metadata. When ``task_scope`` is ``None`` the task is anonymous and lives in the ``anon`` keyspace. Othe
fastmcp_tasks/fastmcp_tasks/keys.py:79
↓ 11 callers
Function
download_skill
Download a skill and all its files to a local directory. Creates a subdirectory named after the skill containing all files. Args: cl
fastmcp_slim/fastmcp/utilities/skills.py:127
↓ 11 callers
Method
enable_components
Enable components matching criteria for this session only. Session rules override global transforms. Rules accumulate - each call add
fastmcp_slim/fastmcp/server/context.py:1199
↓ 11 callers
Function
get_http_request
Get the current HTTP request. Tries MCP SDK's request_ctx first, then falls back to FastMCP's HTTP context.
fastmcp_slim/fastmcp/server/dependencies.py:520
↓ 11 callers
Method
get_request
( self, *, url: str | re.Pattern[str] | httpx2.URL | None = None, method: str
tests/utilities/httpx2_mock.py:189
↓ 11 callers
Method
initialize
Send an initialize request to the server. This method performs the MCP initialization handshake with the server, exchanging capabilit
fastmcp_slim/fastmcp/client/client.py:891
↓ 11 callers
Function
load_mcp_server_config
Load a FastMCP configuration from a fastmcp.json file. Args: config_path: Path to fastmcp.json file Returns: MCPServerConfig
fastmcp_slim/fastmcp/cli/run.py:124
↓ 11 callers
Function
make_m2m_responder
Build a responder for the standard M2M discovery + token exchange flow. Returns the responder and a dict that captures the token request and the
tests/client/auth/test_client_credentials.py:39
↓ 11 callers
Function
mock_transport
( handler: Callable[[httpx2.Request], httpx2.Response], )
tests/cli/deploy/test_horizon_client.py:21
↓ 11 callers
Method
read
Read the resource by calling the wrapped function.
fastmcp_slim/fastmcp/resources/function_resource.py:201
↓ 11 callers
Method
report_progress
Report progress for the current operation. Works in both foreground (MCP progress notifications) and background (Docket task executio
fastmcp_slim/fastmcp/server/context.py:453
↓ 11 callers
Function
require_roles
Require all of the given roles, read from the token's claims. Roles and groups are not part of OIDC, so every identity provider puts them som
fastmcp_slim/fastmcp/utilities/authorization.py:148
↓ 11 callers
Method
start_as_current_span
( self, name: str, context: Context | None = None, kind: SpanKind = SpanKind.I
fastmcp_slim/fastmcp/telemetry.py:66
↓ 11 callers
Method
store_event
Store an event and return its ID. Args: stream_id: ID of the stream the event belongs to message: The JSON-RPC messag
fastmcp_slim/fastmcp/server/event_store.py:120
↓ 11 callers
Function
validate_redirect_uri
Validate a redirect URI against allowed patterns. Args: redirect_uri: The redirect URI to validate allowed_patterns: List of allo
fastmcp_slim/fastmcp/server/auth/redirect_validation.py:427
↓ 11 callers
Function
with_argv
Temporarily replace sys.argv if args provided. This context manager is used at the CLI boundary to inject server arguments when needed, witho
fastmcp_slim/fastmcp/cli/cli.py:76
↓ 10 callers
Method
_bind
Bind this OAuth provider to a specific MCP server URL. Called automatically when mcp_url is provided to __init__, or by the transport
fastmcp_slim/fastmcp/client/auth/oauth.py:271
↓ 10 callers
Method
_convert_to_openai_messages
( system_prompt: str | None, messages: Sequence[SamplingMessage] )
fastmcp_slim/fastmcp/client/sampling/handlers/openai.py:183
↓ 10 callers
Function
_mock_httpx_client
Build a mock httpx2.AsyncClient whose stream() yields a canned response. The returned client's ``.stream.call_args`` exposes the request that was
tests/server/auth/test_ssrf_protection.py:23
↓ 10 callers
Function
app_config_to_meta_dict
Convert an AppConfig or dict to the wire-format dict for ``meta["ui"]``.
fastmcp_slim/fastmcp/apps/config.py:181
↓ 10 callers
Function
build_transport
(config: RemoteConfig)
fastmcp_remote/fastmcp_remote/cli.py:251
↓ 10 callers
Function
call_command
Call a tool, read a resource, or get a prompt on an MCP server. By default the target is treated as a tool name. If the target contains ``://
fastmcp_slim/fastmcp/cli/client.py:796
↓ 10 callers
Method
complete
Send a completion request to the server. Args: ref (mcp_types.ResourceTemplateReference | mcp_types.PromptReference): The referen
fastmcp_slim/fastmcp/client/client.py:1465
↓ 10 callers
Function
create_callback_html
Create a styled HTML response for OAuth callbacks.
fastmcp_slim/fastmcp/client/oauth_callback.py:34
↓ 10 callers
Function
discriminator_spec
A parent schema with a discriminator mapping onto two allOf subtypes.
tests/server/providers/openapi/test_openapi_discriminator.py:21
↓ 10 callers
Method
execute
Execute tool calls using Python code.
fastmcp_slim/fastmcp/experimental/transforms/code_mode.py:593
↓ 10 callers
Method
fetch_token
Exchange an authorization grant for tokens at the token endpoint. Falsy parameters are dropped from the request body, matching authlib.
fastmcp_slim/fastmcp/server/auth/oauth_proxy/upstream.py:111
↓ 10 callers
Function
get_http_headers
Return HTTP headers from an ambient server request, when available. The standalone client package has no server request context. When the full
fastmcp_slim/fastmcp/client/dependencies.py:19
↓ 10 callers
Method
get_session_id
Get the session ID for this transport, if available.
fastmcp_slim/fastmcp/client/transports/base.py:133
↓ 10 callers
Method
load_server
Load and return the FastMCP server instance. Must be called after prepare() if the source requires preparation. All information neede
fastmcp_slim/fastmcp/utilities/mcp_server_config/v1/sources/base.py:22
↓ 10 callers
Function
open_deeplink
Attempt to open a Cursor deeplink URL using the system's default handler. Args: deeplink: The deeplink URL to open Returns:
fastmcp_slim/fastmcp/cli/install/cursor.py:47
↓ 10 callers
Function
resolve_root_ref
Resolve $ref at root level to meet MCP spec requirements. MCP specification requires outputSchema to have "type": "object" at the root level.
fastmcp_slim/fastmcp/utilities/json_schema.py:336
↓ 10 callers
Function
run_command
Run a MCP server or connect to a remote one. Args: server_spec: Python file, object specification (file:obj), config file, or URL
fastmcp_slim/fastmcp/cli/run.py:141
↓ 10 callers
Function
server_span
Emit or enrich a SERVER span with standard MCP attributes and auth context. When the current active span is the request's seam span (opened by
fastmcp_slim/fastmcp/server/telemetry.py:224
↓ 10 callers
Function
telemetry_mode
Resolve the effective telemetry mode for the current context. This is `fastmcp.settings.telemetry_mode`, except that an active `suppress_fast
fastmcp_slim/fastmcp/telemetry.py:86
↓ 10 callers
Function
tool_schema
Build the server and return the generated input schema for create_pet.
tests/server/providers/openapi/test_openapi_discriminator.py:162
↓ 10 callers
Function
user_meta
Strip the SDK's `serverInfo` stamp from a result's `_meta`. Every 2026-era result carries `io.modelcontextprotocol/serverInfo` (spec #3002),
tests/conftest.py:27
↓ 10 callers
Method
validate
(token: str)
tests/server/auth/providers/test_debug.py:31
↓ 10 callers
Method
validate_assertion
Validate JWT assertion from client. Args: assertion: The JWT assertion string client_id: Expected client_id (must mat
fastmcp_slim/fastmcp/server/auth/cimd.py:527
↓ 10 callers
Function
validate_proxy
Validate OIDC proxy.
tests/server/auth/test_oidc_proxy.py:429
↓ 10 callers
Method
verify_token
Verify a token by trying the server, then each verifier in order. Each source is tried independently. If a source raises an exception,
fastmcp_slim/fastmcp/server/auth/auth.py:751
↓ 10 callers
Method
verify_token
(self, token: str)
tests/server/auth/test_multi_auth.py:15
↓ 10 callers
Method
version
(self)
fastmcp_slim/fastmcp/server/server.py:519
↓ 10 callers
Method
wrap
Wrap a Tool to delegate execution to the server's middleware.
fastmcp_slim/fastmcp/server/providers/fastmcp_provider.py:59
↓ 9 callers
Function
_convert_messages_to_google_genai_content
Convert MCP messages to Google GenAI content.
fastmcp_slim/fastmcp/client/sampling/handlers/google_genai.py:276
↓ 9 callers
Function
_convert_to_content
Convert a result to a sequence of content objects.
fastmcp_slim/fastmcp/tools/base.py:573
↓ 9 callers
Function
_elicit
A single-field form elicitation request keyed by ``key``.
tests/server/test_mrtr_guards.py:44
↓ 9 callers
Function
_elicit_request
A single-field form elicitation for *field*.
tests/conformance/server.py:397
↓ 9 callers
Function
_get_bridge
Attempts to connect to the Hue bridge using settings.
examples/smart_home/src/smart_home/lights/hue_utils.py:9
↓ 9 callers
Function
_key
( partition: str, *, method: str = "tools/list", params_key: str = "" )
tests/client/client/test_kv_response_cache.py:42
↓ 9 callers
Method
_make_proxy
(self, jwt_verifier, **kwargs)
tests/server/auth/oauth_proxy/test_tokens.py:815
↓ 9 callers
Function
_opted_in_request
Bind a request context carrying the tasks opt-in for a `tools/call`.
tests/tasks/task_helpers.py:85
↓ 9 callers
Function
_prefix
(docket: Docket, task_scope: str | None, task_id: str)
fastmcp_tasks/fastmcp_tasks/input_store.py:77
↓ 9 callers
Method
_prefix_scopes_for_azure
Prefix unprefixed custom API scopes with identifier_uri for Azure. This helper centralizes the scope prefixing logic used in both aut
fastmcp_slim/fastmcp/server/auth/providers/azure.py:412
↓ 9 callers
Function
_response_to_result_with_tools
Convert Google GenAI response to CreateMessageResultWithTools.
fastmcp_slim/fastmcp/client/sampling/handlers/google_genai.py:350
↓ 9 callers
Function
_strip_remote_refs
Return a deep copy of *obj* with non-local ``$ref`` values removed. Local refs (starting with ``#``) are kept intact. Remote refs (``http://
fastmcp_slim/fastmcp/utilities/json_schema.py:95
↓ 9 callers
Method
_transform_error
Transform non-MCP errors to proper MCP errors.
fastmcp_slim/fastmcp/server/middleware/error_handling.py:80
↓ 9 callers
Function
_unwrap_result
Extract the logical return value from a ToolResult.
tests/experimental/transforms/test_code_mode.py:49
↓ 9 callers
Method
add_resource
Add a resource to the server. Args: resource: A Resource instance or @resource-decorated function to add Returns:
fastmcp_slim/fastmcp/server/server.py:1948
↓ 9 callers
Function
build_client_redirect
Build a client-facing authorization redirect that carries exactly one `iss`. Every redirect this server sends back to an OAuth client from the
fastmcp_slim/fastmcp/server/auth/redirect_validation.py:68
↓ 9 callers
Function
check_for_newer_version
Check if a newer version of FastMCP is available. Returns: The latest version string if newer than current, None otherwise.
fastmcp_slim/fastmcp/utilities/version_check.py:124
↓ 9 callers
Method
connect
( self, *, transport_options: TransportOptions | None = None, **session_kwargs
fastmcp_slim/fastmcp/client/transports/stdio.py:97
↓ 9 callers
Function
decode_jwt_header
Decode JWT header without signature verification. Useful for extracting the key ID (kid) for JWKS lookup. Args: token: JWT token str
fastmcp_slim/fastmcp/utilities/auth.py:32
↓ 9 callers
Function
fetch_json
Fetch a well-known document from a mounted authenticated server.
tests/server/auth/test_issuer_url_identity.py:100
↓ 9 callers
Function
format_tool_signature
Build ``name(param: type, ...) -> return_type`` from a tool's JSON schemas.
fastmcp_slim/fastmcp/cli/client.py:370
↓ 9 callers
Function
generate_cli_script
Generate the full CLI script source code.
fastmcp_slim/fastmcp/cli/generate.py:283
↓ 9 callers
Function
generate_goose_deeplink
Generate a Goose deeplink for installing an MCP extension. Args: name: Human-readable display name for the extension. command: Th
fastmcp_slim/fastmcp/cli/install/goose.py:29
↓ 9 callers
Method
increment
Atomically increment the current progress value.
fastmcp_slim/fastmcp/server/dependencies.py:1268
← previous
next →
201–300 of 12,199, ranked by callers