Skip to content

feat(mcp): add dapr mcp client + bump protos#997

Open
sicoyle wants to merge 13 commits into
dapr:mainfrom
sicoyle:feat/mcp-crd
Open

feat(mcp): add dapr mcp client + bump protos#997
sicoyle wants to merge 13 commits into
dapr:mainfrom
sicoyle:feat/mcp-crd

Conversation

@sicoyle
Copy link
Copy Markdown
Contributor

@sicoyle sicoyle commented Apr 28, 2026

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:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Signed-off-by: Samantha Coyle <sam@diagrid.io>
@sicoyle sicoyle changed the title [ignore wip!] feat(mcp): add mcp related classes + bump protos [ignore wip!] feat(mcp): add dapr mcp client + bump protos Apr 28, 2026
@sicoyle sicoyle changed the title [ignore wip!] feat(mcp): add mcp related classes + bump protos [ignore wip!] feat(mcp): add dapr mcp client + bump protos Apr 28, 2026
Signed-off-by: Samantha Coyle <sam@diagrid.io>
@sicoyle sicoyle changed the title [ignore wip!] feat(mcp): add dapr mcp client + bump protos feat(mcp): add dapr mcp client + bump protos May 4, 2026
Signed-off-by: Samantha Coyle <sam@diagrid.io>
sicoyle added 5 commits May 5, 2026 16:30
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
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 66.39344% with 205 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.68%. Comparing base (bffb749) to head (6de2af1).
⚠️ Report is 126 commits behind head on main.

Files with missing lines Patch % Lines
.../_durabletask/internal/orchestrator_service_pb2.py 1.61% 61 Missing ⚠️
...rkflow/_durabletask/internal/history_events_pb2.py 3.44% 56 Missing ⚠️
...orkflow/_durabletask/internal/orchestration_pb2.py 4.00% 24 Missing ⚠️
.../_durabletask/internal/orchestrator_actions_pb2.py 4.54% 21 Missing ⚠️
.../workflow/_durabletask/internal/attestation_pb2.py 42.85% 16 Missing ⚠️
ext/dapr-ext-workflow/dapr/ext/workflow/aio/mcp.py 44.00% 14 Missing ⚠️
.../dapr-ext-workflow/dapr/ext/workflow/mcp_schema.py 82.75% 10 Missing ⚠️
dapr/clients/grpc/_response.py 85.71% 1 Missing ⚠️
ext/dapr-ext-workflow/tests/test_mcp_client.py 99.36% 1 Missing ⚠️
ext/dapr-ext-workflow/tests/test_mcp_schema.py 98.96% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sicoyle sicoyle requested a review from Copilot May 11, 2026 14:42
@sicoyle sicoyle marked this pull request as ready for review May 11, 2026 14:42
@sicoyle sicoyle requested review from a team as code owners May 11, 2026 14:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.DaprMCPClient and MCPToolDef for discovering MCP tools via Dapr’s built-in dapr.internal.mcp.<server>.ListTools workflow.
  • 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.

Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/mcp_schema.py
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/__init__.py Outdated
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/mcp_schema.py Outdated
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/mcp_schema.py
Comment thread examples/mcp/mcp_tool_discovery.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants