From 66252018ed2a7a06ade8480e7a8964cfd52f05a4 Mon Sep 17 00:00:00 2001 From: "marvin-context-protocol[bot]" <225465937+marvin-context-protocol[bot]@users.noreply.github.com> Date: Fri, 29 Aug 2025 18:25:53 +0000 Subject: [PATCH 1/2] docs: add performance warnings for mounted servers and proxies - Add warning about performance impact in mounted servers section - Explain that list_tools() operations are affected by slowest mounted server - Note that HTTP-based servers can introduce 300-400ms latency vs 1-2ms for local - Recommend import_server() for performance-critical applications - Add performance considerations section to proxy documentation - Reference composition documentation for alternatives Co-authored-by: William Easton --- docs/servers/composition.mdx | 7 ++++++- docs/servers/proxy.mdx | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/servers/composition.mdx b/docs/servers/composition.mdx index 60714c992..7ca68eb6e 100644 --- a/docs/servers/composition.mdx +++ b/docs/servers/composition.mdx @@ -29,8 +29,9 @@ The choice of importing or mounting depends on your use case and requirements. | **Method** | `FastMCP.import_server(server, prefix=None)` | `FastMCP.mount(server, prefix=None)` | | **Composition Type** | One-time copy (static) | Live link (dynamic) | | **Updates** | Changes to subserver NOT reflected | Changes to subserver immediately reflected | +| **Performance** | Fast - no runtime delegation | Slower - affected by slowest mounted server | | **Prefix** | Optional - omit for original names | Optional - omit for original names | -| **Best For** | Bundling finalized components | Modular runtime composition | +| **Best For** | Bundling finalized components, performance-critical setups | Modular runtime composition | ### Proxy Servers @@ -152,6 +153,10 @@ When importing multiple servers with the same prefix, or no prefix, components f The `mount()` method creates a **live link** between the `main_mcp` server and the `subserver`. Instead of copying components, requests for components matching the optional `prefix` are **delegated** to the `subserver` at runtime. If no prefix is provided, the subserver's components are accessible without prefixing. When multiple servers are mounted with the same prefix (or no prefix), the most recently mounted server takes precedence for conflicting component names. + +**Performance Impact**: Operations like `list_tools()` will be impacted by the speed of the slowest mounted server. HTTP-based mounted servers can introduce significant latency (300-400ms vs 1-2ms for local tools), and this slowdown affects **all** tools, not just the remote ones. If performance is critical, consider using [`import_server()`](#importing-static-composition) instead, which copies components once at startup rather than delegating requests at runtime. + + ```python import asyncio from fastmcp import FastMCP, Client diff --git a/docs/servers/proxy.mdx b/docs/servers/proxy.mdx index bf648ae2a..cd03f1751 100644 --- a/docs/servers/proxy.mdx +++ b/docs/servers/proxy.mdx @@ -38,6 +38,12 @@ sequenceDiagram - **Security**: Acts as a controlled gateway to backend servers - **Simplicity**: Single endpoint even if backend location or transport changes +### Performance Considerations + +When using proxy servers, especially those connecting to HTTP-based backend servers, be aware that latency can be significant. Operations like `list_tools()` may take hundreds of milliseconds compared to 1-2ms for local tools. When mounting proxy servers, this latency affects all operations on the parent server, not just the proxied tools. + +For performance-critical applications, consider using [`import_server()`](/servers/composition#importing-static-composition) to copy tools at startup rather than proxying them at runtime. + ## Quick Start From 67d933abcfc0cb7bf95b9c64aced924ca73e2113 Mon Sep 17 00:00:00 2001 From: William Easton Date: Mon, 1 Sep 2025 13:57:40 -0500 Subject: [PATCH 2/2] Small edits --- docs/servers/composition.mdx | 7 +++---- docs/servers/proxy.mdx | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/servers/composition.mdx b/docs/servers/composition.mdx index 7ca68eb6e..370f072de 100644 --- a/docs/servers/composition.mdx +++ b/docs/servers/composition.mdx @@ -153,10 +153,6 @@ When importing multiple servers with the same prefix, or no prefix, components f The `mount()` method creates a **live link** between the `main_mcp` server and the `subserver`. Instead of copying components, requests for components matching the optional `prefix` are **delegated** to the `subserver` at runtime. If no prefix is provided, the subserver's components are accessible without prefixing. When multiple servers are mounted with the same prefix (or no prefix), the most recently mounted server takes precedence for conflicting component names. - -**Performance Impact**: Operations like `list_tools()` will be impacted by the speed of the slowest mounted server. HTTP-based mounted servers can introduce significant latency (300-400ms vs 1-2ms for local tools), and this slowdown affects **all** tools, not just the remote ones. If performance is critical, consider using [`import_server()`](#importing-static-composition) instead, which copies components once at startup rather than delegating requests at runtime. - - ```python import asyncio from fastmcp import FastMCP, Client @@ -209,6 +205,9 @@ The same prefixing rules apply as with `import_server` for naming tools, resourc The `prefix` parameter is optional. If omitted, components are mounted without modification. +#### Performance Considerations + +Due to the "live link", operations like `list_tools()` on the parent server will be impacted by the speed of the slowest mounted server. In particular, HTTP-based mounted servers can introduce significant latency (300-400ms vs 1-2ms for local tools), and this slowdown affects the whole server, not just interactions with the HTTP-proxied tools. If performance is important, importing tools via [`import_server()`](#importing-static-composition) may be a more appropriate solution as it copies components once at startup rather than delegating requests at runtime. #### Mounting Without Prefixes diff --git a/docs/servers/proxy.mdx b/docs/servers/proxy.mdx index cd03f1751..1ca535968 100644 --- a/docs/servers/proxy.mdx +++ b/docs/servers/proxy.mdx @@ -40,9 +40,9 @@ sequenceDiagram ### Performance Considerations -When using proxy servers, especially those connecting to HTTP-based backend servers, be aware that latency can be significant. Operations like `list_tools()` may take hundreds of milliseconds compared to 1-2ms for local tools. When mounting proxy servers, this latency affects all operations on the parent server, not just the proxied tools. +When using proxy servers, especially those connecting to HTTP-based backend servers, be aware that latency can be significant. Operations like `list_tools()` may take hundreds of milliseconds compared to 1-2ms for local tools. When mounting proxy servers, this latency affects all operations on the parent server, not just interactions with the proxied tools. -For performance-critical applications, consider using [`import_server()`](/servers/composition#importing-static-composition) to copy tools at startup rather than proxying them at runtime. +If low latency is a requirement for your use-case, consider using [`import_server()`](/servers/composition#importing-static-composition) to copy tools at startup rather than proxying them at runtime. ## Quick Start