How to connect MCP server via python client? #378
-
Pre-submission Checklist
Question Category
Your QuestionI tried to write a MCP client to connect with filesystem MCP server running on my Windows. class MCPFileSystemClient:
def main():
if name == "main": |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hello, it seems that you are attempting to write the MCP python client from scratch and using your custom implementation to communicate with the MCP server. To write an MCP client in python, you should use the official MCP python SDK https://github.com/modelcontextprotocol/python-sdk?tab=readme-ov-file#writing-mcp-clients |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for your help. I understood now. |
Beta Was this translation helpful? Give feedback.
Hello, it seems that you are attempting to write the MCP python client from scratch and using your custom implementation to communicate with the MCP server.
To write an MCP client in python, you should use the official MCP python SDK
https://github.com/modelcontextprotocol/python-sdk?tab=readme-ov-file#writing-mcp-clients