The Python repo should mirror the C# lecture flow for Milestone 1:
- Start a local stdio MCP server
- Complete
initialize - Discover
get_system_info - Execute
get_system_info - Reject an invalid tool name without crashing
The Python client should:
- Start the same local stdio MCP server
- Fetch
get_system_info - Build an LLM prompt from that payload
- Fail fast with a clear message if Azure OpenAI configuration is missing
Run all tests:
cd /home/alon/MCPPythonDemo
python3 -m unittest discover -s tests -vKey coverage:
tests/test_m1_smoke.py- stdio MCP handshake, tool discovery, happy path, extra args, invalid tooltests/test_system_info.py- graceful fallback when/procfiles are missingtests/test_client.py- client prompt building, fake-LLM agent loop, missing-config CLI failure
Server + agent smoke:
python3 scripts/smoke_test.pyExpected behavior:
- Server portion prints discovered tools and a live
get_system_infopayload - Agent portion verifies that the client exits with code
2and emits a human-readable Azure config message when credentials are absent
Either prefix style is accepted:
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
export AZURE_OPENAI_API_KEY="your-api-key"
export AZURE_OPENAI_DEPLOYMENT="model-router"or:
export MCP_DEMO_AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
export MCP_DEMO_AZURE_OPENAI_API_KEY="your-api-key"
export MCP_DEMO_AZURE_OPENAI_DEPLOYMENT="model-router"Optional:
export AZURE_OPENAI_API_VERSION="2024-10-21"