Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions python-mcp-client/source-code-final/mcp_client/mcp_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
from contextlib import AsyncExitStack
from typing import Any, Awaitable, Callable, ClassVar, Self
Expand Down Expand Up @@ -36,13 +37,11 @@ async def _connect_to_server(self) -> ClientSession:
read, write = await self.exit_stack.enter_async_context(
stdio_client(
server=StdioServerParameters(
command="sh",
args=[
"-c",
f"{sys.executable} {self.server_path} 2>/dev/null",
],
command=sys.executable,
args=[self.server_path],
env=None,
)
),
errlog=open(os.devnull, "w"),
)
)
client_session = await self.exit_stack.enter_async_context(
Expand Down
6 changes: 3 additions & 3 deletions python-mcp-client/source-code-final/mcp_server/mcp_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from mcp.server.fastmcp import FastMCP
from mcp.server.mcpserver import MCPServer

mcp = FastMCP("mcp_server")
mcp = MCPServer("mcp_server")


@mcp.tool()
Expand All @@ -12,7 +12,7 @@ async def echo(message: str) -> str:
@mcp.prompt()
async def greeting_prompt(name: str) -> str:
"""A simple greeting prompt."""
return f"Great {name} kindly."
return f"Greet {name} kindly."


@mcp.resource("file://./greeting.txt")
Expand Down
2 changes: 1 addition & 1 deletion python-mcp-client/source-code-final/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "MCP client for testing MCP servers."
readme = "README.md"
requires-python = ">=3.14"
dependencies = [
"mcp>=1.20.0",
"mcp>=2.2.0,<3",
"openai>=2.6.1",
]

Expand Down
Loading
Loading