Skip to content

Commit e83989d

Browse files
authored
Merge branch 'main' into add-strict-mode-pyright
2 parents c120b50 + 5a54d82 commit e83989d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ async def fetch_weather(city: str) -> str:
241241
Prompts are reusable templates that help LLMs interact with your server effectively:
242242

243243
```python
244-
from mcp.server.fastmcp import FastMCP, types
244+
from mcp.server.fastmcp import FastMCP
245+
from mcp.server.fastmcp.prompts import base
245246

246247
mcp = FastMCP("My App")
247248

@@ -252,11 +253,11 @@ def review_code(code: str) -> str:
252253

253254

254255
@mcp.prompt()
255-
def debug_error(error: str) -> list[types.Message]:
256+
def debug_error(error: str) -> list[base.Message]:
256257
return [
257-
types.UserMessage("I'm seeing this error:"),
258-
types.UserMessage(error),
259-
types.AssistantMessage("I'll help debug that. What have you tried so far?"),
258+
base.UserMessage("I'm seeing this error:"),
259+
base.UserMessage(error),
260+
base.AssistantMessage("I'll help debug that. What have you tried so far?"),
260261
]
261262
```
262263

src/mcp/client/stdio.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
33
from contextlib import asynccontextmanager
4+
from pathlib import Path
45
from typing import Literal
56

67
import anyio
@@ -66,6 +67,9 @@ class StdioServerParameters(BaseModel):
6667
If not specified, the result of get_default_environment() will be used.
6768
"""
6869

70+
cwd: str | Path | None = None
71+
"""The working directory to use when spawning the process."""
72+
6973
encoding: str = "utf-8"
7074
"""
7175
The text encoding used when sending/receiving messages to the server
@@ -101,6 +105,7 @@ async def stdio_client(server: StdioServerParameters):
101105
[server.command, *server.args],
102106
env=server.env if server.env is not None else get_default_environment(),
103107
stderr=sys.stderr,
108+
cwd=server.cwd,
104109
)
105110

106111
async def stdout_reader():

0 commit comments

Comments
 (0)