mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-20 20:44:17 +02:00
commit
7df8db451d
8 changed files with 45 additions and 22 deletions
|
|
@ -5,6 +5,10 @@ description: Understand the different ways FastMCP Clients can connect to server
|
|||
icon: link
|
||||
---
|
||||
|
||||
import { VersionBadge } from "/snippets/version-badge.mdx"
|
||||
|
||||
<VersionBadge version="2.0.0" />
|
||||
|
||||
The FastMCP `Client` relies on a `ClientTransport` object to handle the specifics of connecting to and communicating with an MCP server. FastMCP provides several built-in transport implementations for common connection methods.
|
||||
|
||||
While the `Client` often infers the correct transport automatically (see [Client Overview](/clients/client#transport-inference)), you can also instantiate transports explicitly for more control.
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ description: "Community-contributed modules extending FastMCP"
|
|||
icon: "cubes"
|
||||
---
|
||||
|
||||
import { VersionBadge } from "/snippets/version-badge.mdx"
|
||||
|
||||
<VersionBadge version="2.2.1" />
|
||||
|
||||
FastMCP includes a `contrib` package that holds community-contributed modules. These modules extend FastMCP's functionality but aren't officially maintained by the core team.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ description: Learn about the core FastMCP server class and how to run it.
|
|||
icon: server
|
||||
---
|
||||
|
||||
import { VersionBadge } from "/snippets/version-badge.mdx"
|
||||
|
||||
The central piece of a FastMCP application is the `FastMCP` server class. This class acts as the main container for your application's tools, resources, and prompts, and manages communication with MCP clients.
|
||||
|
||||
## Creating a Server
|
||||
|
|
@ -225,6 +227,8 @@ The CLI can dynamically find and run FastMCP server objects in your files, but i
|
|||
|
||||
## Composing Servers
|
||||
|
||||
<VersionBadge version="2.2.0" />
|
||||
|
||||
FastMCP supports composing multiple servers together using `import_server` (static copy) and `mount` (live link). This allows you to organize large applications into modular components or reuse existing servers.
|
||||
|
||||
See the [Server Composition](/patterns/composition) guide for full details, best practices, and examples.
|
||||
|
|
@ -246,6 +250,8 @@ main.mount("sub", sub)
|
|||
|
||||
## Proxying Servers
|
||||
|
||||
<VersionBadge version="2.0.0" />
|
||||
|
||||
FastMCP can act as a proxy for any MCP server (local or remote) using `FastMCP.from_client`, letting you bridge transports or add a frontend to existing servers. For example, you can expose a remote SSE server locally via stdio, or vice versa.
|
||||
|
||||
See the [Proxying Servers](/patterns/proxy) guide for details and advanced usage.
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ description: Create reusable, parameterized prompt templates for MCP clients.
|
|||
icon: message-lines
|
||||
---
|
||||
|
||||
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?
|
||||
|
|
@ -201,6 +203,8 @@ Refer to the [Context documentation](/servers/context) for more details on these
|
|||
|
||||
### Duplicate Prompts
|
||||
|
||||
<VersionBadge version="2.1.0" />
|
||||
|
||||
You can configure how the FastMCP server handles attempts to register multiple prompts with the same name. Use the `on_duplicate_prompts` setting during `FastMCP` initialization.
|
||||
|
||||
```python
|
||||
|
|
|
|||
|
|
@ -397,6 +397,8 @@ This allows accessing the same template implementation through different URI pat
|
|||
|
||||
### Duplicate Resources
|
||||
|
||||
<VersionBadge version="2.1.0" />
|
||||
|
||||
You can configure how the FastMCP server handles attempts to register multiple resources or templates with the same URI. Use the `on_duplicate_resources` setting during `FastMCP` initialization.
|
||||
|
||||
```python
|
||||
|
|
|
|||
|
|
@ -311,6 +311,8 @@ For full documentation on the Context object and all its capabilities, see the [
|
|||
|
||||
### Duplicate Tools
|
||||
|
||||
<VersionBadge version="2.1.0" />
|
||||
|
||||
You can control how the FastMCP server behaves if you try to register multiple tools with the same name. This is configured using the `on_duplicate_tools` argument when creating the `FastMCP` instance.
|
||||
|
||||
```python
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
export const VersionBadge = ({ version }) => {
|
||||
return (
|
||||
<span className="version-badge">
|
||||
<span className="badge-emoji" aria-hidden="true" style={{ marginRight: '0.3em', verticalAlign: 'middle' }}>✨</span>
|
||||
New in version {version}
|
||||
</span>
|
||||
<code className="version-badge-container">
|
||||
<div className="version-badge">
|
||||
<span className="version-badge-label">New in version:</span>
|
||||
<span className="version-badge-version">{version}</span>
|
||||
</div>
|
||||
</code>
|
||||
|
||||
|
||||
|
||||
);
|
||||
};
|
||||
|
|
@ -14,16 +14,18 @@ h6 code:not(pre code) {
|
|||
|
||||
/* Version badge -- display a badge with the current version of the documentation */
|
||||
.version-badge {
|
||||
display: inline-flex;
|
||||
display: inline-block;
|
||||
align-items: center;
|
||||
gap: 0.3em;
|
||||
padding: 0.32em 1em;
|
||||
font-size: 0.92em;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.01em;
|
||||
color: #7417e5;
|
||||
background: #f3e8ff;
|
||||
border: 1.5px solid #c084fc;
|
||||
padding: 0.2em 0.8em;
|
||||
font-size: 1.1em;
|
||||
font-weight: 400;
|
||||
|
||||
font-family: "Inter", sans-serif;
|
||||
letter-spacing: 0.025em;
|
||||
color: #ff5400;
|
||||
background: #ffeee6;
|
||||
border: 1px solid rgb(255, 84, 0, 0.5);
|
||||
border-radius: 6px;
|
||||
box-shadow: none;
|
||||
vertical-align: middle;
|
||||
|
|
@ -31,6 +33,11 @@ h6 code:not(pre code) {
|
|||
transition: box-shadow 0.2s, transform 0.15s;
|
||||
}
|
||||
|
||||
.version-badge-container {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.version-badge:hover {
|
||||
box-shadow: 0 2px 8px 0 rgba(160, 132, 252, 0.1);
|
||||
transform: translateY(-1px) scale(1.03);
|
||||
|
|
@ -41,13 +48,3 @@ h6 code:not(pre code) {
|
|||
background: #312e81;
|
||||
border: 1.5px solid #a78bfa;
|
||||
}
|
||||
|
||||
.badge-emoji {
|
||||
font-size: 1.15em;
|
||||
line-height: 1;
|
||||
text-shadow: 0 1px 2px #fff, 0 0px 2px #c084fc;
|
||||
}
|
||||
|
||||
.dark .badge-emoji {
|
||||
text-shadow: 0 1px 2px #312e81, 0 0px 2px #a78bfa;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue