feat(mcp): add dapr mcp client + bump protos#997
Conversation
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #997 +/- ##
==========================================
- Coverage 86.63% 81.68% -4.95%
==========================================
Files 84 144 +60
Lines 4473 13940 +9467
==========================================
+ Hits 3875 11387 +7512
- Misses 598 2553 +1955 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds initial MCP (Model Context Protocol) support to the dapr-ext-workflow extension by introducing a workflow-backed MCP tool discovery client (sync + async), a JSON Schema → Pydantic args-model helper, new MCP examples, and bumps several generated protobuf artifacts to newer proto definitions.
Changes:
- Introduces
DaprMCPClient/aio.DaprMCPClientandMCPToolDeffor discovering MCP tools via Dapr’s built-indapr.internal.mcp.<server>.ListToolsworkflow. - Adds
create_pydantic_model_from_schema()to build Pydantic models from MCP tool JSON Schemas, plus unit tests for schema conversion and MCP client behavior. - Updates generated protobuf/gRPC files and extends metadata responses to include loaded MCPServer resources; adds a new MCP example bundle.
Reviewed changes
Copilot reviewed 54 out of 54 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| ext/dapr-ext-workflow/tests/test_mcp_schema.py | Adds unit tests for JSON Schema → Pydantic conversion behavior. |
| ext/dapr-ext-workflow/tests/test_mcp_client.py | Adds unit tests for MCP tool discovery client behavior and workflow name conventions. |
| ext/dapr-ext-workflow/dapr/ext/workflow/mcp.py | New sync MCP discovery client and tool definition dataclass. |
| ext/dapr-ext-workflow/dapr/ext/workflow/mcp_schema.py | New JSON Schema → Pydantic model conversion helper. |
| ext/dapr-ext-workflow/dapr/ext/workflow/aio/mcp.py | New async MCP discovery client built on shared base. |
| ext/dapr-ext-workflow/dapr/ext/workflow/aio/init.py | Re-exports async MCP client and MCPToolDef. |
| ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/runtime_state_pb2.pyi | Proto stub bump (adds propagatedHistory field and related typing updates). |
| ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/runtime_state_pb2.py | Generated proto bump for runtime state message layout. |
| ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/PROTO_SOURCE_COMMIT_HASH | Updates proto source commit hash reference. |
| ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/orchestrator_actions_pb2.py | Generated proto bump (adds new fields/messages like detached workflows, propagation scope). |
| ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/orchestration_pb2.pyi | Updates durabletask orchestration stubs (new enums/fields and typing refinements). |
| ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/orchestration_pb2.py | Generated proto bump for orchestration messages/enums. |
| ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/backend_service_pb2.py | Generated proto bump (adds propagatedHistory, new metadata fields, etc.). |
| ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/attestation_pb2.py | Adds new generated proto module for attestation messages/enums. |
| ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/attestation_pb2_grpc.py | Adds generated gRPC stub for attestation proto (version-gated import). |
| ext/dapr-ext-workflow/dapr/ext/workflow/init.py | Exposes MCP client/tool def and schema helper from extension root. |
| examples/mcp/weather_mcp_server.py | Adds a sample MCP server implementation (streamable-HTTP). |
| examples/mcp/resources/weather.yaml | Adds sample MCPServer resource config pointing to the example server. |
| examples/mcp/resources/statestore.yaml | Adds Redis statestore component config needed by workflows. |
| examples/mcp/requirements.txt | Adds example requirements for the MCP example bundle. |
| examples/mcp/README.md | Adds documentation for running the MCP examples and using the MCP client API. |
| examples/mcp/mcp_tool_discovery.py | Adds an end-to-end MCP discovery + workflow invocation example script. |
| dapr/proto/runtime/v1/workflow_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/runtime/v1/state_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/runtime/v1/secret_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/runtime/v1/pubsub_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/runtime/v1/metadata_pb2.pyi | Generated stub updates; adds MCP servers + workflow access policies metadata. |
| dapr/proto/runtime/v1/lock_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/runtime/v1/jobs_pb2.pyi | Generated stub updates; adds stable jobs APIs and typing refinements. |
| dapr/proto/runtime/v1/jobs_pb2.py | Generated proto update to include stable jobs APIs. |
| dapr/proto/runtime/v1/invoke_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/runtime/v1/dapr_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/runtime/v1/dapr_pb2_grpc.py | Generated gRPC service update to include stable jobs methods and docstrings. |
| dapr/proto/runtime/v1/crypto_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/runtime/v1/configuration_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/runtime/v1/binding_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/runtime/v1/appcallback_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/runtime/v1/appcallback_pb2_grpc.py | Generated gRPC update adding stable OnJobEvent; marks alpha as deprecated. |
| dapr/proto/runtime/v1/ai_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions + minor whitespace fix). |
| dapr/proto/runtime/v1/actors_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions). |
| dapr/proto/common/v1/common_pb2.pyi | Generated stub updates (typing/Never/WhichOneof additions + job failure policy types). |
| dapr/clients/grpc/client.py | Extends get_metadata() response mapping to include MCP servers. |
| dapr/clients/grpc/_response.py | Adds MetadataMCPServer and plumbs it through GetMetadataResponse. |
| dapr/aio/clients/grpc/client.py | Async get_metadata() now returns MCP servers list as well. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Description
ignore me - will fill this in tomorrow and address a few todo comments i left for myself as i was going through things
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: