Jeremiah Lowin commited on
Commit
defdbf4
·
1 Parent(s): cce00f1

Update docs

Browse files
docs/patterns/fastapi.mdx CHANGED
@@ -44,6 +44,19 @@ if __name__ == "__main__":
44
  mcp.run() # Start the MCP server
45
  ```
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  ## Route Mapping
48
 
49
  By default, FastMCP will map FastAPI routes to MCP components according to the following rules:
 
44
  mcp.run() # Start the MCP server
45
  ```
46
 
47
+ ## Configuration Options
48
+
49
+ ### Timeout
50
+
51
+ You can set a timeout for all API requests:
52
+
53
+ ```python
54
+ # Set a 5 second timeout for all requests
55
+ mcp = FastMCP.from_fastapi(app=app, timeout=5.0)
56
+ ```
57
+
58
+ This timeout is applied to all requests made by tools, resources, and resource templates.
59
+
60
  ## Route Mapping
61
 
62
  By default, FastMCP will map FastAPI routes to MCP components according to the following rules:
docs/patterns/openapi.mdx CHANGED
@@ -27,6 +27,23 @@ if __name__ == "__main__":
27
  mcp.run()
28
  ```
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  ## Route Mapping
31
 
32
  By default, OpenAPI routes are mapped to MCP components based on these rules:
 
27
  mcp.run()
28
  ```
29
 
30
+ ## Configuration Options
31
+
32
+ ### Timeout
33
+
34
+ You can set a timeout for all API requests:
35
+
36
+ ```python
37
+ # Set a 5 second timeout for all requests
38
+ mcp = FastMCP.from_openapi(
39
+ openapi_spec=spec,
40
+ client=api_client,
41
+ timeout=5.0
42
+ )
43
+ ```
44
+
45
+ This timeout is applied to all requests made by tools, resources, and resource templates.
46
+
47
  ## Route Mapping
48
 
49
  By default, OpenAPI routes are mapped to MCP components based on these rules:
src/fastmcp/server/openapi.py CHANGED
@@ -448,7 +448,7 @@ class FastMCPOpenAPI(FastMCP):
448
  client: httpx AsyncClient for making HTTP requests
449
  name: Optional name for the server
450
  route_maps: Optional list of RouteMap objects defining route mappings
451
- default_mime_type: Default MIME type for resources
452
  **settings: Additional settings for FastMCP
453
  """
454
  super().__init__(name=name or "OpenAPI FastMCP", **settings)
 
448
  client: httpx AsyncClient for making HTTP requests
449
  name: Optional name for the server
450
  route_maps: Optional list of RouteMap objects defining route mappings
451
+ timeout: Optional timeout (in seconds) for all requests
452
  **settings: Additional settings for FastMCP
453
  """
454
  super().__init__(name=name or "OpenAPI FastMCP", **settings)