feat(mcp): add mcpserver qs with python sdk#1314
Open
sicoyle wants to merge 3 commits into
Open
Conversation
…I tests Signed-off-by: Samantha Coyle <sam@diagrid.io>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new AI/mcp/ Python quickstart that demonstrates Dapr’s MCPServer resource with three MCP transports and workflow-based middleware hooks, plus an end-to-end pytest suite and CI validation via uv.
Changes:
- Introduces an
AI/mcp/uv workspace containing MCP server implementations (streamableHTTP, stdio, SSE) and an SDK-driven workflow app. - Adds workflow middleware implementations for rate limiting, PII redaction (mutating hook), and audit logging, wired via
resources/weather-mcp.yaml. - Adds pytest E2E coverage and a GitHub Actions step to execute the new quickstart tests.
Reviewed changes
Copilot reviewed 21 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| AI/mcp/tests/test_sdk_variant.py | E2E test that runs dapr run and asserts expected output markers. |
| AI/mcp/tests/conftest.py | Session fixtures to spawn MCP servers and check Dapr CLI availability. |
| AI/mcp/tests/_wait_utils.py | Synchronous wait/poll helper used for readiness checks. |
| AI/mcp/tests/_process_utils.py | Cross-platform process-group creation/termination helpers for cleanup. |
| AI/mcp/resources/weather-mcp.yaml | MCPServer resource for weather + middleware hook configuration. |
| AI/mcp/resources/notes-mcp.yaml | MCPServer resource for notes over SSE. |
| AI/mcp/resources/local-tools-mcp.yaml | MCPServer resource for stdio local tools server. |
| AI/mcp/resources/statestore.yaml | Redis state store component used by workflows/middleware. |
| AI/mcp/python/shared/middleware_workflows.py | Workflow middleware implementations (rate limit, redact, audit) + registration helper. |
| AI/mcp/python/sdk/app.py | SDK variant entrypoint (tool discovery + workflow scheduling + rate-limit demo). |
| AI/mcp/python/sdk/workflow.py | Parent workflow that invokes one tool per MCPServer. |
| AI/mcp/python/sdk/README.md | Run instructions and walkthrough for the SDK variant. |
| AI/mcp/python/sdk/pyproject.toml | SDK variant Python dependencies. |
| AI/mcp/mcp-servers/weather_mcp_server.py | Weather MCP server (streamableHTTP). |
| AI/mcp/mcp-servers/notes_sse_server.py | Notes MCP server (SSE) implemented with Starlette/Uvicorn. |
| AI/mcp/mcp-servers/local_tools_server.py | Local tools MCP server (stdio). |
| AI/mcp/mcp-servers/pyproject.toml | MCP servers’ Python dependencies. |
| AI/mcp/pyproject.toml | Workspace root project + dev dependencies for tests. |
| AI/mcp/uv.lock | Locked dependency set for the uv workspace. |
| AI/mcp/dapr.yaml | Dapr multi-app configuration for running the sdk variant. |
| AI/mcp/README.md | Top-level quickstart documentation and how to run tests. |
| .github/workflows/validate_python_quickstarts.yaml | Adds uv setup + executes AI/mcp pytest suite in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Samantha Coyle <sam@diagrid.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary
Adds
AI/mcp/— a quickstart demonstrating Dapr's MCPServer CRD and per-tool durable workflows across three MCP transports, with three middleware shapes that cover the canonical "observe / gate / transform" patterns.Pure-Dapr SDK demo (no LLM, no agent framework). The agent-driven specific example is only in the dapr agents repo, linked from this quickstart's README.
What's in
AI/mcp/Three MCP transports behind identical calling code (only
spec.endpointdiffers in the YAML):weather-mcp.yamlstreamableHTTPhttp://localhost:8081/mcpget_weather,get_forecastlocal-tools-mcp.yamlstdio(spawned by daprd)current_time,echonotes-mcp.yamlssehttp://localhost:8082/sseadd_note,list_notesThree middleware shapes — all configured on
weather-mcp.yaml. The other two MCPServers stay clean for side-by-side comparison:rate_limit_workflowbeforeCallTool(gate)MAX_CALLS_PER_MINUTE = 10with a structuredRuntimeErrorredact_pii_workflowbeforeCallTool+mutate: true(transform)audit_log_workflowafterCallTool(observe){tool, arguments, result, timestamp}to Redis underaudit:<server>:<tool>:<ts>uv workspace at
AI/mcp/—mcp-servers/andpython/sdk/are workspace members with their ownpyproject.toml; a singleuv.lock. Mechanical markdown did not make sense given the setup, and we want are moving away from it in python sdk and dapr agents, so this PR includes the latest (non mechanical markdown) setup test-wise.CI
New step in
validate_python_quickstarts.yaml: