mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 05:24:18 +02:00
Merge pull request #154 from jlowin/broken-links
Fix broken links in docs
This commit is contained in:
commit
f86ff01411
6 changed files with 24 additions and 16 deletions
12
.github/workflows/run-static.yml
vendored
12
.github/workflows/run-static.yml
vendored
|
|
@ -8,7 +8,19 @@ env:
|
|||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
paths:
|
||||
- "src/**"
|
||||
- "tests/**"
|
||||
- "uv.lock"
|
||||
- "pyproject.toml"
|
||||
- ".github/workflows/**"
|
||||
pull_request:
|
||||
paths:
|
||||
- "src/**"
|
||||
- "tests/**"
|
||||
- "uv.lock"
|
||||
- "pyproject.toml"
|
||||
- ".github/workflows/**"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ icon: rocket
|
|||
|
||||
Welcome! This guide will help you quickly set up FastMCP and run your first MCP server.
|
||||
|
||||
If you haven't already installed FastMCP, follow the [installation instructions](/docs/getting-started/installation).
|
||||
If you haven't already installed FastMCP, follow the [installation instructions](/getting-started/installation).
|
||||
|
||||
## Creating a FastMCP Server
|
||||
|
||||
|
|
@ -123,5 +123,5 @@ fastmcp run my_server.py:mcp
|
|||
Note that FastMCP *does not* require the `__main__` block in the server file, and will ignore it if it is present. Instead, it looks for the server object provided in the CLI command (here, `mcp`). If no server object is provided, `fastmcp run` will automatically search for servers called "mcp", "app", or "server" in the file.
|
||||
|
||||
<Tip>
|
||||
We pointed our client at the server file, which is recognized as a Python MCP server and executed with `python my_server.py` by default. This exceutes the `__main__` block of the server file. There are other ways to run the server, which are described in the [server configuration](/docs/getting-started/configuration) guide.
|
||||
We pointed our client at the server file, which is recognized as a Python MCP server and executed with `python my_server.py` by default. This exceutes the `__main__` block of the server file. There are other ways to run the server, which are described in the [server configuration](/servers/fastmcp#running-the-server) guide.
|
||||
</Tip>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ description: Access MCP capabilities like logging, progress, and resources withi
|
|||
icon: rectangle-code
|
||||
---
|
||||
|
||||
When defining FastMCP [Tools](/server/tools), your functions might need to interact with the underlying MCP session or access server capabilities. FastMCP provides the `Context` object for this purpose.
|
||||
When defining FastMCP [tools](/servers/tools), your functions might need to interact with the underlying MCP session or access server capabilities. FastMCP provides the `Context` object for this purpose.
|
||||
|
||||
## What Is Context?
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ async def generate_example(concept: str, ctx: Context) -> str:
|
|||
return f"```python\n{code_example}\n```"
|
||||
```
|
||||
|
||||
See [Client Sampling](/client/sampling) for more details on how clients handle these requests.
|
||||
See [Client Sampling](/clients/overview#llm-sampling) for more details on how clients handle these requests.
|
||||
|
||||
### Request Information
|
||||
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ The `FastMCP` constructor accepts several arguments:
|
|||
|
||||
* `name`: (Optional) A human-readable name for your server. Defaults to "FastMCP".
|
||||
* `instructions`: (Optional) Description of how to interact with this server. These instructions help clients understand the server's purpose and available functionality.
|
||||
* `lifespan`: (Optional) An async context manager function for server startup and shutdown logic. See [Lifespan Management](/advanced/lifespan).
|
||||
* `lifespan`: (Optional) An async context manager function for server startup and shutdown logic.
|
||||
* `tags`: (Optional) A set of strings to tag the server itself.
|
||||
* `**settings`: Keyword arguments corresponding to `ServerSettings` for configuration. See [Configuration](/advanced/configuration).
|
||||
* `**settings`: Keyword arguments corresponding to additional `ServerSettings` configuration
|
||||
|
||||
## Components
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ def multiply(a: float, b: float) -> float:
|
|||
return a * b
|
||||
```
|
||||
|
||||
See [Tools](/server/tools) for detailed documentation.
|
||||
See [Tools](/servers/tools) for detailed documentation.
|
||||
|
||||
### Resources
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ def get_config() -> dict:
|
|||
return {"theme": "dark", "version": "1.0"}
|
||||
```
|
||||
|
||||
See [Resources & Templates](/server/resources) for detailed documentation.
|
||||
See [Resources & Templates](/servers/resources) for detailed documentation.
|
||||
|
||||
### Resource Templates
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ def get_user_profile(user_id: int) -> dict:
|
|||
return {"id": user_id, "name": f"User {user_id}", "status": "active"}
|
||||
```
|
||||
|
||||
See [Resources & Templates](/server/resources) for detailed documentation.
|
||||
See [Resources & Templates](/servers/resources) for detailed documentation.
|
||||
|
||||
### Prompts
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ def analyze_data(data_points: list[float]) -> str:
|
|||
return f"Please analyze these data points: {formatted_data}"
|
||||
```
|
||||
|
||||
See [Prompts](/server/prompts) for detailed documentation.
|
||||
See [Prompts](/servers/prompts) for detailed documentation.
|
||||
|
||||
## Running the Server
|
||||
|
||||
|
|
@ -186,9 +186,6 @@ fastmcp run my_server.py:mcp --transport sse --host 127.0.0.1 --port 8888
|
|||
|
||||
The CLI can dynamically find and run FastMCP server objects in your files, but including the `if __name__ == "__main__":` block ensures compatibility with all clients.
|
||||
|
||||
<Tip>
|
||||
For more options, including how to set up your server's dependencies or use advanced configurations, see the [CLI Reference](/cli/overview).
|
||||
</Tip>
|
||||
|
||||
## Mounting Subservers
|
||||
|
||||
|
|
@ -299,4 +296,3 @@ print(mcp.settings.on_duplicate_tools) # Output: DuplicateBehavior.ERROR
|
|||
|
||||
All of these can be configured directly as parameters when creating the `FastMCP` instance.
|
||||
|
||||
See the [Configuration](/advanced/configuration) page for more details.
|
||||
|
|
@ -195,7 +195,7 @@ Using the `ctx` parameter (based on its `Context` type hint), you can access:
|
|||
- **LLM Sampling:** `ctx.sample(...)`
|
||||
- **Request Info:** `ctx.request_id`, `ctx.client_id`
|
||||
|
||||
Refer to the [Using Context](/server/context) page for more details on these capabilities.
|
||||
Refer to the [Context documentation](/servers/context) for more details on these capabilities.
|
||||
|
||||
## Server Behavior
|
||||
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ The Context object provides access to:
|
|||
- **LLM Sampling**: `ctx.sample(...)`
|
||||
- **Request Information**: `ctx.request_id`, `ctx.client_id`
|
||||
|
||||
For full documentation on the Context object and all its capabilities, see the [Context Object](/server/context) page.
|
||||
For full documentation on the Context object and all its capabilities, see the [Context documentation](/servers/context).
|
||||
|
||||
## Server Behavior
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue