连接能力
eternachen mcp playground 为 AI Agent 提供什么
- Connects to an MCP server to list available tools.
- Queries weather information for a specified city.
- Displays formatted weather information including temperature, humidity, wind speed, and weather description.
- Python 3.8+
- `openai` library
- `dotenv` library
- `mcp` library
- Clone the repository:
- Create a virtual environment and activate it:
- Install the required dependencies:
- Create a `.env` file in the root directory and add your OpenAI API key and other configurations:
- Start the MCP server:
- Run the client and connect to the server:
- Interact with the client:
- Type the name of the city in English to get the weather information.
- Type `quit` to exit the client.
- `server.py`: Contains the MCP server implementation and weather query tool.
- `client.py`: Contains the MCP client implementation to interact with the server.
- `.env`: Environment variables for API keys and configurations.
- `.gitignore`: Specifies files and directories to be ignored by git.
- `README.md`: Project documentation.
安全
MCP 收录不等于安全审核
MCP 服务器可能获得模型上下文、凭据、本地文件或调用外部系统的权限。连接 Agent 前,请检查代码、环境变量、网络行为、软件包来源与维护状态。
README
仓库文档
This project is a weather query client that interacts with an MCP (Model-Client-Protocol) server to fetch and display weather information for a specified city.
- Connects to an MCP server to list available tools.
- Queries weather information for a specified city.
- Displays formatted weather information including temperature, humidity, wind speed, and weather description.
- Python 3.8+
openailibrarydotenvlibrarymcplibrary
-
Clone the repository:
git clone <repository_url> cd <repository_directory>
-
Create a virtual environment and activate it:
python -m venv .venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.envfile in the root directory and add your OpenAI API key and other configurations:OPENAI_API_KEY=<your_openai_api_key> BASE_URL=<your_base_url> MODEL=<your_model>
-
Start the MCP server:
python server.py
-
Run the client and connect to the server:
python client.py <path_to_server_script>
-
Interact with the client:
- Type the name of the city in English to get the weather information.
- Type
quitto exit the client.
server.py: Contains the MCP server implementation and weather query tool.client.py: Contains the MCP client implementation to interact with the server..env: Environment variables for API keys and configurations..gitignore: Specifies files and directories to be ignored by git.README.md: Project documentation.
This project is licensed under the MIT License.
社区
收藏、评分与讨论
正在载入社区数据…