content large_stringlengths 3 20.5k | url large_stringlengths 53 192 ⌀ | branch large_stringclasses 4
values | source large_stringclasses 51
values | embeddings listlengths 384 384 | score float64 -0.21 0.65 |
|---|---|---|---|---|---|
import { VersionBadge } from '/snippets/version-badge.mdx' Components can be dynamically enabled or disabled at runtime. A disabled tool disappears from listings and cannot be called. This enables runtime access control, feature flags, and context-aware component exposure. ## Component Visibility Every FastMCP server p... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/visibility.mdx | main | model-context-protocol-fastmcp | [
-0.05814488232135773,
0.01930924318730831,
0.00444529065862298,
0.059203244745731354,
0.05393591523170471,
0.006606470327824354,
0.03235381096601486,
-0.05017334967851639,
-0.08203674852848053,
-0.06289003789424896,
0.07721246033906937,
0.06952481716871262,
0.09593265503644943,
-0.04504706... | -0.029816 |
the later disable() overrides the allowlist ``` You can always re-enable something that was disabled by adding another `enable()` call after it. ## Server vs Provider Visibility state operates at two levels: the server and individual providers. ### Server-Level Server-level visibility state applies to all components fr... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/visibility.mdx | main | model-context-protocol-fastmcp | [
-0.08021576702594757,
0.02545906975865364,
0.047557055950164795,
0.05603178218007088,
0.06422454863786697,
-0.04851989075541496,
-0.008035662584006786,
-0.065034881234169,
-0.07132541388273239,
-0.05986996740102768,
0.09357567131519318,
0.05658228322863579,
0.012824987061321735,
-0.0177040... | -0.02851 |
| |-----------|-------------| | `names` | Component names or URIs to match | | `keys` | Component keys (e.g., `{"tool:my\_tool"}`) | | `tags` | Tags to match (component must have at least one) | | `version` | Version specification to match | | `components` | Component types (`{"tool"}`, `{"resource"}`, `{"prompt"}`, `{... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/visibility.mdx | main | model-context-protocol-fastmcp | [
0.0001757766294758767,
0.027481278404593468,
0.04523252695798874,
-0.006635663565248251,
0.026562204584479332,
-0.004389731679111719,
0.01268635131418705,
-0.012434512376785278,
-0.04996143653988838,
-0.06117825582623482,
0.04697138071060181,
-0.06727869063615799,
0.07637748122215271,
-0.0... | -0.120345 |
names={"secret\_tool"})) ``` Server-level transforms override provider-level transforms. If a component is disabled at the provider level but enabled at the server level, the server-level `enable()` can re-enable it. | https://github.com/jlowin/fastmcp/blob/main/docs/servers/visibility.mdx | main | model-context-protocol-fastmcp | [
-0.10664503276348114,
-0.007313975133001804,
-0.02665630355477333,
0.05532575398683548,
-0.017917465418577194,
0.016022641211748123,
-0.04089817777276039,
-0.07805155962705612,
-0.03617066517472267,
-0.03552037850022316,
0.06851282715797424,
0.09672517329454422,
-0.012799677439033985,
0.05... | 0.003281 |
import { VersionBadge } from "/snippets/version-badge.mdx" Prompts are reusable message templates that help LLMs generate structured, purposeful responses. FastMCP simplifies defining these templates, primarily using the `@mcp.prompt` decorator. ## What Are Prompts? Prompts provide parameterized message templates for L... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/prompts.mdx | main | model-context-protocol-fastmcp | [
-0.005110468249768019,
0.029999950900673866,
0.062484823167324066,
-0.0645395815372467,
0.05386718362569809,
-0.015335864387452602,
0.008611621335148811,
0.015505705028772354,
-0.01358499750494957,
-0.043107736855745316,
0.009161757305264473,
-0.03265628218650818,
0.1342620700597763,
-0.06... | 0.011676 |
Optional meta information about the prompt. This data is passed through to the MCP client as the `meta` field of the client-side prompt object and can be used for custom metadata, versioning, or other application-specific purposes. Optional version identifier for this prompt. See [Versioning](/servers/versioning) for d... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/prompts.mdx | main | model-context-protocol-fastmcp | [
-0.004280562978237867,
0.045119475573301315,
0.05944673344492912,
-0.019535966217517853,
0.027654564008116722,
-0.03173673152923584,
0.024934254586696625,
0.03999161347746849,
-0.008779886178672314,
-0.00894440058618784,
0.01699194312095642,
-0.04773176461458206,
0.033438537269830704,
-0.0... | 0.058631 |
precedence over the docstring. This makes it safe to adopt docstring-based descriptions incrementally: existing annotations keep working, and docstrings fill in the gaps. ### Return Values Prompt functions must return one of these types: - \*\*`str`\*\*: Sent as a single user message. - \*\*`list[Message | str]`\*\*: A... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/prompts.mdx | main | model-context-protocol-fastmcp | [
-0.005814835429191589,
0.06368092447519302,
0.10833722352981567,
-0.00427702022716403,
0.011587511748075485,
-0.00703015923500061,
0.0680035799741745,
0.05066593363881111,
0.10792094469070435,
-0.04421455040574074,
0.04331880807876587,
-0.06434054672718048,
0.028546204790472984,
0.00092670... | 0.092241 |
from fastmcp import FastMCP mcp = FastMCP("MyServer") @mcp.prompt(tags={"public"}) def public\_prompt(topic: str) -> str: return f"Discuss: {topic}" @mcp.prompt(tags={"internal"}) def internal\_prompt() -> str: return "Internal system prompt" # Disable specific prompts by key mcp.disable(keys={"prompt:internal\_prompt"... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/prompts.mdx | main | model-context-protocol-fastmcp | [
-0.02376868948340416,
-0.011882818304002285,
-0.030028702691197395,
0.0369851179420948,
0.06479459255933762,
-0.03759629279375076,
0.023529881611466408,
-0.03890017420053482,
0.00845378264784813,
-0.022470038384199142,
0.06211830675601959,
-0.02509157545864582,
0.09325002878904343,
-0.0795... | -0.027267 |
you to maintain multiple implementations under the same name while clients automatically receive the highest version. See [Versioning](/servers/versioning) for complete documentation on version comparison, retrieval, and migration patterns. | https://github.com/jlowin/fastmcp/blob/main/docs/servers/prompts.mdx | main | model-context-protocol-fastmcp | [
-0.04344170540571213,
-0.02337253838777542,
0.00020740476611535996,
-0.10749100893735886,
-0.009464059956371784,
-0.12184084951877594,
-0.07047434151172638,
-0.0075533329509198666,
0.06279406696557999,
-0.025651192292571068,
-0.011668260209262371,
0.08257164061069489,
-0.0033037462271749973,... | 0.047804 |
import { VersionBadge } from '/snippets/version-badge.mdx' When a server exposes many tools, resources, or prompts, returning them all in a single response can be impractical. MCP supports pagination for list operations, allowing servers to return results in manageable chunks that clients can fetch incrementally. ## Se... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/pagination.mdx | main | model-context-protocol-fastmcp | [
-0.0423654168844223,
0.02119293622672558,
0.001702518085949123,
0.026602046564221382,
-0.04016813635826111,
-0.03667137026786804,
-0.036322709172964096,
-0.04988358914852142,
-0.02127191424369812,
0.021608231589198112,
0.022403081879019737,
0.06362060457468033,
0.10563682019710541,
-0.0788... | -0.025157 |
import { VersionBadge } from "/snippets/version-badge.mdx" LLM sampling allows your MCP tools to request text generation from an LLM during execution. This enables tools to leverage AI capabilities for analysis, generation, reasoning, and more—without the client needing to orchestrate multiple calls. By default, sampli... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/sampling.mdx | main | model-context-protocol-fastmcp | [
-0.05553726479411125,
0.0371883362531662,
-0.024410804733633995,
0.017544278874993324,
0.042455725371837616,
-0.028767475858330727,
-0.0005419834051281214,
0.021511606872081757,
0.0219431109726429,
-0.03732401132583618,
-0.010082734748721123,
-0.056297965347766876,
0.09653320908546448,
-0.... | 0.032431 |
is optional—some clients may not implement it. To ensure your tools work regardless of client capabilities, configure a `sampling\_handler` that sends requests directly to an LLM provider. FastMCP provides built-in handlers for [OpenAI and Anthropic APIs](/clients/sampling#built-in-handlers). These handlers support the... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/sampling.mdx | main | model-context-protocol-fastmcp | [
-0.07644437253475189,
-0.051140885800123215,
-0.00284961867146194,
0.02369093708693981,
0.02075040712952614,
-0.10743705928325653,
0.026434822008013725,
0.004638484213501215,
0.0071397810243070126,
-0.02993013896048069,
-0.001619346672669053,
-0.04777787998318672,
0.016796359792351723,
-0.... | 0.039264 |
str: """Search the web for information.""" return f"Results for: {query}" def get\_time() -> str: """Get the current time.""" from datetime import datetime return datetime.now().strftime("%H:%M:%S") mcp = FastMCP() @mcp.tool async def research(question: str, ctx: Context) -> str: """Answer questions using available too... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/sampling.mdx | main | model-context-protocol-fastmcp | [
-0.05434204265475273,
0.07755599170923233,
-0.05465809255838394,
0.06130864471197128,
0.004041092935949564,
-0.08485106378793716,
-0.005529492627829313,
0.08782150596380234,
0.03419879451394081,
-0.06464177370071411,
0.014472665265202522,
-0.033096905797719955,
0.020480627194046974,
-0.059... | 0.058834 |
the loop. Use `sample\_step()` when you need to: - Inspect tool calls before they execute - Implement custom termination conditions - Add logging, metrics, or checkpointing between steps - Build custom agentic loops with domain-specific logic ### Basic Loop By default, `sample\_step()` executes any tool calls and inclu... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/sampling.mdx | main | model-context-protocol-fastmcp | [
-0.025398528203368187,
0.03401443362236023,
-0.043691352009773254,
0.024066688492894173,
-0.01140039786696434,
-0.04606049135327339,
0.028643527999520302,
-0.005429605022072792,
0.021784450858831406,
-0.03049900010228157,
0.03896953538060188,
-0.03881185129284859,
0.033550672233104706,
-0.... | 0.011549 |
If any tool has `sequential=True`, all tools execute sequentially regardless. - `.text`: The raw text response (or JSON for structured output) - `.result`: The typed result—same as `.text` for plain text, or a validated Pydantic object for structured output - `.history`: All messages exchanged during sampling Make a si... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/sampling.mdx | main | model-context-protocol-fastmcp | [
-0.05842016637325287,
-0.03418776020407677,
-0.05180399864912033,
-0.01997760869562626,
-0.01668430119752884,
-0.08676719665527344,
-0.051684681326150894,
0.01184385921806097,
0.056301020085811615,
0.011472700163722038,
0.013818460516631603,
-0.013658006675541401,
0.04041125997900963,
-0.1... | 0.044114 |
import { VersionBadge } from "/snippets/version-badge.mdx" The `FastMCP` class is the central piece of every FastMCP application. It acts as the container for your tools, resources, and prompts, managing communication with MCP clients and orchestrating the entire server lifecycle. ## Creating a Server At its simplest, ... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/server.mdx | main | model-context-protocol-fastmcp | [
-0.06178021430969238,
-0.013630500063300133,
0.01656211167573929,
-0.013760385103523731,
-0.022418145090341568,
-0.11974158138036728,
-0.02942861244082451,
-0.007346525322645903,
-0.025256015360355377,
-0.011386489495635033,
0.03401590511202812,
0.02213195711374283,
0.08741338551044464,
-0... | 0.062034 |
the server — requests, responses, and notifications in both directions. Use for cross-cutting concerns like logging, error handling, and rate limiting [Providers](/servers/providers) that supply tools, resources, and prompts dynamically. Providers are queried at request time, so they can serve components from databases... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/server.mdx | main | model-context-protocol-fastmcp | [
-0.12381685525178909,
-0.02578434720635414,
0.016417883336544037,
0.007909645326435566,
-0.02422287128865719,
-0.08212940394878387,
-0.018157679587602615,
-0.0330146923661232,
0.0401952788233757,
-0.030505485832691193,
-0.014886988326907158,
0.03214556351304054,
0.04020082578063011,
0.0067... | 0.1341 |
templates, and prompts) and affects both listing and access. ## Custom Routes When running with HTTP transport, you can add custom web routes alongside your MCP endpoint using the `@custom\_route` decorator. ```python from fastmcp import FastMCP from starlette.requests import Request from starlette.responses import Pla... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/server.mdx | main | model-context-protocol-fastmcp | [
-0.03768530860543251,
0.05080965906381607,
-0.00980681274086237,
0.030685627833008766,
-0.026976285502314568,
-0.06290134787559509,
0.005555771291255951,
0.047248803079128265,
-0.06572360545396805,
-0.028732318431138992,
0.01998036541044712,
0.04129922762513161,
0.0013113260501995683,
-0.0... | 0.07521 |
import { VersionBadge } from '/snippets/version-badge.mdx' Progress reporting allows MCP tools to notify clients about the progress of long-running operations. Clients can display progress indicators and provide better user experience during time-consuming tasks. ## Basic Usage Use `ctx.report\_progress()` to send prog... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/progress.mdx | main | model-context-protocol-fastmcp | [
-0.05844438448548317,
0.05950799956917763,
0.003184693632647395,
0.03783458471298218,
-0.001989210257306695,
-0.0200818981975317,
-0.001182087347842753,
-0.00910918228328228,
-0.025776084512472153,
-0.024068007245659828,
-0.008297847583889961,
-0.010546012781560421,
0.05407628417015076,
-0... | 0.065048 |
The best way to ensure a reliable and maintainable FastMCP Server is to test it! The FastMCP Client combined with Pytest provides a simple and powerful way to test your FastMCP servers. ## Prerequisites Testing FastMCP servers requires `pytest-asyncio` to handle async test functions and fixtures. Install it as a develo... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/testing.mdx | main | model-context-protocol-fastmcp | [
-0.06036306917667389,
0.002273860154673457,
0.022936100140213966,
0.06392118334770203,
-0.028451908379793167,
-0.10525081306695938,
-0.08066757023334503,
0.0013872297713533044,
-0.034630004316568375,
-0.060996443033218384,
0.03288336098194122,
-0.017358725890517235,
0.021417435258626938,
0... | -0.058017 |
FastMCP includes native OpenTelemetry instrumentation for observability. Traces are automatically generated for tool, prompt, resource, and resource template operations, providing visibility into server behavior, request handling, and provider delegation chains. ## How It Works FastMCP uses the OpenTelemetry API for in... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/telemetry.mdx | main | model-context-protocol-fastmcp | [
-0.07784857600927353,
0.0019616198260337114,
0.0011312286369502544,
0.018885865807533264,
0.04880893602967262,
-0.13278290629386902,
-0.0014297848101705313,
-0.032961901277303696,
0.05455750226974487,
-0.003975242841988802,
0.05305054783821106,
-0.08665279299020767,
-0.010381406173110008,
... | 0.114099 |
async def complex\_operation(input: str) -> str: tracer = get\_tracer() with tracer.start\_as\_current\_span("parse\_input") as span: span.set\_attribute("input.length", len(input)) parsed = parse(input) with tracer.start\_as\_current\_span("process\_data") as span: span.set\_attribute("data.count", len(parsed)) result... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/telemetry.mdx | main | model-context-protocol-fastmcp | [
-0.09188032895326614,
-0.0176800899207592,
-0.04991869255900383,
0.12222481518983841,
-0.04244673252105713,
-0.1386532038450241,
-0.022759201005101204,
0.013721629045903683,
0.00006745374412275851,
-0.046257924288511276,
-0.022999923676252365,
0.031086036935448647,
-0.0002202392352046445,
... | 0.063684 |
URI (for resource operations) | | `gen\_ai.tool.name` | Tool name (on `tools/call` spans) | | `gen\_ai.prompt.name` | Prompt name (on `prompts/get` spans) | | `error.type` | Error classification (`tool\_error` for ToolError, otherwise exception class name) | ### Auth Attributes Standard [identity attributes](https://op... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/telemetry.mdx | main | model-context-protocol-fastmcp | [
-0.11518118530511856,
0.0405365414917469,
-0.05460626259446144,
0.03632698208093643,
-0.0311481524258852,
-0.06098422780632973,
0.037507351487874985,
0.03699358180165291,
0.009571236558258533,
-0.051526546478271484,
0.06396285444498062,
-0.12344174087047577,
0.08619004487991333,
-0.0223292... | 0.121553 |
import { VersionBadge } from '/snippets/version-badge.mdx' This documentation covers \*\*MCP client logging\*\*—sending messages from your server to MCP clients. For standard server-side logging (e.g., writing to files, console), use `fastmcp.utilities.logging.get\_logger()` or Python's built-in `logging` module. Serve... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/logging.mdx | main | model-context-protocol-fastmcp | [
-0.018203720450401306,
0.03015977144241333,
0.012437675148248672,
0.0031565092504024506,
0.06953185796737671,
-0.09295865148305893,
0.02904592640697956,
-0.0003670910664368421,
-0.021377436816692352,
0.0017304269131273031,
0.0241744052618742,
-0.011125818826258183,
0.07173670828342438,
-0.... | 0.022572 |
import { VersionBadge } from '/snippets/version-badge.mdx' Component versioning lets you maintain multiple implementations of the same tool, resource, or prompt under a single identifier. You register each version, and FastMCP handles the rest: clients see the highest version by default, but you can filter to expose ex... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/versioning.mdx | main | model-context-protocol-fastmcp | [
-0.03037738800048828,
-0.009375124238431454,
0.039650432765483856,
-0.05592583119869232,
0.027165066450834274,
-0.04605460166931152,
-0.06818996369838715,
-0.031273920089006424,
-0.03872291371226311,
-0.026557667180895805,
0.0034966361708939075,
-0.004713583737611771,
0.08485105633735657,
... | -0.071262 |
-> str: """Enhanced processing with mode selection.""" if mode == "reverse": return data[::-1].upper() return data.upper() ``` Both versions are registered. When a client lists tools, they see only `process` with version 2.0 (the highest). When they invoke `process`, version 2.0 executes. The same pattern applies to re... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/versioning.mdx | main | model-context-protocol-fastmcp | [
-0.04220617190003395,
0.0013331923400983214,
0.03206576779484749,
-0.0008585245814174414,
-0.00964388158172369,
-0.09507021307945251,
-0.0422324612736702,
-0.002365594496950507,
-0.02772972173988819,
-0.02229379117488861,
0.06140735372900963,
-0.0303522776812315,
0.04538910090923309,
-0.03... | -0.075107 |
before processing. ```json Tool Call Arguments { "x": 1, "y": 2, "\_meta": { "fastmcp": { "version": "1.0" } } } ``` ```json Prompt Arguments { "text": "Summarize this document...", "\_meta": { "fastmcp": { "version": "1.0" } } } ``` The `\_meta` field is part of the MCP request params, not arguments, so your component... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/versioning.mdx | main | model-context-protocol-fastmcp | [
-0.013841749168932438,
0.04166034609079361,
0.04786345362663269,
-0.013773017562925816,
0.04269998148083687,
-0.030502362176775932,
-0.05626385286450386,
0.05285082384943962,
0.02010461688041687,
-0.06870342791080475,
0.02897658199071884,
-0.010851998813450336,
-0.01358077023178339,
0.0171... | -0.015001 |
migration is complete, remove the old version. ```python mcp.local\_provider.remove\_tool("process\_data", version="1.0") ``` | https://github.com/jlowin/fastmcp/blob/main/docs/servers/versioning.mdx | main | model-context-protocol-fastmcp | [
-0.0072045112028717995,
-0.021072980016469955,
0.09241066128015518,
-0.03700912743806839,
0.06268317997455597,
-0.09023616462945938,
-0.04186509549617767,
-0.056548602879047394,
-0.05288076773285866,
0.028005950152873993,
0.041179805994033813,
0.02014036290347576,
0.014376784674823284,
0.0... | -0.054798 |
import { VersionBadge } from "/snippets/version-badge.mdx" Middleware adds behavior that applies across multiple operations—authentication, logging, rate limiting, or request transformation—without modifying individual tools or resources. MCP middleware is a FastMCP-specific concept and is not part of the official MCP ... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/middleware.mdx | main | model-context-protocol-fastmcp | [
-0.08027826249599457,
-0.023861827328801155,
0.09599553793668747,
-0.08549246937036514,
0.0937773585319519,
-0.07937268167734146,
-0.06731599569320679,
-0.027415035292506218,
0.008574508130550385,
0.03841826319694519,
-0.021077841520309448,
0.027601266279816628,
0.07756736129522324,
-0.049... | 0.113873 |
def hook\_name(self, context: MiddlewareContext, call\_next) -> result\_type: # Pre-processing result = await call\_next(context) # Post-processing return result ``` \*\*Parameters:\*\* - `context` — `MiddlewareContext` containing request information - `call\_next` — Async function to continue the middleware chain \*\*... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/middleware.mdx | main | model-context-protocol-fastmcp | [
-0.08481933176517487,
0.0016043266514316201,
-0.020117655396461487,
0.01275894045829773,
-0.019120696932077408,
-0.06997261196374893,
0.04891836270689964,
0.05641132593154907,
0.010807370766997337,
0.009178370237350464,
-0.029728103429079056,
-0.06120888143777847,
0.01403377391397953,
0.01... | 0.155424 |
only log the error, not send it to the client. The response has already been sent. Always reject \*\*before\*\* `call\_next()`. ### Raw Handler For complete control over all messages, override `\_\_call\_\_` instead of individual hooks: ```python from fastmcp.server.middleware import Middleware, MiddlewareContext class... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/middleware.mdx | main | model-context-protocol-fastmcp | [
-0.06627033650875092,
0.048126354813575745,
0.06592125445604324,
0.0071402243338525295,
0.008748989552259445,
-0.0826793909072876,
0.03696417063474655,
0.0445067472755909,
0.007163492497056723,
0.03740735724568367,
-0.005530206486582756,
-0.04708611220121384,
0.02396313101053238,
0.0224856... | 0.088256 |
bucket algorithm allowing controlled bursts. `SlidingWindowRateLimitingMiddleware` provides precise time-window rate limiting without burst allowance. ```python from fastmcp import FastMCP from fastmcp.server.middleware.rate\_limiting import RateLimitingMiddleware mcp = FastMCP("MyServer") mcp.add\_middleware(RateLimit... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/middleware.mdx | main | model-context-protocol-fastmcp | [
-0.0831635519862175,
-0.015796614810824394,
-0.00916806235909462,
-0.015260917134582996,
-0.05038115009665489,
-0.09142134338617325,
0.0014305120566859841,
0.00826965644955635,
0.034583963453769684,
0.013181663118302822,
-0.034267254173755646,
-0.03301900252699852,
0.018894080072641373,
-0... | 0.064604 |
RateLimitingMiddleware from fastmcp.server.middleware.timing import TimingMiddleware from fastmcp.server.middleware.logging import LoggingMiddleware mcp = FastMCP("Production Server") mcp.add\_middleware(ErrorHandlingMiddleware()) # Catch all errors mcp.add\_middleware(RateLimitingMiddleware(max\_requests\_per\_second=... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/middleware.mdx | main | model-context-protocol-fastmcp | [
-0.07130607962608337,
0.02253391034901142,
0.010488074272871017,
-0.02782825380563736,
0.004266832023859024,
-0.14029330015182495,
-0.022164272144436836,
0.03194072097539902,
-0.009752800688147545,
0.048393186181783676,
0.027505820617079735,
-0.07622942328453064,
0.04662356525659561,
-0.03... | 0.090728 |
FastMCP("MyServer") @mcp.tool def get\_user\_data(ctx: Context) -> str: user\_id = ctx.get\_state("user\_id") return f"Data for user: {user\_id}" ``` See [Context State Management](/servers/context#state-management) for details. ### Constructor Parameters Initialize middleware with configuration: ```python from fastmcp... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/middleware.mdx | main | model-context-protocol-fastmcp | [
-0.07008680701255798,
0.01262056827545166,
-0.011055798269808292,
-0.03383490443229675,
-0.021123157814145088,
-0.08316544443368912,
0.037054844200611115,
0.051795873790979385,
-0.04646242409944534,
-0.017631955444812775,
0.021503685042262077,
-0.07702111452817917,
0.07988893985748291,
-0.... | 0.124041 |
import { VersionBadge } from "/snippets/version-badge.mdx" Authorization controls what authenticated users can do with your FastMCP server. While [authentication](/servers/auth/authentication) verifies identity (who you are), authorization determines access (what you can do). FastMCP provides a callable-based authoriza... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/authorization.mdx | main | model-context-protocol-fastmcp | [
-0.034437328577041626,
0.03734726458787918,
0.001928634592331946,
-0.07954927533864975,
0.045733582228422165,
-0.044171951711177826,
0.027418185025453568,
-0.01760319247841835,
-0.0007195599027909338,
-0.045031480491161346,
0.032269492745399475,
0.00352751393802464,
0.07642704248428345,
-0... | 0.032334 |
is None: return False user\_level = ctx.token.claims.get("level", 0) return user\_level >= minimum\_level return check @mcp.tool(auth=require\_premium\_user) def premium\_feature() -> str: """Only for premium users.""" return "Premium content" @mcp.tool(auth=require\_access\_level(5)) def advanced\_feature() -> str: ""... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/authorization.mdx | main | model-context-protocol-fastmcp | [
-0.10083195567131042,
0.050071071833372116,
-0.05803094804286957,
0.03619232773780823,
0.014230534434318542,
-0.06272700428962708,
0.06133466958999634,
0.012179230339825153,
-0.06382063031196594,
-0.0392768457531929,
0.09849424660205841,
-0.044099997729063034,
0.06343237310647964,
-0.02457... | -0.013442 |
fastmcp import FastMCP from fastmcp.server.auth import restrict\_tag from fastmcp.server.middleware import AuthMiddleware mcp = FastMCP( "Tag-Based Auth Server", middleware=[ AuthMiddleware(auth=restrict\_tag("admin", scopes=["admin"])), AuthMiddleware(auth=restrict\_tag("write", scopes=["write"])), ] ) @mcp.tool(tags=... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/authorization.mdx | main | model-context-protocol-fastmcp | [
-0.0942944809794426,
0.03777783364057541,
-0.029533198103308678,
-0.010569216683506966,
0.013664660975337029,
-0.09480809420347214,
0.035261500626802444,
-0.047753576189279556,
0.0054627940990030766,
0.02499220333993435,
0.07905194908380508,
0.010125347413122654,
0.12642598152160645,
-0.09... | -0.003581 |
import { VersionBadge } from "/snippets/version-badge.mdx"; Downstream systems like routers, gateways, and audit loggers often need to detect whether a tool's schema changed between deployments. Rather than each system inventing its own JSON normalization and hashing logic, you can build stable fingerprints from FastMC... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/tool-fingerprinting.mdx | main | model-context-protocol-fastmcp | [
-0.09658356010913849,
0.02990039251744747,
0.036534782499074936,
-0.08742327988147736,
0.05765252187848091,
-0.022206630557775497,
0.0037342796567827463,
-0.04852748289704323,
-0.04166062921285629,
-0.03350530564785004,
0.06560087949037552,
0.017716985195875168,
0.06852202862501144,
-0.040... | -0.030393 |
by\_alias=True, exclude\_none=True) payload = { "key": tool.key, "inputSchema": dumped["inputSchema"], } canonical = json.dumps(payload, sort\_keys=True, separators=(",", ":")) manifest[tool.key] = hashlib.sha256(canonical.encode("utf-8")).hexdigest() return manifest async def check\_drift(server: FastMCP, baseline\_pa... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/tool-fingerprinting.mdx | main | model-context-protocol-fastmcp | [
-0.045988354831933975,
0.03127221763134003,
0.0032318311277776957,
-0.002736410591751337,
0.05289606377482414,
-0.08364852517843246,
0.02424841746687889,
-0.02526920661330223,
-0.025102153420448303,
-0.0677686557173729,
0.07670082151889801,
-0.037398725748062134,
0.07180563360452652,
-0.06... | -0.004882 |
import { VersionBadge } from '/snippets/version-badge.mdx' As your application grows, you'll want to split it into focused servers — one for weather, one for calendar, one for admin — and combine them into a single server that clients connect to. That's what `mount()` does. When you mount a server, all its tools, resou... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/composition.mdx | main | model-context-protocol-fastmcp | [
-0.014976982027292252,
-0.0034235722851008177,
0.04068703576922417,
0.02763546258211136,
-0.007340640295296907,
-0.08868896961212158,
-0.059238847345113754,
0.00024025619495660067,
-0.027938945218920708,
-0.030263647437095642,
0.001722252694889903,
-0.056583765894174576,
0.10382570326328278,... | -0.066134 |
or limiting mounting depth. ## Custom Routes Custom HTTP routes defined with `@server.custom\_route()` are also forwarded when mounting: ```python subserver = FastMCP("Sub") @subserver.custom\_route("/health", methods=["GET"]) async def health\_check(): return {"status": "ok"} main = FastMCP("Main") main.mount(subserve... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/composition.mdx | main | model-context-protocol-fastmcp | [
-0.06703237444162369,
-0.04382694140076637,
-0.0072981310077011585,
0.018000785261392593,
-0.051722537726163864,
-0.12980033457279205,
-0.08872190862894058,
0.01428978145122528,
0.01787065528333187,
-0.03478522598743439,
0.03774949163198471,
0.0236087404191494,
0.05209752544760704,
0.02598... | 0.001663 |
import { VersionBadge } from "/snippets/version-badge.mdx" Resources represent data or files that an MCP client can read, and resource templates extend this concept by allowing clients to request dynamically generated resources based on parameters passed in the URI. FastMCP simplifies defining both static and dynamic r... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/resources.mdx | main | model-context-protocol-fastmcp | [
-0.057151373475790024,
0.03513983264565468,
0.027311375364661217,
-0.014961098320782185,
0.02787473052740097,
-0.0701151043176651,
0.002246919786557555,
-0.017208334058523178,
0.03237064555287361,
-0.06788165867328644,
-0.010164942592382431,
0.05025699734687805,
0.10137699544429779,
-0.045... | 0.05909 |
identifier for this resource. See [Versioning](/servers/versioning) for details. #### Using with Methods For decorating instance or class methods, use the standalone `@resource` decorator and register the bound method. See [Tools: Using with Methods](/servers/tools#using-with-methods) for the pattern. ### Return Values... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/resources.mdx | main | model-context-protocol-fastmcp | [
-0.043721117079257965,
0.05069475620985031,
-0.046155285090208054,
0.03866597265005112,
0.03332383558154106,
-0.1112198755145073,
0.01898493804037571,
0.02898697927594185,
0.005213093478232622,
0.030012376606464386,
-0.034823980182409286,
-0.009343267418444157,
0.041140347719192505,
0.0098... | 0.039284 |
FastMCP supports both `async def` and regular `def` resource functions. Synchronous functions automatically run in a threadpool to avoid blocking the event loop. For I/O-bound operations, async functions are more efficient: ```python import aiofiles from fastmcp import FastMCP mcp = FastMCP(name="DataServer") @mcp.reso... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/resources.mdx | main | model-context-protocol-fastmcp | [
-0.04026518389582634,
0.0030808225274086,
-0.015466916374862194,
0.05603581294417381,
0.03061842732131481,
-0.11427192389965057,
0.04643073305487633,
0.05721025541424751,
0.04574264585971832,
-0.0016055741580203176,
0.0223088376224041,
0.027981167659163475,
-0.021857207641005516,
0.0036516... | 0.042855 |
:------ | | `readOnlyHint` | boolean | true | Indicates if the resource only provides data without side effects | | `idempotentHint` | boolean | true | Indicates if repeated reads have the same effect as a single read | Remember that annotations help make better user experiences but should be treated as advisory hints.... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/resources.mdx | main | model-context-protocol-fastmcp | [
-0.059750091284513474,
0.0970713347196579,
0.007023458834737539,
0.08221089094877243,
-0.00008938885730458423,
0.005702625028789043,
0.0721617192029953,
0.014242065139114857,
-0.026880929246544838,
-0.03924454748630524,
-0.06373436748981476,
-0.03466344252228737,
0.07211241871118546,
0.013... | 0.139465 |
# Can match path://docs/server/resources.mdx return f"Content at path: {filepath}" # Mixing standard and wildcard parameters @mcp.resource("repo://{owner}/{path\*}/template.py") def get\_template\_file(owner: str, path: str) -> dict: """Retrieves a file from a specific repository and path, but only if the resource ends... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/resources.mdx | main | model-context-protocol-fastmcp | [
-0.04069901257753372,
0.0848008319735527,
0.04655655100941658,
-0.029905876144766808,
0.03866928443312645,
-0.012676735408604145,
0.019112465903162956,
0.006064267363399267,
-0.01533476635813713,
-0.05727457255125046,
0.01717802695930004,
0.009004311636090279,
0.046821728348731995,
0.03952... | -0.048983 |
patterns by manually applying decorators: ```python from fastmcp import FastMCP mcp = FastMCP(name="DataServer") # Define a user lookup function that can be accessed by different identifiers def lookup\_user(name: str | None = None, email: str | None = None) -> dict: """Look up a user by either name or email.""" if ema... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/resources.mdx | main | model-context-protocol-fastmcp | [
-0.14807072281837463,
0.07576055079698563,
0.0514778196811676,
-0.020320791751146317,
-0.01756867952644825,
-0.1334194391965866,
0.049167584627866745,
-0.046549346297979355,
0.00013480045890901238,
-0.030215304344892502,
0.04626666009426117,
-0.0076797762885689735,
0.028641395270824432,
-0... | -0.003467 |
retrieval, and migration patterns. | https://github.com/jlowin/fastmcp/blob/main/docs/servers/resources.mdx | main | model-context-protocol-fastmcp | [
0.027133332565426826,
-0.04943661391735077,
0.003696749685332179,
-0.04048733040690422,
0.03722153976559639,
-0.017777493223547935,
0.0046729580499231815,
-0.053056903183460236,
-0.030179504305124283,
-0.03825877234339714,
0.06763758510351181,
-0.004503932315856218,
0.019913386553525925,
-... | 0.145687 |
import { VersionBadge } from "/snippets/version-badge.mdx"; FastMCP uses dependency injection to provide runtime values to your tools, resources, and prompts. Instead of passing context through every layer of your code, you declare what you need as parameter defaults—FastMCP resolves them automatically when your functi... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/dependency-injection.mdx | main | model-context-protocol-fastmcp | [
-0.03752073645591736,
0.06282971054315567,
0.06933092325925827,
-0.03151208162307739,
0.06007073447108269,
-0.05157097429037094,
0.004658181220293045,
0.03319673612713814,
-0.042592260986566544,
-0.023648397997021675,
0.004011223558336496,
-0.07622800022363663,
0.030432388186454773,
-0.019... | 0.007539 |
request.client.host if request.client else "Unknown" ``` Both raise `RuntimeError` when called outside an HTTP context (e.g., STDIO transport). For background tasks created from an HTTP request, FastMCP restores a minimal request backed by the originating request's snapshotted headers. Use HTTP Headers if you need grac... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/dependency-injection.mdx | main | model-context-protocol-fastmcp | [
-0.12490759789943695,
0.096343494951725,
-0.0002587933267932385,
0.02843625098466873,
0.019353337585926056,
-0.11888081580400467,
-0.018748315051198006,
-0.034337420016527176,
0.00284124375320971,
-0.026813557371497154,
0.013999827206134796,
-0.0074380505830049515,
0.06571166217327118,
-0.... | 0.019728 |
you can create your own to inject configuration, database connections, API clients, or any other values your functions need. ### Using Depends() The `Depends()` function wraps any callable and injects its return value. This works with synchronous functions, async functions, and async context managers. ```python from fa... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/dependency-injection.mdx | main | model-context-protocol-fastmcp | [
-0.11213383823633194,
0.025328751653432846,
-0.038090530782938004,
0.04161037132143974,
-0.10817550867795944,
-0.12065540254116058,
0.03332773596048355,
0.058660704642534256,
-0.06435228139162064,
-0.024951688945293427,
0.056001439690589905,
-0.02373947761952877,
0.06720294058322906,
-0.05... | 0.012409 |
import { VersionBadge } from '/snippets/version-badge.mdx' Icons provide visual representations for your MCP servers and components, helping client applications present better user interfaces. When displayed in MCP clients, icons help users quickly identify and navigate your server's capabilities. ## Icon Format Icons ... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/icons.mdx | main | model-context-protocol-fastmcp | [
-0.029945911839604378,
0.06596789509057999,
0.0637500062584877,
0.0050298296846449375,
0.056268032640218735,
-0.052117738872766495,
0.007443767506629229,
-0.0054286178201437,
0.002631185809150338,
-0.0365147702395916,
-0.019477544352412224,
0.05059872567653656,
0.07453979551792145,
-0.0329... | 0.034978 |
import { VersionBadge } from '/snippets/version-badge.mdx' When defining FastMCP [tools](/servers/tools), [resources](/servers/resources), resource templates, or [prompts](/servers/prompts), your functions might need to interact with the underlying MCP session or access advanced server capabilities. FastMCP provides th... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/context.mdx | main | model-context-protocol-fastmcp | [
-0.06790954619646072,
0.03958410769701004,
0.028289837762713432,
-0.009104362688958645,
0.07398073375225067,
-0.031279802322387695,
0.024136284366250038,
0.0004235355299897492,
-0.05041748657822609,
-0.01917172223329544,
0.0332689993083477,
-0.02748800814151764,
0.08171331137418747,
-0.051... | 0.076062 |
get\_context mcp = FastMCP(name="Dependency Demo") # Utility function that needs context but doesn't receive it as a parameter async def process\_data(data: list[float]) -> dict: # Get the active context - only works when called within a request ctx = get\_context() await ctx.info(f"Processing {len(data)} data points")... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/context.mdx | main | model-context-protocol-fastmcp | [
-0.11294253915548325,
0.01485797856003046,
-0.04247474670410156,
0.07238496094942093,
-0.0003988824028056115,
-0.14582385122776031,
0.09420779347419739,
0.0168788880109787,
-0.03487446531653404,
-0.06234018877148628,
0.05654500052332878,
-0.06508693099021912,
0.009005650877952576,
-0.03262... | 0.059228 |
have their own counter. \*\*Method signatures:\*\* - \*\*`await ctx.set\_state(key, value, \*, serializable=True)`\*\*: Store a value in session state - \*\*`await ctx.get\_state(key)`\*\*: Retrieve a value (returns None if not found) - \*\*`await ctx.delete\_state(key)`\*\*: Remove a value from session state State met... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/context.mdx | main | model-context-protocol-fastmcp | [
-0.10839233547449112,
0.0344429649412632,
-0.09855833649635315,
0.10061204433441162,
-0.09907160699367523,
-0.04849115386605263,
0.01602344401180744,
-0.002826677169650793,
0.007096535060554743,
0.009400925599038601,
-0.02623703144490719,
0.003217684105038643,
0.04249117895960808,
0.006043... | 0.102902 |
directly. ### FastMCP Server To access the underlying FastMCP server instance, you can use the `ctx.fastmcp` property: ```python @mcp.tool async def my\_tool(ctx: Context) -> None: # Access the FastMCP server instance server\_name = ctx.fastmcp.name ... ``` ### Transport The `ctx.transport` property indicates which tra... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/context.mdx | main | model-context-protocol-fastmcp | [
-0.07295142859220505,
0.013693573884665966,
-0.04033329710364342,
0.08860857039690018,
-0.04542028531432152,
-0.09831932187080383,
-0.019283967092633247,
-0.003319289069622755,
0.00689045712351799,
-0.05119139701128006,
-0.0037508129607886076,
-0.01901230402290821,
-0.003450121497735381,
-... | 0.016055 |
client making the request. ```python @mcp.tool def send\_email(to: str, subject: str, body: str, ctx: Context) -> str: """Send an email, logging metadata about the request.""" # Access client-provided metadata meta = ctx.request\_context.meta if meta: # Meta is accessed as an object with attribute access user\_id = met... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/context.mdx | main | model-context-protocol-fastmcp | [
-0.022754359990358353,
0.04892497509717941,
0.046890754252672195,
0.015979507938027382,
0.05943800136446953,
-0.13572700321674347,
0.09903305768966675,
0.02926519513130188,
0.009837610647082329,
0.0014765630476176739,
-0.015173361636698246,
-0.016631828621029854,
0.02751324698328972,
0.005... | 0.08715 |
import { VersionBadge } from '/snippets/version-badge.mdx' Lifespans let you run code once when the server starts and clean up when it stops. Unlike per-session handlers, lifespans run exactly once regardless of how many clients connect. ## Basic Usage Use the `@lifespan` decorator to define a lifespan: ```python from ... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/lifespan.mdx | main | model-context-protocol-fastmcp | [
-0.08235489577054977,
0.03192425146698952,
0.013952589593827724,
0.013850482180714607,
0.021579328924417496,
-0.0753689780831337,
-0.0318390317261219,
-0.02515849843621254,
0.033389076590538025,
0.01886489987373352,
0.04107532277703285,
0.0431862398982048,
0.06047505512833595,
-0.037015944... | 0.020648 |
import { VersionBadge } from "/snippets/version-badge.mdx" Production servers often need to accept tokens from multiple authentication sources. An interactive application might authenticate through an OAuth proxy, while a backend service sends machine-to-machine JWT tokens directly. `MultiAuth` composes these sources i... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/multi-auth.mdx | main | model-context-protocol-fastmcp | [
-0.10327951610088348,
-0.016576848924160004,
0.080555759370327,
-0.08470859378576279,
0.06831739097833633,
-0.10571867972612381,
0.0023942713160067797,
-0.05433550477027893,
0.034589868038892746,
-0.030014507472515106,
0.00193311448674649,
-0.0073693376034498215,
0.14069515466690063,
-0.04... | 0.039023 |
import { VersionBadge } from "/snippets/version-badge.mdx" \*\*This is an extremely advanced pattern that most users should avoid.\*\* Building a secure OAuth 2.1 server requires deep expertise in authentication protocols, cryptography, and security best practices. The complexity extends far beyond initial implementati... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/full-oauth-server.mdx | main | model-context-protocol-fastmcp | [
-0.08759089559316635,
0.04681473225355148,
0.0688086673617363,
-0.08078969269990921,
0.05633637681603432,
-0.024186773225665092,
0.0278365109115839,
-0.010602976195514202,
-0.019644541665911674,
-0.04779613018035889,
0.030716730281710625,
0.013430061750113964,
0.10522464662790298,
-0.01894... | -0.03141 |
and secure storage requirements. Mistakes can lead to serious security vulnerabilities. | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/full-oauth-server.mdx | main | model-context-protocol-fastmcp | [
-0.03163127601146698,
0.051518529653549194,
-0.019501252099871635,
0.011205284856259823,
0.005335947033017874,
-0.0370149165391922,
-0.07525215297937393,
0.017966603860259056,
0.0269094780087471,
0.015080387704074383,
0.047138214111328125,
0.11936715990304947,
0.0621325746178627,
0.0180553... | 0.125497 |
import { VersionBadge } from "/snippets/version-badge.mdx" Authentication in MCP presents unique challenges that differ from traditional web applications. MCP clients need to discover authentication requirements automatically, negotiate OAuth flows without user intervention, and work seamlessly across different identit... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/authentication.mdx | main | model-context-protocol-fastmcp | [
-0.06427313387393951,
0.02683107927441597,
0.013052948750555515,
-0.08180637657642365,
0.03553567826747894,
-0.036663834005594254,
0.04674891382455826,
-0.0010762620950117707,
-0.029609590768814087,
-0.024248016998171806,
0.015118024311959743,
-0.03148461505770683,
0.07267110794782639,
-0.... | 0.098439 |
authentication features without the complexity of building them from scratch. It scales well across multiple applications and provides consistent user experiences. ### Full OAuth Implementation Your server implements a complete OAuth 2.0 authorization server, handling everything from user credential verification to tok... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/authentication.mdx | main | model-context-protocol-fastmcp | [
-0.09534643590450287,
0.02263275347650051,
0.06874414533376694,
-0.04380127415060997,
0.03922641649842262,
-0.04972148314118385,
0.001519613666459918,
0.01118057407438755,
0.01858684979379177,
-0.022797875106334686,
-0.00017000841035041958,
-0.01842314936220646,
0.044506948441267014,
-0.01... | 0.06573 |
providers require manual app registration and fixed credentials, `OAuthProxy` bridges the gap. It presents a DCR-compliant interface to MCP clients (accepting any registration request) while using your pre-registered credentials with the upstream provider. The proxy handles the complexity of callback forwarding, enabli... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/authentication.mdx | main | model-context-protocol-fastmcp | [
-0.15991361439228058,
-0.011239620856940746,
-0.0002689796965569258,
0.010951231233775616,
-0.030883770436048508,
-0.06914222985506058,
-0.05147920176386833,
0.06790145486593246,
-0.007779317442327738,
-0.0728016346693039,
0.01402709074318409,
0.02687172405421734,
0.08937706798315048,
-0.0... | -0.04149 |
## Choosing Your Implementation The authentication approach you choose depends on your existing infrastructure, security requirements, and operational constraints. \*\*For OAuth providers without DCR support (GitHub, Google, Azure, AWS, most enterprise systems), use OAuth Proxy.\*\* These providers require manual app r... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/authentication.mdx | main | model-context-protocol-fastmcp | [
-0.13630367815494537,
-0.015419337898492813,
0.03834057226777077,
-0.06916743516921997,
0.00304398313164711,
-0.010026304051280022,
0.007569967303425074,
0.0785520151257515,
0.032320670783519745,
-0.0028629396110773087,
-0.029178926721215248,
-0.0006674889009445906,
0.06010067090392113,
-0... | 0.07541 |
import { VersionBadge } from "/snippets/version-badge.mdx"; The OIDC proxy enables FastMCP servers to authenticate with OIDC providers that \*\*don't support Dynamic Client Registration (DCR)\*\* out of the box. This includes OAuth providers like: Auth0, Google, Azure, AWS, etc. For providers that do support DCR (like ... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oidc-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.13685257732868195,
0.01969294436275959,
0.0018374945502728224,
-0.022751566022634506,
0.02355903759598732,
-0.03995624557137489,
0.007712384685873985,
-0.03358164802193642,
0.01982307806611061,
-0.02674839273095131,
0.006892837584018707,
0.0415337048470974,
0.07837199419736862,
-0.03501... | -0.075918 |
tokens with the upstream provider. - `"client\_secret\_basic"`: Send credentials in Authorization header (most common) - `"client\_secret\_post"`: Send credentials in request body (required by some providers) - `"none"`: No authentication (for public clients) - `None` (default): Uses authlib's default (typically `"clie... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oidc-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.11993584781885147,
-0.004361409693956375,
-0.00835866667330265,
-0.042266424745321274,
-0.045361727476119995,
-0.043777670711278915,
0.02488926239311695,
0.048394329845905304,
0.020054932683706284,
-0.008296425454318523,
0.03425827622413635,
-0.023403672501444817,
0.03356343135237694,
-... | 0.089405 |
(Client ID Metadata Document) support from `OAuthProxy`. Clients can use HTTPS URLs as their `client\_id` instead of registering dynamically, and the proxy will fetch and validate their metadata document. See the [OAuth Proxy CIMD documentation](/servers/auth/oauth-proxy#cimd-support) for complete details on how CIMD w... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oidc-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.10561162233352661,
0.05903373658657074,
-0.018685955554246902,
-0.03840130567550659,
-0.05764476954936981,
-0.06195007264614105,
-0.040766846388578415,
0.06120441108942032,
0.02163534238934517,
-0.031084619462490082,
-0.0009914456168189645,
-0.017747005447745323,
0.1138526201248169,
-0.... | -0.014691 |
import { VersionBadge } from "/snippets/version-badge.mdx"; The OAuth proxy enables FastMCP servers to authenticate with OAuth providers that \*\*don't support Dynamic Client Registration (DCR)\*\*. This includes virtually all traditional OAuth providers: GitHub, Google, Azure, AWS, Discord, Facebook, and most enterpri... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oauth-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.12669405341148376,
-0.01842081919312477,
0.06984301656484604,
-0.04665679112076759,
0.03084099479019642,
-0.025938397273421288,
-0.022002017125487328,
-0.006257536355406046,
0.05243484675884247,
-0.012060016393661499,
-0.0030915087554603815,
0.05054241418838501,
0.09027444571256638,
-0.... | -0.047258 |
endpoints. When mounting under a path prefix, include that prefix in `base\_url`. Use `issuer\_url` separately to specify where auth server metadata is located (typically at root level). Optional public base URL for the protected resource metadata and token audience. Use this when your OAuth callbacks and operational e... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oauth-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.03867945075035095,
0.0006340482505038381,
0.053515344858169556,
0.009586815722286701,
0.023580346256494522,
-0.09172108769416809,
-0.05466989055275917,
0.02695949748158455,
0.050493024289608,
-0.049119994044303894,
0.05216541513800621,
0.0033252027351409197,
0.062182988971471786,
0.0265... | -0.04443 |
to forward to the upstream token endpoint during code exchange and token refresh. Useful for provider-specific requirements during token operations. For example, some providers require additional context during token exchange: ```python extra\_token\_params={"audience": "https://api.example.com"} ``` These parameters a... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oauth-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.08569130301475525,
-0.06629981845617294,
0.0842391848564148,
0.042881134897470474,
-0.015702327713370323,
-0.04520871862769127,
-0.04454926401376724,
0.08016844093799591,
0.04123375564813614,
0.017069809138774872,
-0.019491015002131462,
0.08607819676399231,
0.02918887510895729,
-0.04480... | 0.071449 |
Authorization proceeds directly to the upstream provider without any consent UI. Logs a security warning. Only for local development or testing. ```python # Development/testing only - skip consent screen auth = OAuthProxy( ..., require\_authorization\_consent=False # ⚠️ Security warning: only for local/testing ) # Conv... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oauth-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.05276017636060715,
0.12368037551641464,
-0.02035835199058056,
0.02705685794353485,
0.05646372213959694,
-0.06892695277929306,
-0.009092947468161583,
-0.006028854288160801,
0.025643879547715187,
-0.04487226530909538,
0.014023995026946068,
0.019609136506915092,
0.07953950762748718,
-0.006... | 0.007299 |
Proxy->>Provider: 6. Redirect to provider redirect\_uri=server:8000/auth/callback code\_challenge=PROXY\_CHALLENGE Note over Provider, Proxy: Provider Callback Provider->>Proxy: 7. GET /auth/callback with authorization code Note over Proxy: Verify consent binding cookie (reject if missing or mismatched) Proxy->>Provide... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oauth-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.13179828226566315,
0.021506275981664658,
0.07953058183193207,
-0.00024042374570854008,
-0.02273206040263176,
-0.06497325748205185,
0.03185885772109032,
0.03753112256526947,
-0.005295140203088522,
-0.023899951949715614,
-0.03567195683717728,
-0.003018426476046443,
0.02333741821348667,
-0... | 0.046748 |
token\*\* using the JTI from the validated JWT 3. \*\*Decrypts and validates\*\* the upstream token with the provider This two-tier validation ensures that FastMCP tokens can only be used with this server (via audience validation) while maintaining full upstream token security. This architecture also prevents [token pa... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oauth-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.1497218757867813,
-0.014745726250112057,
0.05612194165587425,
-0.033018212765455246,
0.03178372606635094,
-0.027793951332569122,
-0.009000224992632866,
-0.004873165860772133,
0.08931518346071243,
-0.05947563052177429,
0.009117983281612396,
0.031239021569490433,
0.030020395293831825,
-0.... | 0.101154 |
OAuth proxy supports \*\*Client ID Metadata Documents (CIMD)\*\*, an alternative to Dynamic Client Registration where clients host a static JSON document at an HTTPS URL. Instead of registering dynamically, clients simply provide their CIMD URL as their `client\_id`, and the server fetches and validates the metadata. C... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oauth-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.14573507010936737,
0.08748454600572586,
-0.019849492236971855,
-0.033266570419073105,
-0.011273876763880253,
-0.11912033706903458,
-0.022929424419999123,
0.057566411793231964,
0.09492689371109009,
-0.07044516503810883,
-0.0657198503613472,
-0.007498339284211397,
0.1025327816605568,
0.00... | 0.031211 |
production:\*\* Configure the following parameters together: provide a unique `jwt\_signing\_key` (for signing FastMCP JWTs), and a shared `client\_storage` backend (for storing tokens). Both are required for production deployments. Use a network-accessible storage backend like Redis or DynamoDB rather than local disk ... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oauth-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.07881513983011246,
0.03765750303864479,
-0.012790932320058346,
-0.014164785854518414,
0.02891758270561695,
-0.06125748157501221,
0.011883086524903774,
0.043612364679574966,
0.04085210710763931,
-0.029504960402846336,
0.012554486282169819,
-0.015096393413841724,
0.08853016048669815,
-0.0... | 0.052069 |
browser-level heuristic. For the strongest defense, leave `require\_authorization\_consent=True`. \*\*Learn more:\*\* - [MCP Security Best Practices](https://modelcontextprotocol.io/specification/2025-06-18/basic/security\_best\_practices#confused-deputy-problem) - Official specification guidance - [Confused Deputy Att... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/oauth-proxy.mdx | main | model-context-protocol-fastmcp | [
-0.09542512148618698,
0.05685954540967941,
0.05603993311524391,
0.000516996078658849,
0.06752423942089081,
-0.05557714030146599,
0.04228304699063301,
0.03205164521932602,
-0.020107697695493698,
-0.00888242106884718,
0.0025273992214351892,
0.023890364915132523,
0.06698812544345856,
0.010342... | 0.120028 |
import { VersionBadge } from "/snippets/version-badge.mdx" Token verification enables your FastMCP server to validate bearer tokens issued by external systems without participating in user authentication flows. Your server acts as a pure resource server, focusing on token validation and authorization decisions while de... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/token-verification.mdx | main | model-context-protocol-fastmcp | [
-0.07521554082632065,
-0.00025766598992049694,
0.09099684655666351,
-0.061077047139406204,
0.08670754730701447,
-0.05220187082886696,
0.056699488312006,
-0.055068258196115494,
0.05747239664196968,
0.006187762133777142,
0.01196020282804966,
0.010815794579684734,
0.10767531394958496,
0.00743... | 0.091051 |
techniques and claim validation. ### JWKS Endpoint Integration JWKS endpoint integration provides the most flexible approach for production systems. The verifier automatically fetches public keys from a JSON Web Key Set endpoint, enabling automatic key rotation without server configuration changes. ```python from fastm... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/token-verification.mdx | main | model-context-protocol-fastmcp | [
-0.15705539286136627,
0.0449114553630352,
-0.005068669561296701,
-0.04893486201763153,
-0.00708637572824955,
-0.09724998474121094,
-0.015805289149284363,
-0.016084086149930954,
0.03478870168328285,
-0.013211041688919067,
0.03814345598220825,
-0.033563267439603806,
0.09843796491622925,
-0.0... | 0.03333 |
opaque token validation through OAuth 2.0 Token Introspection (RFC 7662). ### Understanding Opaque Tokens Opaque tokens differ fundamentally from JWTs in their verification model. Where JWTs carry signed claims that can be validated locally, opaque tokens require network calls to the issuing authorization server for va... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/token-verification.mdx | main | model-context-protocol-fastmcp | [
-0.0998813584446907,
0.05892125889658928,
0.05685490742325783,
-0.011991258710622787,
0.05379582196474075,
-0.155723437666893,
0.03908943012356758,
-0.00042239733738824725,
0.09083832055330276,
-0.08460771292448044,
-0.023549944162368774,
0.026414021849632263,
0.03023350238800049,
-0.04017... | 0.139576 |
For more controlled testing, provide custom validation logic: ```python from fastmcp.server.auth.providers.debug import DebugTokenVerifier # Synchronous validation - check token prefix verifier = DebugTokenVerifier( validate=lambda token: token.startswith("dev-"), client\_id="development-client", scopes=["read", "write... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/token-verification.mdx | main | model-context-protocol-fastmcp | [
-0.09590635448694229,
-0.03687334060668945,
-0.05638071522116661,
0.028002647683024406,
-0.04428680241107941,
-0.1284821778535843,
-0.009313140995800495,
-0.023285193368792534,
0.008771910332143307,
-0.014898409135639668,
0.02835753746330738,
-0.019124623388051987,
0.0820261761546135,
-0.0... | 0.033929 |
token verifier. ## Production Configuration For production deployments, load sensitive configuration from environment variables: ```python import os from fastmcp import FastMCP from fastmcp.server.auth.providers.jwt import JWTVerifier # Load configuration from environment variables # Parse comma-separated scopes if pro... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/token-verification.mdx | main | model-context-protocol-fastmcp | [
-0.049459103494882584,
0.0019031678093597293,
0.02545737661421299,
0.004325391259044409,
0.01782195083796978,
-0.11141042411327362,
-0.06067335233092308,
-0.013567506335675716,
-0.05058318376541138,
-0.05178138613700867,
0.024621689692139626,
-0.09604594111442566,
0.05308661237359047,
-0.0... | -0.030866 |
import { VersionBadge } from "/snippets/version-badge.mdx" Remote OAuth integration allows your FastMCP server to leverage external identity providers that \*\*support Dynamic Client Registration (DCR)\*\*. With DCR, MCP clients can automatically register themselves with the identity provider and obtain credentials wit... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/remote-oauth.mdx | main | model-context-protocol-fastmcp | [
-0.13257698714733124,
0.009907810017466545,
0.03935577720403671,
-0.041215017437934875,
0.05280807241797447,
0.0037266600411385298,
0.010927211493253708,
0.0008923286222852767,
0.02319270744919777,
-0.006278460379689932,
0.013942105695605278,
0.025172417983412743,
0.0820167064666748,
-0.02... | -0.013551 |
FastMCPServer->>FastMCPServer: 6. Verify token signature FastMCPServer-->>Client: 7. MCP response ``` This flow separates concerns cleanly: your MCP server handles resource protection and token validation, while your identity provider handles user authentication and token issuance. The client coordinates between these ... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/remote-oauth.mdx | main | model-context-protocol-fastmcp | [
-0.12967070937156677,
0.005179826635867357,
0.07122830301523209,
-0.02806679531931877,
0.07785053551197052,
-0.03627951443195343,
0.02166386879980564,
0.003180714091286063,
0.04928084462881088,
-0.01849931851029396,
0.05843702703714371,
0.02399510331451893,
0.07524062693119049,
-0.01068035... | 0.025414 |
token\_verifier = JWTVerifier( jwks\_uri="https://auth.yourcompany.com/.well-known/jwks.json", issuer="https://auth.yourcompany.com", audience="mcp-production-api" ) super().\_\_init\_\_( token\_verifier=token\_verifier, authorization\_servers=[AnyHttpUrl("https://auth.yourcompany.com")], base\_url="https://api.yourcom... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/auth/remote-oauth.mdx | main | model-context-protocol-fastmcp | [
-0.07542303204536438,
0.03227976709604263,
-0.0033609161619096994,
0.0020025931298732758,
0.013027395121753216,
-0.07709057629108429,
-0.019950993359088898,
0.021689390763640404,
-0.05080036446452141,
-0.017016859725117683,
-0.032209016382694244,
-0.06069829687476158,
0.03336530923843384,
... | -0.000708 |
import { VersionBadge } from '/snippets/version-badge.mdx' Every FastMCP server has one or more component providers. A provider is a source of tools, resources, and prompts - it's what makes components available to clients. ## What Is a Provider? When a client connects to your server and asks "what tools do you have?",... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/overview.mdx | main | model-context-protocol-fastmcp | [
-0.03578275069594383,
-0.021277083083987236,
0.0685473084449768,
0.00211455044336617,
0.05264491215348244,
0.013805629685521126,
0.0004131349560339004,
-0.03693313151597977,
-0.0089870635420084,
-0.012355630286037922,
0.03718079626560211,
-0.019055644050240517,
0.08011328428983688,
-0.0525... | -0.049074 |
[Mount another server](/servers/composition) into yours - [Proxy a remote server](/servers/providers/proxy) through yours - [Control visibility state](/servers/visibility) of components - [Build dynamic sources](/servers/providers/custom) like database-backed tools ## Next Steps - [Local](/servers/providers/local) - Ho... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/overview.mdx | main | model-context-protocol-fastmcp | [
-0.057181380689144135,
-0.02664349041879177,
-0.02858481928706169,
0.029969792813062668,
-0.06581272929906845,
-0.035797201097011566,
-0.017838120460510254,
-0.04084774851799011,
-0.05387215316295624,
0.019089888781309128,
-0.008616386912763119,
-0.0019754020031541586,
0.04595840722322464,
... | 0.021132 |
import { VersionBadge } from '/snippets/version-badge.mdx' `FileSystemProvider` scans a directory for Python files and automatically registers functions decorated with `@tool`, `@resource`, or `@prompt`. This enables a file-based organization pattern similar to Next.js routing, where your project structure becomes your... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/filesystem.mdx | main | model-context-protocol-fastmcp | [
-0.13230422139167786,
-0.004765968304127455,
-0.003931502345949411,
0.007995842956006527,
0.07260838896036148,
-0.037471089512109756,
-0.03868694230914116,
0.008155697956681252,
0.04564262926578522,
0.016382357105612755,
0.04401005432009697,
0.08314359933137894,
0.0443570651113987,
0.02472... | 0.02512 |
examples and analogies." ``` The decorator supports: `name`, `title`, `description`, `icons`, `tags`, and `meta`. ## Directory Structure The directory structure is purely organizational. The provider recursively scans all `.py` files regardless of which subdirectory they're in. Subdirectories like `tools/`, `resources/... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/filesystem.mdx | main | model-context-protocol-fastmcp | [
-0.0639898031949997,
-0.007888789288699627,
-0.04562653601169586,
0.039999183267354965,
0.0037017357535660267,
-0.10469571501016617,
0.04921451956033707,
0.04714371636509895,
-0.04189847409725189,
0.0050829374231398106,
0.025928564369678497,
0.03448819741606712,
0.09215091168880463,
0.0890... | 0.028964 |
import { VersionBadge } from '/snippets/version-badge.mdx' Custom providers let you source components from anywhere - databases, APIs, configuration systems, or dynamic runtime logic. If you can write Python code to fetch or generate a component, you can wrap it in a provider. ## When to Build Custom The built-in provi... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/custom.mdx | main | model-context-protocol-fastmcp | [
-0.05542683228850365,
-0.05984976142644882,
-0.03184224292635918,
0.006980573758482933,
0.019216440618038177,
-0.0073742615059018135,
-0.023797154426574707,
0.012238842435181141,
-0.06321264803409576,
0.0030790846794843674,
0.0011433092877268791,
0.00819697417318821,
0.048278361558914185,
... | 0.022919 |
```python from collections.abc import Callable, Sequence from fastmcp import FastMCP from fastmcp.server.providers import Provider from fastmcp.tools import Tool class DictProvider(Provider): def \_\_init\_\_(self, tools: dict[str, Callable]): super().\_\_init\_\_() self.\_tools = [ Tool.from\_function(fn, name=name) f... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/custom.mdx | main | model-context-protocol-fastmcp | [
-0.13144011795520782,
-0.013513551093637943,
-0.055212292820215225,
0.0012464052997529507,
-0.15593573451042175,
-0.0894341915845871,
0.06741302460432053,
-0.002574177458882332,
0.013213120400905609,
-0.03949317708611488,
0.06667649000883102,
-0.03781711682677269,
0.02730000950396061,
0.02... | -0.016085 |
import { VersionBadge } from '/snippets/version-badge.mdx' Agent skills are directories containing instructions and supporting files that teach an AI assistant how to perform specific tasks. Tools like Claude Code, Cursor, and VS Code Copilot each have their own skills directories where users can add custom capabilitie... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/skills.mdx | main | model-context-protocol-fastmcp | [
-0.07611880451440811,
-0.03204100951552391,
-0.0326920785009861,
-0.05215063691139221,
0.012587988749146461,
0.049191880971193314,
0.040112413465976715,
0.018288221210241318,
-0.08874672651290894,
-0.03942827507853508,
-0.027524573728442192,
0.02635033056139946,
0.06542317569255829,
0.0203... | 0.087264 |
files, and creates the appropriate resources. ```python from pathlib import Path from fastmcp import FastMCP from fastmcp.server.providers.skills import SkillProvider mcp = FastMCP("Single Skill") mcp.add\_provider(SkillProvider(Path.home() / ".claude" / "skills" / "pdf-processing")) ``` Use `SkillProvider` when you wa... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/skills.mdx | main | model-context-protocol-fastmcp | [
-0.046655863523483276,
-0.05097830668091774,
-0.08951332420110703,
0.02260013483464718,
0.0017368944827467203,
-0.03145170956850052,
0.03909486159682274,
0.03315897658467293,
-0.05217276141047478,
-0.061478141695261,
0.09794814139604568,
0.042016834020614624,
0.06559993326663971,
0.0626805... | 0.002318 |
removed skills disappear, and modified content reflects current file state. Reload mode adds overhead to every request. Use it during development when you're actively editing skills, but disable it in production. ## Client Utilities FastMCP provides utilities for downloading skills from any MCP server that exposes them... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/skills.mdx | main | model-context-protocol-fastmcp | [
-0.0519949235022068,
0.026419535279273987,
-0.009004022926092148,
0.10114584863185883,
0.02478894591331482,
-0.028605856001377106,
0.02430272474884987,
-0.028478533029556274,
-0.03630746155977249,
-0.004060631617903709,
0.04348379373550415,
0.09536559879779816,
0.009739699773490429,
-0.028... | 0.014224 |
import { VersionBadge } from '/snippets/version-badge.mdx' `LocalProvider` stores components that you define directly on your server. When you use `@mcp.tool`, `@mcp.resource`, or `@mcp.prompt`, you're adding components to your server's `LocalProvider`. ## How It Works Every FastMCP server has a `LocalProvider` as its ... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/local.mdx | main | model-context-protocol-fastmcp | [
-0.03709559887647629,
-0.0023516297806054354,
0.0556410551071167,
0.008805599994957447,
0.03849705681204796,
-0.001587339793331921,
0.006509922910481691,
-0.029024362564086914,
0.017483554780483246,
-0.02956273779273033,
0.08051659911870956,
0.0007987964781932533,
0.07416096329689026,
-0.0... | -0.060431 |
import { VersionBadge } from '/snippets/version-badge.mdx' The Proxy Provider sources components from another MCP server through a client connection. This lets you expose any MCP server's tools, resources, and prompts through your own server, whether the source is local or accessed over the network. ## Why Use Proxy Pr... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/proxy.mdx | main | model-context-protocol-fastmcp | [
-0.04564674198627472,
-0.012464003637433052,
0.04990877956151962,
-0.06351874768733978,
-0.029106328263878822,
-0.013297632336616516,
-0.027722055092453957,
-0.014303440228104591,
-0.020274629816412926,
0.004907215945422649,
-0.03234885260462761,
-0.015593161806464195,
0.06868356466293335,
... | 0.06111 |
Sampling | LLM completion requests | | Elicitation | User input requests | | Logging | Log messages from backend | | Progress | Progress notifications | ```python from fastmcp.server import create\_proxy # All features forwarded automatically proxy = create\_proxy("advanced\_backend.py") # When the backend: # - Request... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/proxy.mdx | main | model-context-protocol-fastmcp | [
-0.03771468997001648,
-0.016671480610966682,
0.06449966132640839,
0.015381171368062496,
-0.02224717289209366,
-0.08383695781230927,
0.0031345186289399862,
-0.04142283275723457,
-0.005298985633999109,
0.03264574706554413,
-0.03587975353002548,
0.016789807006716728,
0.07425310462713242,
-0.0... | -0.031711 |
= FastMCPProxy( client\_factory=lambda: shared\_client, name="ReusedSessionProxy", ) ``` This eliminates the MCP initialization handshake on every call, which can dramatically reduce latency under load. The `Client` uses reference counting for its session lifecycle, so concurrent callers sharing the same instance is sa... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/providers/proxy.mdx | main | model-context-protocol-fastmcp | [
-0.08550059050321579,
-0.006421889178454876,
0.0005704588838852942,
-0.013569642789661884,
-0.09690558910369873,
-0.06931772828102112,
0.03645053505897522,
-0.020093901082873344,
0.012890269979834557,
-0.020471841096878052,
-0.024173596873879433,
0.03441332280635834,
0.06555736809968948,
-... | -0.04809 |
import { VersionBadge } from '/snippets/version-badge.mdx' Tool transformation lets you modify tool schemas - renaming tools, changing descriptions, adjusting tags, and reshaping argument schemas. FastMCP provides two mechanisms that share the same configuration options but differ in timing. \*\*Deferred transformation... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/transforms/tool-transformation.mdx | main | model-context-protocol-fastmcp | [
-0.1181601732969284,
0.009105765260756016,
-0.021719027310609818,
-0.02416427992284298,
-0.04677557572722435,
-0.01742415502667427,
-0.01719941943883896,
-0.01233314536511898,
-0.020720846951007843,
-0.029802575707435608,
0.060040198266506195,
-0.029814010486006737,
0.06463473290205002,
-0... | -0.008565 |
value. `default\_factory` requires `hide=True`. Visible arguments need static defaults that can be represented in JSON Schema. ## Renaming Arguments Rename arguments to make them more intuitive for LLMs or match your API conventions. ```python from fastmcp.tools import Tool, tool from fastmcp.tools.tool\_transform impo... | https://github.com/jlowin/fastmcp/blob/main/docs/servers/transforms/tool-transformation.mdx | main | model-context-protocol-fastmcp | [
-0.10034281015396118,
0.0673798993229866,
-0.05781935527920723,
0.03668110817670822,
-0.0864100307226181,
0.028705842792987823,
0.004270538687705994,
0.034829746931791306,
0.002843692200258374,
-0.05828800052404404,
0.09519439935684204,
-0.03537788614630699,
0.07595153898000717,
-0.0185821... | 0.040402 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.