examples/functionality/mcp/README.md
This example demonstrates how to
# Install from source
cd {PATH_TO_AGENTSCOPE}
pip install -e .
Install agentscope and ensure you have a valid DashScope API key in your environment variables.
Note: The example is built with DashScope chat model. If you want to change the model in this example, don't forget to change the formatter at the same time! The corresponding relationship between built-in models and formatters are list in our tutorial
pip install agentscope
Start the MCP servers by the following commands in two separate terminals:
# In one terminal, run:
python mcp_add.py
# In another terminal, run:
python mcp_multiply.py
Two MCP servers will be started on http://127.0.0.1:8001 (SSE server) and http://127.0.0.1:8002 (streamable
HTTP server).
After starting the MCP servers, you can run the agent example:
python main.py
The agent will: