Skip to content

Commit 353d724

Browse files
committed
Fix settings spread
1 parent efcfe7b commit 353d724

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

examples/mcp_agent_server/asyncio/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,12 @@ You can also run the server and client separately:
9999
```
100100

101101
2. In another terminal, run the client:
102+
102103
```bash
103104
uv run client.py
105+
106+
# Optionally, run with the example custom FastMCP settings
107+
uv run client.py --custom-fastmcp-settings
104108
```
105109

106110
## MCP Clients

examples/mcp_agent_server/asyncio/basic_agent_server.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ async def main():
173173
parser = argparse.ArgumentParser()
174174
parser.add_argument(
175175
"--custom-fastmcp-settings",
176-
type=bool,
176+
action="store_true",
177177
help="Enable custom FastMCP settings for the server",
178178
)
179179
args = parser.parse_args()
@@ -195,11 +195,12 @@ async def main():
195195
# Create the MCP server that exposes both workflows and agent configurations,
196196
# optionally using custom FastMCP settings
197197
fast_mcp_settings = (
198-
{"host": "localhost", "port": 8001, "debug": True, "log_level": "debug"}
198+
{"host": "localhost", "port": 8001, "debug": True, "log_level": "DEBUG"}
199199
if use_custom_fastmcp_settings
200200
else None
201201
)
202202
mcp_server = create_mcp_server_for_app(agent_app, fast_mcp_settings)
203+
logger.info(f"MCP Server settings: {mcp_server.settings}")
203204

204205
# Add custom tool to get token usage for a workflow
205206
@mcp_server.tool(

examples/mcp_agent_server/asyncio/client.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import argparse
12
import asyncio
23
import json
34
import time
@@ -11,6 +12,15 @@
1112

1213

1314
async def main():
15+
parser = argparse.ArgumentParser()
16+
parser.add_argument(
17+
"--custom-fastmcp-settings",
18+
action="store_true",
19+
help="Enable custom FastMCP settings for the server",
20+
)
21+
args = parser.parse_args()
22+
use_custom_fastmcp_settings = args.custom_fastmcp_settings
23+
1424
# Create MCPApp to get the server registry
1525
app = MCPApp(name="workflow_mcp_client")
1626
async with app.run() as client_app:
@@ -21,11 +31,17 @@ async def main():
2131
logger.info("Connecting to workflow server...")
2232

2333
# Override the server configuration to point to our local script
34+
run_server_args = ["run", "basic_agent_server.py"]
35+
if use_custom_fastmcp_settings:
36+
logger.info("Using custom FastMCP settings for the server.")
37+
run_server_args += ["--custom-fastmcp-settings"]
38+
else:
39+
logger.info("Using default FastMCP settings for the server.")
2440
context.server_registry.registry["basic_agent_server"] = MCPServerSettings(
2541
name="basic_agent_server",
2642
description="Local workflow server running the basic agent example",
2743
command="uv",
28-
args=["run", "basic_agent_server.py"],
44+
args=run_server_args,
2945
)
3046

3147
# Connect to the workflow server

src/mcp_agent/server/app_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ async def app_specific_lifespan(mcp: FastMCP) -> AsyncIterator[ServerContext]:
122122
# or use the MCPApp's description if available.
123123
instructions=f"MCP server exposing {app.name} workflows and agents. Description: {app.description}",
124124
lifespan=app_specific_lifespan,
125-
settings=settings,
125+
**settings or {},
126126
)
127127

128128
# region Workflow Tools

0 commit comments

Comments
 (0)