-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Problem
The Mock Tooling Server (a365 develop start-mock-tooling-server) crashes or returns incorrect errors when used with Python and Node.js Agent Framework samples. These agents send standard MCP protocol methods that the mock server doesn't handle, causing the agent to fail during tool discovery and become non-functional.
The .NET Meeting Assistant sample works because its MCP client implementation happens to not send these methods, but the Python (microsoft/Agent365-Samples/python/) and Node.js (microsoft/Agent365-Samples/nodejs/openai/) samples use MCP client libraries that follow the full MCP Streamable HTTP specification.
Root Cause
The mock server's JSON-RPC handler at /agents/servers/{mcpServerName} only handles tools/list and tools/call methods. Any other method hits the catch-all -32601 Method not found error. Six specific gaps were identified:
1. notifications/initialized and other notifications - 500 error
Symptom: After MCP handshake, the Python MCP client sends notifications/initialized (a standard MCP lifecycle notification). The server returns a JSON-RPC error response instead of the MCP-spec-required 202 Accepted with no body. The MCP client then fails to parse the unexpected response and disconnects.
Expected: Return 202 Accepted with no body for any method starting with notifications/, per the MCP Streamable HTTP transport spec.
2. ping method - -32601 Method not found
Symptom: MCP clients send ping requests to verify connection health during tool discovery. The server returns a method-not-found error, causing the client to consider the connection unhealthy and retry/fail.
Expected: Return { "jsonrpc": "2.0", "id": ..., "result": {} } - a standard empty-result success response.
3. prompts/list - -32601 Method not found
Symptom: MCP clients enumerate server capabilities by calling prompts/list. The error response causes capability discovery to fail.
Expected: Return { "result": { "prompts": [] } } - the mock server has no prompts, which is valid.
4. resources/list - -32601 Method not found
Symptom: Same as above - MCP clients call resources/list during capability discovery.
Expected: Return { "result": { "resources": [] } } - the mock server has no resources, which is valid.
5. Unknown MCP server names - unhandled ArgumentException crash
Symptom: When an agent registers MCP servers like mcp_KnowledgeTools that have no mock implementation, ListToolsAsync() throws ArgumentException. The exception propagates to the global catch handler, returning a -32603 Internal Error. The agent interprets this as a fatal server error and stops tool discovery entirely.
Expected: For tools/list, return an empty tools array (graceful degradation). For tools/call, return a JSON-RPC error with code -32602 (invalid params) and a descriptive message.
6. Error responses lose the JSON-RPC id field
Symptom: The idValue variable is declared inside the try block, so the catch handler can't access it and returns "id": null. Per JSON-RPC 2.0 spec, the response id must match the request id. When it doesn't match, the MCP client can't correlate the error to the original request.
Expected: Move idValue declaration before the try block so it's accessible in the catch handler.
Impact
Without these fixes, local testing with a365 develop start-mock-tooling-server is completely non-functional for Python and Node.js Agent Framework samples. Developers must either:
- Use real M365 MCP servers (requires a published blueprint + active Teams instance)
- Skip local testing entirely
These are all standard MCP protocol methods that any spec-compliant MCP client will send.
Reproduction Steps
- Clone
microsoft/Agent365-SamplesPython sample - Configure
.envwith Azure OpenAI credentials - Run
a365 develop start-mock-tooling-server --port 5309 - Start the Python agent pointing at the mock server
- Send any chat message via Agents Playground
- Result: Agent fails during MCP tool discovery - mock server returns errors for
notifications/initialized,ping,prompts/list,resources/list
Affected File
src/Microsoft.Agents.A365.DevTools.MockToolingServer/Server.cs
All 6 fixes are localized to the /agents/servers/{mcpServerName} endpoint handler.