workspace-architect 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets-manifest.json +3392 -0
- package/bin/cli.js +134 -72
- package/package.json +11 -3
- package/.env.example +0 -1
- package/.gitattributes +0 -1
- package/.github/workflows/manual-publish.yml +0 -36
- package/.github/workflows/sync-and-publish.yml +0 -58
- package/.release-it.json +0 -20
- package/CHANGELOG.md +0 -53
- package/assets/chatmodes/4.1-Beast.chatmode.md +0 -152
- package/assets/chatmodes/Thinking-Beast-Mode.chatmode.md +0 -337
- package/assets/chatmodes/Ultimate-Transparent-Thinking-Beast-Mode.chatmode.md +0 -644
- package/assets/chatmodes/accessibility.chatmode.md +0 -298
- package/assets/chatmodes/address-comments.chatmode.md +0 -59
- package/assets/chatmodes/aem-frontend-specialist.chatmode.md +0 -385
- package/assets/chatmodes/api-architect.chatmode.md +0 -40
- package/assets/chatmodes/atlassian-requirements-to-jira.chatmode.md +0 -444
- package/assets/chatmodes/azure-logic-apps-expert.chatmode.md +0 -100
- package/assets/chatmodes/azure-principal-architect.chatmode.md +0 -58
- package/assets/chatmodes/azure-saas-architect.chatmode.md +0 -118
- package/assets/chatmodes/azure-verified-modules-bicep.chatmode.md +0 -44
- package/assets/chatmodes/azure-verified-modules-terraform.chatmode.md +0 -58
- package/assets/chatmodes/bicep-implement.chatmode.md +0 -40
- package/assets/chatmodes/bicep-plan.chatmode.md +0 -112
- package/assets/chatmodes/blueprint-mode-codex.chatmode.md +0 -110
- package/assets/chatmodes/blueprint-mode.chatmode.md +0 -171
- package/assets/chatmodes/clojure-interactive-programming.chatmode.md +0 -174
- package/assets/chatmodes/code-tour.chatmode.md +0 -205
- package/assets/chatmodes/critical-thinking.chatmode.md +0 -23
- package/assets/chatmodes/csharp-dotnet-janitor.chatmode.md +0 -83
- package/assets/chatmodes/csharp-mcp-expert.chatmode.md +0 -69
- package/assets/chatmodes/debug.chatmode.md +0 -79
- package/assets/chatmodes/declarative-agents-architect.chatmode.md +0 -76
- package/assets/chatmodes/demonstrate-understanding.chatmode.md +0 -60
- package/assets/chatmodes/dotnet-upgrade.chatmode.md +0 -222
- package/assets/chatmodes/drupal-expert.chatmode.md +0 -687
- package/assets/chatmodes/electron-angular-native.chatmode.md +0 -285
- package/assets/chatmodes/expert-cpp-software-engineer.chatmode.md +0 -27
- package/assets/chatmodes/expert-dotnet-software-engineer.chatmode.md +0 -22
- package/assets/chatmodes/expert-nextjs-developer.chatmode.md +0 -477
- package/assets/chatmodes/expert-react-frontend-engineer.chatmode.md +0 -738
- package/assets/chatmodes/gilfoyle.chatmode.md +0 -66
- package/assets/chatmodes/go-mcp-expert.chatmode.md +0 -122
- package/assets/chatmodes/gpt-5-beast-mode.chatmode.md +0 -109
- package/assets/chatmodes/hlbpa.chatmode.md +0 -232
- package/assets/chatmodes/implementation-plan.chatmode.md +0 -159
- package/assets/chatmodes/janitor.chatmode.md +0 -89
- package/assets/chatmodes/java-mcp-expert.chatmode.md +0 -325
- package/assets/chatmodes/kotlin-mcp-expert.chatmode.md +0 -181
- package/assets/chatmodes/kusto-assistant.chatmode.md +0 -143
- package/assets/chatmodes/laravel-expert-agent.chatmode.md +0 -628
- package/assets/chatmodes/mentor.chatmode.md +0 -32
- package/assets/chatmodes/meta-agentic-project-scaffold.chatmode.md +0 -15
- package/assets/chatmodes/microsoft-agent-framework-dotnet.chatmode.md +0 -62
- package/assets/chatmodes/microsoft-agent-framework-python.chatmode.md +0 -62
- package/assets/chatmodes/microsoft-study-mode.chatmode.md +0 -32
- package/assets/chatmodes/microsoft_learn_contributor.chatmode.md +0 -388
- package/assets/chatmodes/ms-sql-dba.chatmode.md +0 -25
- package/assets/chatmodes/php-mcp-expert.chatmode.md +0 -498
- package/assets/chatmodes/pimcore-expert.chatmode.md +0 -869
- package/assets/chatmodes/plan.chatmode.md +0 -114
- package/assets/chatmodes/planner.chatmode.md +0 -14
- package/assets/chatmodes/playwright-tester.chatmode.md +0 -13
- package/assets/chatmodes/postgresql-dba.chatmode.md +0 -17
- package/assets/chatmodes/power-bi-data-modeling-expert.chatmode.md +0 -319
- package/assets/chatmodes/power-bi-dax-expert.chatmode.md +0 -334
- package/assets/chatmodes/power-bi-performance-expert.chatmode.md +0 -533
- package/assets/chatmodes/power-bi-visualization-expert.chatmode.md +0 -549
- package/assets/chatmodes/power-platform-expert.chatmode.md +0 -116
- package/assets/chatmodes/power-platform-mcp-integration-expert.chatmode.md +0 -149
- package/assets/chatmodes/prd.chatmode.md +0 -201
- package/assets/chatmodes/principal-software-engineer.chatmode.md +0 -41
- package/assets/chatmodes/prompt-builder.chatmode.md +0 -352
- package/assets/chatmodes/prompt-engineer.chatmode.md +0 -72
- package/assets/chatmodes/python-mcp-expert.chatmode.md +0 -99
- package/assets/chatmodes/refine-issue.chatmode.md +0 -34
- package/assets/chatmodes/research-technical-spike.chatmode.md +0 -169
- package/assets/chatmodes/ruby-mcp-expert.chatmode.md +0 -346
- package/assets/chatmodes/rust-gpt-4.1-beast-mode.chatmode.md +0 -197
- package/assets/chatmodes/rust-mcp-expert.chatmode.md +0 -465
- package/assets/chatmodes/search-ai-optimization-expert.chatmode.md +0 -227
- package/assets/chatmodes/semantic-kernel-dotnet.chatmode.md +0 -31
- package/assets/chatmodes/semantic-kernel-python.chatmode.md +0 -28
- package/assets/chatmodes/shopify-expert.chatmode.md +0 -681
- package/assets/chatmodes/simple-app-idea-generator.chatmode.md +0 -134
- package/assets/chatmodes/software-engineer-agent-v1.chatmode.md +0 -164
- package/assets/chatmodes/specification.chatmode.md +0 -127
- package/assets/chatmodes/swift-mcp-expert.chatmode.md +0 -240
- package/assets/chatmodes/task-planner.chatmode.md +0 -374
- package/assets/chatmodes/task-researcher.chatmode.md +0 -254
- package/assets/chatmodes/tdd-green.chatmode.md +0 -59
- package/assets/chatmodes/tdd-red.chatmode.md +0 -59
- package/assets/chatmodes/tdd-refactor.chatmode.md +0 -84
- package/assets/chatmodes/tech-debt-remediation-plan.chatmode.md +0 -49
- package/assets/chatmodes/terraform-azure-implement.chatmode.md +0 -104
- package/assets/chatmodes/terraform-azure-planning.chatmode.md +0 -157
- package/assets/chatmodes/typescript-mcp-expert.chatmode.md +0 -91
- package/assets/chatmodes/voidbeast-gpt41enhanced.chatmode.md +0 -230
- package/assets/chatmodes/wg-code-alchemist.chatmode.md +0 -61
- package/assets/chatmodes/wg-code-sentinel.chatmode.md +0 -55
- package/assets/collections/ai-prompt-engineering.json +0 -95
- package/assets/collections/angular-development.json +0 -19
- package/assets/collections/azure-cloud-architect.json +0 -150
- package/assets/collections/cpp-development.json +0 -4
- package/assets/collections/database-administration.json +0 -13
- package/assets/collections/devops-sre.json +0 -33
- package/assets/collections/dotnet-development.json +0 -114
- package/assets/collections/general-productivity.json +0 -4
- package/assets/collections/go-development.json +0 -42
- package/assets/collections/java-spring-developer.json +0 -111
- package/assets/collections/learning-mentoring.json +0 -9
- package/assets/collections/legacy-migration.json +0 -6
- package/assets/collections/mcp-specialist.json +0 -92
- package/assets/collections/mobile-development.json +0 -12
- package/assets/collections/php-cms-development.json +0 -68
- package/assets/collections/power-platform-specialist.json +0 -128
- package/assets/collections/project-management.json +0 -50
- package/assets/collections/python-development.json +0 -66
- package/assets/collections/quality-assurance.json +0 -56
- package/assets/collections/ruby-development.json +0 -43
- package/assets/collections/rust-development.json +0 -63
- package/assets/collections/security-specialist.json +0 -65
- package/assets/collections/software-architect.json +0 -85
- package/assets/collections/technical-writing.json +0 -23
- package/assets/collections/web-frontend-development.json +0 -52
- package/assets/instructions/a11y.instructions.md +0 -369
- package/assets/instructions/ai-prompt-engineering-safety-best-practices.instructions.md +0 -867
- package/assets/instructions/angular.instructions.md +0 -104
- package/assets/instructions/ansible.instructions.md +0 -88
- package/assets/instructions/aspnet-rest-apis.instructions.md +0 -110
- package/assets/instructions/astro.instructions.md +0 -182
- package/assets/instructions/azure-devops-pipelines.instructions.md +0 -185
- package/assets/instructions/azure-functions-typescript.instructions.md +0 -14
- package/assets/instructions/azure-logic-apps-power-automate.instructions.md +0 -1943
- package/assets/instructions/azure-verified-modules-terraform.instructions.md +0 -229
- package/assets/instructions/bicep-code-best-practices.instructions.md +0 -54
- package/assets/instructions/blazor.instructions.md +0 -77
- package/assets/instructions/clojure.instructions.md +0 -349
- package/assets/instructions/cmake-vcpkg.instructions.md +0 -10
- package/assets/instructions/codexer.instructions.md +0 -428
- package/assets/instructions/coldfusion-cfc.instructions.md +0 -30
- package/assets/instructions/coldfusion-cfm.instructions.md +0 -28
- package/assets/instructions/collections.instructions.md +0 -54
- package/assets/instructions/containerization-docker-best-practices.instructions.md +0 -681
- package/assets/instructions/convert-jpa-to-spring-data-cosmos.instructions.md +0 -949
- package/assets/instructions/copilot-thought-logging.instructions.md +0 -62
- package/assets/instructions/csharp-ja.instructions.md +0 -114
- package/assets/instructions/csharp-ko.instructions.md +0 -77
- package/assets/instructions/csharp-mcp-server.instructions.md +0 -95
- package/assets/instructions/csharp.instructions.md +0 -114
- package/assets/instructions/dart-n-flutter.instructions.md +0 -447
- package/assets/instructions/declarative-agents-microsoft365.instructions.md +0 -316
- package/assets/instructions/devbox-image-definition.instructions.md +0 -302
- package/assets/instructions/devops-core-principles.instructions.md +0 -167
- package/assets/instructions/dotnet-architecture-good-practices.instructions.md +0 -279
- package/assets/instructions/dotnet-framework.instructions.md +0 -113
- package/assets/instructions/dotnet-maui-9-to-dotnet-maui-10-upgrade.instructions.md +0 -1922
- package/assets/instructions/dotnet-maui.instructions.md +0 -69
- package/assets/instructions/dotnet-upgrade.instructions.md +0 -287
- package/assets/instructions/dotnet-wpf.instructions.md +0 -79
- package/assets/instructions/genaiscript.instructions.md +0 -21
- package/assets/instructions/generate-modern-terraform-code-for-azure.instructions.md +0 -82
- package/assets/instructions/gilfoyle-code-review.instructions.md +0 -114
- package/assets/instructions/github-actions-ci-cd-best-practices.instructions.md +0 -607
- package/assets/instructions/go-mcp-server.instructions.md +0 -346
- package/assets/instructions/go.instructions.md +0 -373
- package/assets/instructions/instructions.instructions.md +0 -256
- package/assets/instructions/java-11-to-java-17-upgrade.instructions.md +0 -793
- package/assets/instructions/java-17-to-java-21-upgrade.instructions.md +0 -464
- package/assets/instructions/java-21-to-java-25-upgrade.instructions.md +0 -311
- package/assets/instructions/java-mcp-server.instructions.md +0 -553
- package/assets/instructions/java.instructions.md +0 -81
- package/assets/instructions/joyride-user-project.instructions.md +0 -206
- package/assets/instructions/joyride-workspace-automation.instructions.md +0 -46
- package/assets/instructions/kotlin-mcp-server.instructions.md +0 -481
- package/assets/instructions/kubernetes-deployment-best-practices.instructions.md +0 -307
- package/assets/instructions/langchain-python.instructions.md +0 -229
- package/assets/instructions/localization.instructions.md +0 -39
- package/assets/instructions/makefile.instructions.md +0 -410
- package/assets/instructions/markdown.instructions.md +0 -52
- package/assets/instructions/memory-bank.instructions.md +0 -299
- package/assets/instructions/mongo-dba.instructions.md +0 -25
- package/assets/instructions/ms-sql-dba.instructions.md +0 -25
- package/assets/instructions/nestjs.instructions.md +0 -406
- package/assets/instructions/nextjs-tailwind.instructions.md +0 -72
- package/assets/instructions/nextjs.instructions.md +0 -143
- package/assets/instructions/nodejs-javascript-vitest.instructions.md +0 -30
- package/assets/instructions/object-calisthenics.instructions.md +0 -302
- package/assets/instructions/oqtane.instructions.md +0 -86
- package/assets/instructions/performance-optimization.instructions.md +0 -420
- package/assets/instructions/php-mcp-server.instructions.md +0 -809
- package/assets/instructions/playwright-dotnet.instructions.md +0 -101
- package/assets/instructions/playwright-python.instructions.md +0 -62
- package/assets/instructions/playwright-typescript.instructions.md +0 -86
- package/assets/instructions/power-apps-canvas-yaml.instructions.md +0 -827
- package/assets/instructions/power-apps-code-apps.instructions.md +0 -601
- package/assets/instructions/power-bi-custom-visuals-development.instructions.md +0 -810
- package/assets/instructions/power-bi-data-modeling-best-practices.instructions.md +0 -639
- package/assets/instructions/power-bi-dax-best-practices.instructions.md +0 -795
- package/assets/instructions/power-bi-devops-alm-best-practices.instructions.md +0 -623
- package/assets/instructions/power-bi-report-design-best-practices.instructions.md +0 -752
- package/assets/instructions/power-bi-security-rls-best-practices.instructions.md +0 -504
- package/assets/instructions/power-platform-connector.instructions.md +0 -430
- package/assets/instructions/power-platform-mcp-development.instructions.md +0 -88
- package/assets/instructions/powershell-pester-5.instructions.md +0 -197
- package/assets/instructions/powershell.instructions.md +0 -356
- package/assets/instructions/prompt.instructions.md +0 -73
- package/assets/instructions/python-mcp-server.instructions.md +0 -204
- package/assets/instructions/python.instructions.md +0 -56
- package/assets/instructions/quarkus-mcp-server-sse.instructions.md +0 -49
- package/assets/instructions/quarkus.instructions.md +0 -98
- package/assets/instructions/r.instructions.md +0 -116
- package/assets/instructions/reactjs.instructions.md +0 -162
- package/assets/instructions/ruby-mcp-server.instructions.md +0 -629
- package/assets/instructions/ruby-on-rails.instructions.md +0 -124
- package/assets/instructions/rust-mcp-server.instructions.md +0 -715
- package/assets/instructions/rust.instructions.md +0 -135
- package/assets/instructions/security-and-owasp.instructions.md +0 -51
- package/assets/instructions/self-explanatory-code-commenting.instructions.md +0 -162
- package/assets/instructions/shell.instructions.md +0 -132
- package/assets/instructions/spec-driven-workflow-v1.instructions.md +0 -323
- package/assets/instructions/springboot.instructions.md +0 -68
- package/assets/instructions/sql-sp-generation.instructions.md +0 -74
- package/assets/instructions/svelte.instructions.md +0 -161
- package/assets/instructions/swift-mcp-server.instructions.md +0 -498
- package/assets/instructions/taming-copilot.instructions.md +0 -40
- package/assets/instructions/tanstack-start-shadcn-tailwind.instructions.md +0 -212
- package/assets/instructions/task-implementation.instructions.md +0 -190
- package/assets/instructions/tasksync.instructions.md +0 -352
- package/assets/instructions/terraform-azure.instructions.md +0 -254
- package/assets/instructions/terraform-sap-btp.instructions.md +0 -195
- package/assets/instructions/terraform.instructions.md +0 -113
- package/assets/instructions/typescript-5-es2022.instructions.md +0 -114
- package/assets/instructions/typescript-mcp-server.instructions.md +0 -228
- package/assets/instructions/update-code-from-shorthand.instructions.md +0 -130
- package/assets/instructions/vuejs3.instructions.md +0 -153
- package/assets/instructions/wordpress.instructions.md +0 -186
- package/assets/prompts/add-educational-comments.prompt.md +0 -129
- package/assets/prompts/ai-prompt-engineering-safety-review.prompt.md +0 -230
- package/assets/prompts/architecture-blueprint-generator.prompt.md +0 -322
- package/assets/prompts/aspnet-minimal-api-openapi.prompt.md +0 -42
- package/assets/prompts/az-cost-optimize.prompt.md +0 -305
- package/assets/prompts/azure-resource-health-diagnose.prompt.md +0 -290
- package/assets/prompts/boost-prompt.prompt.md +0 -25
- package/assets/prompts/breakdown-epic-arch.prompt.md +0 -66
- package/assets/prompts/breakdown-epic-pm.prompt.md +0 -58
- package/assets/prompts/breakdown-feature-implementation.prompt.md +0 -128
- package/assets/prompts/breakdown-feature-prd.prompt.md +0 -61
- package/assets/prompts/breakdown-plan.prompt.md +0 -509
- package/assets/prompts/breakdown-test.prompt.md +0 -365
- package/assets/prompts/code-exemplars-blueprint-generator.prompt.md +0 -126
- package/assets/prompts/comment-code-generate-a-tutorial.prompt.md +0 -26
- package/assets/prompts/containerize-aspnet-framework.prompt.md +0 -455
- package/assets/prompts/containerize-aspnetcore.prompt.md +0 -393
- package/assets/prompts/conventional-commit.prompt.md +0 -73
- package/assets/prompts/copilot-instructions-blueprint-generator.prompt.md +0 -294
- package/assets/prompts/cosmosdb-datamodeling.prompt.md +0 -1045
- package/assets/prompts/create-agentsmd.prompt.md +0 -249
- package/assets/prompts/create-architectural-decision-record.prompt.md +0 -97
- package/assets/prompts/create-github-action-workflow-specification.prompt.md +0 -276
- package/assets/prompts/create-github-issue-feature-from-specification.prompt.md +0 -28
- package/assets/prompts/create-github-issues-feature-from-implementation-plan.prompt.md +0 -28
- package/assets/prompts/create-github-issues-for-unmet-specification-requirements.prompt.md +0 -35
- package/assets/prompts/create-github-pull-request-from-specification.prompt.md +0 -24
- package/assets/prompts/create-implementation-plan.prompt.md +0 -157
- package/assets/prompts/create-llms.prompt.md +0 -210
- package/assets/prompts/create-oo-component-documentation.prompt.md +0 -193
- package/assets/prompts/create-readme.prompt.md +0 -21
- package/assets/prompts/create-specification.prompt.md +0 -127
- package/assets/prompts/create-spring-boot-java-project.prompt.md +0 -163
- package/assets/prompts/create-spring-boot-kotlin-project.prompt.md +0 -147
- package/assets/prompts/create-technical-spike.prompt.md +0 -231
- package/assets/prompts/csharp-async.prompt.md +0 -50
- package/assets/prompts/csharp-docs.prompt.md +0 -63
- package/assets/prompts/csharp-mcp-server-generator.prompt.md +0 -59
- package/assets/prompts/csharp-mstest.prompt.md +0 -67
- package/assets/prompts/csharp-nunit.prompt.md +0 -72
- package/assets/prompts/csharp-tunit.prompt.md +0 -101
- package/assets/prompts/csharp-xunit.prompt.md +0 -69
- package/assets/prompts/declarative-agents.prompt.md +0 -93
- package/assets/prompts/documentation-writer.prompt.md +0 -46
- package/assets/prompts/dotnet-best-practices.prompt.md +0 -84
- package/assets/prompts/dotnet-design-pattern-review.prompt.md +0 -41
- package/assets/prompts/dotnet-upgrade.prompt.md +0 -116
- package/assets/prompts/editorconfig.prompt.md +0 -64
- package/assets/prompts/ef-core.prompt.md +0 -76
- package/assets/prompts/finalize-agent-prompt.prompt.md +0 -27
- package/assets/prompts/first-ask.prompt.md +0 -29
- package/assets/prompts/folder-structure-blueprint-generator.prompt.md +0 -405
- package/assets/prompts/gen-specs-as-issues.prompt.md +0 -165
- package/assets/prompts/generate-custom-instructions-from-codebase.prompt.md +0 -240
- package/assets/prompts/git-flow-branch-creator.prompt.md +0 -293
- package/assets/prompts/github-copilot-starter.prompt.md +0 -372
- package/assets/prompts/go-mcp-server-generator.prompt.md +0 -334
- package/assets/prompts/java-docs.prompt.md +0 -24
- package/assets/prompts/java-junit.prompt.md +0 -64
- package/assets/prompts/java-mcp-server-generator.prompt.md +0 -756
- package/assets/prompts/java-refactoring-extract-method.prompt.md +0 -105
- package/assets/prompts/java-refactoring-remove-parameter.prompt.md +0 -85
- package/assets/prompts/java-springboot.prompt.md +0 -66
- package/assets/prompts/javascript-typescript-jest.prompt.md +0 -44
- package/assets/prompts/kotlin-mcp-server-generator.prompt.md +0 -449
- package/assets/prompts/kotlin-springboot.prompt.md +0 -71
- package/assets/prompts/mcp-copilot-studio-server-generator.prompt.md +0 -118
- package/assets/prompts/memory-merger.prompt.md +0 -107
- package/assets/prompts/mkdocs-translations.prompt.md +0 -110
- package/assets/prompts/model-recommendation.prompt.md +0 -677
- package/assets/prompts/multi-stage-dockerfile.prompt.md +0 -47
- package/assets/prompts/my-issues.prompt.md +0 -9
- package/assets/prompts/my-pull-requests.prompt.md +0 -15
- package/assets/prompts/next-intl-add-language.prompt.md +0 -20
- package/assets/prompts/php-mcp-server-generator.prompt.md +0 -522
- package/assets/prompts/playwright-automation-fill-in-form.prompt.md +0 -30
- package/assets/prompts/playwright-explore-website.prompt.md +0 -19
- package/assets/prompts/playwright-generate-test.prompt.md +0 -19
- package/assets/prompts/postgresql-code-review.prompt.md +0 -214
- package/assets/prompts/postgresql-optimization.prompt.md +0 -406
- package/assets/prompts/power-apps-code-app-scaffold.prompt.md +0 -150
- package/assets/prompts/power-bi-dax-optimization.prompt.md +0 -175
- package/assets/prompts/power-bi-model-design-review.prompt.md +0 -405
- package/assets/prompts/power-bi-performance-troubleshooting.prompt.md +0 -384
- package/assets/prompts/power-bi-report-design-consultation.prompt.md +0 -353
- package/assets/prompts/power-platform-mcp-connector-suite.prompt.md +0 -156
- package/assets/prompts/project-workflow-analysis-blueprint-generator.prompt.md +0 -294
- package/assets/prompts/prompt-builder.prompt.md +0 -142
- package/assets/prompts/pytest-coverage.prompt.md +0 -28
- package/assets/prompts/python-mcp-server-generator.prompt.md +0 -105
- package/assets/prompts/readme-blueprint-generator.prompt.md +0 -79
- package/assets/prompts/remember-interactive-programming.prompt.md +0 -13
- package/assets/prompts/remember.prompt.md +0 -125
- package/assets/prompts/repo-story-time.prompt.md +0 -156
- package/assets/prompts/review-and-refactor.prompt.md +0 -15
- package/assets/prompts/ruby-mcp-server-generator.prompt.md +0 -660
- package/assets/prompts/rust-mcp-server-generator.prompt.md +0 -578
- package/assets/prompts/shuffle-json-data.prompt.md +0 -151
- package/assets/prompts/sql-code-review.prompt.md +0 -303
- package/assets/prompts/sql-optimization.prompt.md +0 -298
- package/assets/prompts/suggest-awesome-github-copilot-agents.prompt.md +0 -72
- package/assets/prompts/suggest-awesome-github-copilot-chatmodes.prompt.md +0 -71
- package/assets/prompts/suggest-awesome-github-copilot-collections.prompt.md +0 -149
- package/assets/prompts/suggest-awesome-github-copilot-instructions.prompt.md +0 -88
- package/assets/prompts/suggest-awesome-github-copilot-prompts.prompt.md +0 -71
- package/assets/prompts/swift-mcp-server-generator.prompt.md +0 -669
- package/assets/prompts/technology-stack-blueprint-generator.prompt.md +0 -242
- package/assets/prompts/typescript-mcp-server-generator.prompt.md +0 -90
- package/assets/prompts/update-avm-modules-in-bicep.prompt.md +0 -60
- package/assets/prompts/update-implementation-plan.prompt.md +0 -157
- package/assets/prompts/update-llms.prompt.md +0 -216
- package/assets/prompts/update-markdown-file-index.prompt.md +0 -76
- package/assets/prompts/update-oo-component-documentation.prompt.md +0 -162
- package/assets/prompts/update-specification.prompt.md +0 -127
- package/assets/prompts/write-coding-standards-from-file.prompt.md +0 -316
- package/scripts/analyze-collections.js +0 -387
- package/scripts/sync.js +0 -99
- package/verdaccio/config.yaml +0 -202
|
@@ -1,715 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 'Best practices for building Model Context Protocol servers in Rust using the official rmcp SDK with async/await patterns'
|
|
3
|
-
applyTo: '**/*.rs'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Rust MCP Server Development Best Practices
|
|
7
|
-
|
|
8
|
-
This guide provides best practices for building Model Context Protocol (MCP) servers using the official Rust SDK (`rmcp`).
|
|
9
|
-
|
|
10
|
-
## Installation and Setup
|
|
11
|
-
|
|
12
|
-
### Add Dependencies
|
|
13
|
-
|
|
14
|
-
Add the `rmcp` crate to your `Cargo.toml`:
|
|
15
|
-
|
|
16
|
-
```toml
|
|
17
|
-
[dependencies]
|
|
18
|
-
rmcp = { version = "0.8.1", features = ["server"] }
|
|
19
|
-
tokio = { version = "1", features = ["full"] }
|
|
20
|
-
serde = { version = "1.0", features = ["derive"] }
|
|
21
|
-
serde_json = "1.0"
|
|
22
|
-
anyhow = "1.0"
|
|
23
|
-
tracing = "0.1"
|
|
24
|
-
tracing-subscriber = "0.3"
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
For macros support:
|
|
28
|
-
|
|
29
|
-
```toml
|
|
30
|
-
[dependencies]
|
|
31
|
-
rmcp-macros = "0.8"
|
|
32
|
-
schemars = { version = "0.8", features = ["derive"] }
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Project Structure
|
|
36
|
-
|
|
37
|
-
Organize your Rust MCP server project:
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
my-mcp-server/
|
|
41
|
-
├── Cargo.toml
|
|
42
|
-
├── src/
|
|
43
|
-
│ ├── main.rs # Server entry point
|
|
44
|
-
│ ├── handler.rs # ServerHandler implementation
|
|
45
|
-
│ ├── tools/
|
|
46
|
-
│ │ ├── mod.rs
|
|
47
|
-
│ │ ├── calculator.rs
|
|
48
|
-
│ │ └── greeter.rs
|
|
49
|
-
│ ├── prompts/
|
|
50
|
-
│ │ ├── mod.rs
|
|
51
|
-
│ │ └── code_review.rs
|
|
52
|
-
│ └── resources/
|
|
53
|
-
│ ├── mod.rs
|
|
54
|
-
│ └── data.rs
|
|
55
|
-
└── tests/
|
|
56
|
-
└── integration_tests.rs
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Server Implementation
|
|
60
|
-
|
|
61
|
-
### Basic Server Setup
|
|
62
|
-
|
|
63
|
-
Create a server with stdio transport:
|
|
64
|
-
|
|
65
|
-
```rust
|
|
66
|
-
use rmcp::{
|
|
67
|
-
protocol::ServerCapabilities,
|
|
68
|
-
server::{Server, ServerHandler},
|
|
69
|
-
transport::StdioTransport,
|
|
70
|
-
};
|
|
71
|
-
use tokio::signal;
|
|
72
|
-
|
|
73
|
-
#[tokio::main]
|
|
74
|
-
async fn main() -> anyhow::Result<()> {
|
|
75
|
-
tracing_subscriber::fmt::init();
|
|
76
|
-
|
|
77
|
-
let handler = MyServerHandler::new();
|
|
78
|
-
let transport = StdioTransport::new();
|
|
79
|
-
|
|
80
|
-
let server = Server::builder()
|
|
81
|
-
.with_handler(handler)
|
|
82
|
-
.with_capabilities(ServerCapabilities {
|
|
83
|
-
tools: Some(Default::default()),
|
|
84
|
-
prompts: Some(Default::default()),
|
|
85
|
-
resources: Some(Default::default()),
|
|
86
|
-
..Default::default()
|
|
87
|
-
})
|
|
88
|
-
.build(transport)?;
|
|
89
|
-
|
|
90
|
-
server.run(signal::ctrl_c()).await?;
|
|
91
|
-
|
|
92
|
-
Ok(())
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### ServerHandler Implementation
|
|
97
|
-
|
|
98
|
-
Implement the `ServerHandler` trait:
|
|
99
|
-
|
|
100
|
-
```rust
|
|
101
|
-
use rmcp::{
|
|
102
|
-
model::*,
|
|
103
|
-
protocol::*,
|
|
104
|
-
server::{RequestContext, ServerHandler, RoleServer},
|
|
105
|
-
ErrorData,
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
pub struct MyServerHandler {
|
|
109
|
-
tool_router: ToolRouter,
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
impl MyServerHandler {
|
|
113
|
-
pub fn new() -> Self {
|
|
114
|
-
Self {
|
|
115
|
-
tool_router: Self::create_tool_router(),
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
fn create_tool_router() -> ToolRouter {
|
|
120
|
-
// Initialize and return tool router
|
|
121
|
-
ToolRouter::new()
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
#[async_trait::async_trait]
|
|
126
|
-
impl ServerHandler for MyServerHandler {
|
|
127
|
-
async fn list_tools(
|
|
128
|
-
&self,
|
|
129
|
-
_request: Option<PaginatedRequestParam>,
|
|
130
|
-
_context: RequestContext<RoleServer>,
|
|
131
|
-
) -> Result<ListToolsResult, ErrorData> {
|
|
132
|
-
let items = self.tool_router.list_all();
|
|
133
|
-
Ok(ListToolsResult::with_all_items(items))
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
async fn call_tool(
|
|
137
|
-
&self,
|
|
138
|
-
request: CallToolRequestParam,
|
|
139
|
-
context: RequestContext<RoleServer>,
|
|
140
|
-
) -> Result<CallToolResult, ErrorData> {
|
|
141
|
-
let tcc = ToolCallContext::new(self, request, context);
|
|
142
|
-
self.tool_router.call(tcc).await
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
## Tool Development
|
|
148
|
-
|
|
149
|
-
### Using Macros for Tools
|
|
150
|
-
|
|
151
|
-
Use the `#[tool]` macro for declarative tool definitions:
|
|
152
|
-
|
|
153
|
-
```rust
|
|
154
|
-
use rmcp::tool;
|
|
155
|
-
use rmcp::model::Parameters;
|
|
156
|
-
use serde::{Deserialize, Serialize};
|
|
157
|
-
use schemars::JsonSchema;
|
|
158
|
-
|
|
159
|
-
#[derive(Debug, Deserialize, JsonSchema)]
|
|
160
|
-
pub struct CalculateParams {
|
|
161
|
-
pub a: f64,
|
|
162
|
-
pub b: f64,
|
|
163
|
-
pub operation: String,
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/// Performs mathematical calculations
|
|
167
|
-
#[tool(
|
|
168
|
-
name = "calculate",
|
|
169
|
-
description = "Performs basic arithmetic operations",
|
|
170
|
-
annotations(read_only_hint = true)
|
|
171
|
-
)]
|
|
172
|
-
pub async fn calculate(params: Parameters<CalculateParams>) -> Result<f64, String> {
|
|
173
|
-
let p = params.inner();
|
|
174
|
-
match p.operation.as_str() {
|
|
175
|
-
"add" => Ok(p.a + p.b),
|
|
176
|
-
"subtract" => Ok(p.a - p.b),
|
|
177
|
-
"multiply" => Ok(p.a * p.b),
|
|
178
|
-
"divide" => {
|
|
179
|
-
if p.b == 0.0 {
|
|
180
|
-
Err("Division by zero".to_string())
|
|
181
|
-
} else {
|
|
182
|
-
Ok(p.a / p.b)
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
_ => Err(format!("Unknown operation: {}", p.operation)),
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Tool Router with Macros
|
|
191
|
-
|
|
192
|
-
Use `#[tool_router]` and `#[tool_handler]` macros:
|
|
193
|
-
|
|
194
|
-
```rust
|
|
195
|
-
use rmcp::{tool_router, tool_handler};
|
|
196
|
-
|
|
197
|
-
pub struct ToolsHandler {
|
|
198
|
-
tool_router: ToolRouter,
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
#[tool_router]
|
|
202
|
-
impl ToolsHandler {
|
|
203
|
-
#[tool]
|
|
204
|
-
async fn greet(params: Parameters<GreetParams>) -> String {
|
|
205
|
-
format!("Hello, {}!", params.inner().name)
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
#[tool(annotations(destructive_hint = true))]
|
|
209
|
-
async fn reset_counter() -> String {
|
|
210
|
-
"Counter reset".to_string()
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
pub fn new() -> Self {
|
|
214
|
-
Self {
|
|
215
|
-
tool_router: Self::tool_router(),
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
#[tool_handler]
|
|
221
|
-
impl ServerHandler for ToolsHandler {
|
|
222
|
-
// Other handler methods...
|
|
223
|
-
}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### Tool Annotations
|
|
227
|
-
|
|
228
|
-
Use annotations to provide hints about tool behavior:
|
|
229
|
-
|
|
230
|
-
```rust
|
|
231
|
-
#[tool(
|
|
232
|
-
name = "delete_file",
|
|
233
|
-
annotations(
|
|
234
|
-
destructive_hint = true,
|
|
235
|
-
read_only_hint = false,
|
|
236
|
-
idempotent_hint = false
|
|
237
|
-
)
|
|
238
|
-
)]
|
|
239
|
-
pub async fn delete_file(params: Parameters<DeleteParams>) -> Result<(), String> {
|
|
240
|
-
// Delete file logic
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
#[tool(
|
|
244
|
-
name = "search_data",
|
|
245
|
-
annotations(
|
|
246
|
-
read_only_hint = true,
|
|
247
|
-
idempotent_hint = true,
|
|
248
|
-
open_world_hint = true
|
|
249
|
-
)
|
|
250
|
-
)]
|
|
251
|
-
pub async fn search_data(params: Parameters<SearchParams>) -> Vec<String> {
|
|
252
|
-
// Search logic
|
|
253
|
-
}
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### Returning Rich Content
|
|
257
|
-
|
|
258
|
-
Return structured content from tools:
|
|
259
|
-
|
|
260
|
-
```rust
|
|
261
|
-
use rmcp::model::{ToolResponseContent, TextContent, ImageContent};
|
|
262
|
-
|
|
263
|
-
#[tool]
|
|
264
|
-
async fn analyze_code(params: Parameters<CodeParams>) -> ToolResponseContent {
|
|
265
|
-
ToolResponseContent::from(vec![
|
|
266
|
-
TextContent::text(format!("Analysis of {}:", params.inner().filename)),
|
|
267
|
-
TextContent::text("No issues found."),
|
|
268
|
-
])
|
|
269
|
-
}
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
## Prompt Implementation
|
|
273
|
-
|
|
274
|
-
### Prompt Handler
|
|
275
|
-
|
|
276
|
-
Implement prompt handlers:
|
|
277
|
-
|
|
278
|
-
```rust
|
|
279
|
-
use rmcp::model::{Prompt, PromptArgument, PromptMessage, GetPromptResult};
|
|
280
|
-
|
|
281
|
-
async fn list_prompts(
|
|
282
|
-
&self,
|
|
283
|
-
_request: Option<PaginatedRequestParam>,
|
|
284
|
-
_context: RequestContext<RoleServer>,
|
|
285
|
-
) -> Result<ListPromptsResult, ErrorData> {
|
|
286
|
-
let prompts = vec![
|
|
287
|
-
Prompt {
|
|
288
|
-
name: "code-review".to_string(),
|
|
289
|
-
description: Some("Review code for best practices".to_string()),
|
|
290
|
-
arguments: Some(vec![
|
|
291
|
-
PromptArgument {
|
|
292
|
-
name: "language".to_string(),
|
|
293
|
-
description: Some("Programming language".to_string()),
|
|
294
|
-
required: Some(true),
|
|
295
|
-
},
|
|
296
|
-
]),
|
|
297
|
-
},
|
|
298
|
-
];
|
|
299
|
-
|
|
300
|
-
Ok(ListPromptsResult { prompts })
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
async fn get_prompt(
|
|
304
|
-
&self,
|
|
305
|
-
request: GetPromptRequestParam,
|
|
306
|
-
_context: RequestContext<RoleServer>,
|
|
307
|
-
) -> Result<GetPromptResult, ErrorData> {
|
|
308
|
-
match request.name.as_str() {
|
|
309
|
-
"code-review" => {
|
|
310
|
-
let language = request.arguments
|
|
311
|
-
.as_ref()
|
|
312
|
-
.and_then(|args| args.get("language"))
|
|
313
|
-
.ok_or_else(|| ErrorData::invalid_params("language required"))?;
|
|
314
|
-
|
|
315
|
-
Ok(GetPromptResult {
|
|
316
|
-
description: Some("Code review prompt".to_string()),
|
|
317
|
-
messages: vec![
|
|
318
|
-
PromptMessage::user(format!(
|
|
319
|
-
"Review this {} code for best practices and suggest improvements",
|
|
320
|
-
language
|
|
321
|
-
)),
|
|
322
|
-
],
|
|
323
|
-
})
|
|
324
|
-
}
|
|
325
|
-
_ => Err(ErrorData::invalid_params("Unknown prompt")),
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
## Resource Implementation
|
|
331
|
-
|
|
332
|
-
### Resource Handlers
|
|
333
|
-
|
|
334
|
-
Implement resource handlers:
|
|
335
|
-
|
|
336
|
-
```rust
|
|
337
|
-
use rmcp::model::{Resource, ResourceContents, ReadResourceResult};
|
|
338
|
-
|
|
339
|
-
async fn list_resources(
|
|
340
|
-
&self,
|
|
341
|
-
_request: Option<PaginatedRequestParam>,
|
|
342
|
-
_context: RequestContext<RoleServer>,
|
|
343
|
-
) -> Result<ListResourcesResult, ErrorData> {
|
|
344
|
-
let resources = vec![
|
|
345
|
-
Resource {
|
|
346
|
-
uri: "file:///data/config.json".to_string(),
|
|
347
|
-
name: "Configuration".to_string(),
|
|
348
|
-
description: Some("Server configuration".to_string()),
|
|
349
|
-
mime_type: Some("application/json".to_string()),
|
|
350
|
-
},
|
|
351
|
-
];
|
|
352
|
-
|
|
353
|
-
Ok(ListResourcesResult { resources })
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
async fn read_resource(
|
|
357
|
-
&self,
|
|
358
|
-
request: ReadResourceRequestParam,
|
|
359
|
-
_context: RequestContext<RoleServer>,
|
|
360
|
-
) -> Result<ReadResourceResult, ErrorData> {
|
|
361
|
-
match request.uri.as_str() {
|
|
362
|
-
"file:///data/config.json" => {
|
|
363
|
-
let content = r#"{"version": "1.0", "enabled": true}"#;
|
|
364
|
-
Ok(ReadResourceResult {
|
|
365
|
-
contents: vec![
|
|
366
|
-
ResourceContents::text(content.to_string())
|
|
367
|
-
.with_uri(request.uri)
|
|
368
|
-
.with_mime_type("application/json"),
|
|
369
|
-
],
|
|
370
|
-
})
|
|
371
|
-
}
|
|
372
|
-
_ => Err(ErrorData::invalid_params("Unknown resource")),
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
## Transport Options
|
|
378
|
-
|
|
379
|
-
### Stdio Transport
|
|
380
|
-
|
|
381
|
-
Standard input/output transport for CLI integration:
|
|
382
|
-
|
|
383
|
-
```rust
|
|
384
|
-
use rmcp::transport::StdioTransport;
|
|
385
|
-
|
|
386
|
-
let transport = StdioTransport::new();
|
|
387
|
-
let server = Server::builder()
|
|
388
|
-
.with_handler(handler)
|
|
389
|
-
.build(transport)?;
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
### SSE (Server-Sent Events) Transport
|
|
393
|
-
|
|
394
|
-
HTTP-based SSE transport:
|
|
395
|
-
|
|
396
|
-
```rust
|
|
397
|
-
use rmcp::transport::SseServerTransport;
|
|
398
|
-
use std::net::SocketAddr;
|
|
399
|
-
|
|
400
|
-
let addr: SocketAddr = "127.0.0.1:8000".parse()?;
|
|
401
|
-
let transport = SseServerTransport::new(addr);
|
|
402
|
-
|
|
403
|
-
let server = Server::builder()
|
|
404
|
-
.with_handler(handler)
|
|
405
|
-
.build(transport)?;
|
|
406
|
-
|
|
407
|
-
server.run(signal::ctrl_c()).await?;
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
### Streamable HTTP Transport
|
|
411
|
-
|
|
412
|
-
HTTP streaming transport with Axum:
|
|
413
|
-
|
|
414
|
-
```rust
|
|
415
|
-
use rmcp::transport::StreamableHttpTransport;
|
|
416
|
-
use axum::{Router, routing::post};
|
|
417
|
-
|
|
418
|
-
let transport = StreamableHttpTransport::new();
|
|
419
|
-
let app = Router::new()
|
|
420
|
-
.route("/mcp", post(transport.handler()));
|
|
421
|
-
|
|
422
|
-
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000").await?;
|
|
423
|
-
axum::serve(listener, app).await?;
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
### Custom Transports
|
|
427
|
-
|
|
428
|
-
Implement custom transports (TCP, Unix Socket, WebSocket):
|
|
429
|
-
|
|
430
|
-
```rust
|
|
431
|
-
use rmcp::transport::Transport;
|
|
432
|
-
use tokio::net::TcpListener;
|
|
433
|
-
|
|
434
|
-
// See examples/transport/ for TCP, Unix Socket, WebSocket implementations
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
## Error Handling
|
|
438
|
-
|
|
439
|
-
### ErrorData Usage
|
|
440
|
-
|
|
441
|
-
Return proper MCP errors:
|
|
442
|
-
|
|
443
|
-
```rust
|
|
444
|
-
use rmcp::ErrorData;
|
|
445
|
-
|
|
446
|
-
fn validate_params(value: &str) -> Result<(), ErrorData> {
|
|
447
|
-
if value.is_empty() {
|
|
448
|
-
return Err(ErrorData::invalid_params("Value cannot be empty"));
|
|
449
|
-
}
|
|
450
|
-
Ok(())
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
async fn call_tool(
|
|
454
|
-
&self,
|
|
455
|
-
request: CallToolRequestParam,
|
|
456
|
-
context: RequestContext<RoleServer>,
|
|
457
|
-
) -> Result<CallToolResult, ErrorData> {
|
|
458
|
-
validate_params(&request.name)?;
|
|
459
|
-
|
|
460
|
-
// Tool execution...
|
|
461
|
-
|
|
462
|
-
Ok(CallToolResult {
|
|
463
|
-
content: vec![TextContent::text("Success")],
|
|
464
|
-
is_error: Some(false),
|
|
465
|
-
})
|
|
466
|
-
}
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
### Anyhow Integration
|
|
470
|
-
|
|
471
|
-
Use `anyhow` for application-level errors:
|
|
472
|
-
|
|
473
|
-
```rust
|
|
474
|
-
use anyhow::{Context, Result};
|
|
475
|
-
|
|
476
|
-
async fn load_config() -> Result<Config> {
|
|
477
|
-
let content = tokio::fs::read_to_string("config.json")
|
|
478
|
-
.await
|
|
479
|
-
.context("Failed to read config file")?;
|
|
480
|
-
|
|
481
|
-
let config: Config = serde_json::from_str(&content)
|
|
482
|
-
.context("Failed to parse config")?;
|
|
483
|
-
|
|
484
|
-
Ok(config)
|
|
485
|
-
}
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
## Testing
|
|
489
|
-
|
|
490
|
-
### Unit Tests
|
|
491
|
-
|
|
492
|
-
Write unit tests for tools and handlers:
|
|
493
|
-
|
|
494
|
-
```rust
|
|
495
|
-
#[cfg(test)]
|
|
496
|
-
mod tests {
|
|
497
|
-
use super::*;
|
|
498
|
-
|
|
499
|
-
#[tokio::test]
|
|
500
|
-
async fn test_calculate_add() {
|
|
501
|
-
let params = Parameters::new(CalculateParams {
|
|
502
|
-
a: 5.0,
|
|
503
|
-
b: 3.0,
|
|
504
|
-
operation: "add".to_string(),
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
let result = calculate(params).await.unwrap();
|
|
508
|
-
assert_eq!(result, 8.0);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
#[tokio::test]
|
|
512
|
-
async fn test_divide_by_zero() {
|
|
513
|
-
let params = Parameters::new(CalculateParams {
|
|
514
|
-
a: 5.0,
|
|
515
|
-
b: 0.0,
|
|
516
|
-
operation: "divide".to_string(),
|
|
517
|
-
});
|
|
518
|
-
|
|
519
|
-
let result = calculate(params).await;
|
|
520
|
-
assert!(result.is_err());
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
### Integration Tests
|
|
526
|
-
|
|
527
|
-
Test complete server interactions:
|
|
528
|
-
|
|
529
|
-
```rust
|
|
530
|
-
#[tokio::test]
|
|
531
|
-
async fn test_server_list_tools() {
|
|
532
|
-
let handler = MyServerHandler::new();
|
|
533
|
-
let context = RequestContext::default();
|
|
534
|
-
|
|
535
|
-
let result = handler.list_tools(None, context).await.unwrap();
|
|
536
|
-
|
|
537
|
-
assert!(!result.tools.is_empty());
|
|
538
|
-
assert!(result.tools.iter().any(|t| t.name == "calculate"));
|
|
539
|
-
}
|
|
540
|
-
```
|
|
541
|
-
|
|
542
|
-
## Progress Notifications
|
|
543
|
-
|
|
544
|
-
### Reporting Progress
|
|
545
|
-
|
|
546
|
-
Send progress notifications during long-running operations:
|
|
547
|
-
|
|
548
|
-
```rust
|
|
549
|
-
use rmcp::model::ProgressNotification;
|
|
550
|
-
|
|
551
|
-
#[tool]
|
|
552
|
-
async fn process_large_file(
|
|
553
|
-
params: Parameters<ProcessParams>,
|
|
554
|
-
context: RequestContext<RoleServer>,
|
|
555
|
-
) -> Result<String, String> {
|
|
556
|
-
let total = 100;
|
|
557
|
-
|
|
558
|
-
for i in 0..=total {
|
|
559
|
-
// Do work...
|
|
560
|
-
|
|
561
|
-
if i % 10 == 0 {
|
|
562
|
-
context.notify_progress(ProgressNotification {
|
|
563
|
-
progress: i,
|
|
564
|
-
total: Some(total),
|
|
565
|
-
}).await.ok();
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
Ok("Processing complete".to_string())
|
|
570
|
-
}
|
|
571
|
-
```
|
|
572
|
-
|
|
573
|
-
## OAuth Authentication
|
|
574
|
-
|
|
575
|
-
### OAuth Integration
|
|
576
|
-
|
|
577
|
-
Implement OAuth for secure access:
|
|
578
|
-
|
|
579
|
-
```rust
|
|
580
|
-
use rmcp::oauth::{OAuthConfig, OAuthProvider};
|
|
581
|
-
|
|
582
|
-
let oauth_config = OAuthConfig {
|
|
583
|
-
authorization_endpoint: "https://auth.example.com/authorize".to_string(),
|
|
584
|
-
token_endpoint: "https://auth.example.com/token".to_string(),
|
|
585
|
-
client_id: env::var("CLIENT_ID")?,
|
|
586
|
-
client_secret: env::var("CLIENT_SECRET")?,
|
|
587
|
-
scopes: vec!["read".to_string(), "write".to_string()],
|
|
588
|
-
};
|
|
589
|
-
|
|
590
|
-
let oauth_provider = OAuthProvider::new(oauth_config);
|
|
591
|
-
// See examples/servers/complex_auth_sse.rs for complete implementation
|
|
592
|
-
```
|
|
593
|
-
|
|
594
|
-
## Performance Best Practices
|
|
595
|
-
|
|
596
|
-
### Async Operations
|
|
597
|
-
|
|
598
|
-
Use async/await for non-blocking operations:
|
|
599
|
-
|
|
600
|
-
```rust
|
|
601
|
-
#[tool]
|
|
602
|
-
async fn fetch_data(params: Parameters<FetchParams>) -> Result<String, String> {
|
|
603
|
-
let client = reqwest::Client::new();
|
|
604
|
-
let response = client
|
|
605
|
-
.get(¶ms.inner().url)
|
|
606
|
-
.send()
|
|
607
|
-
.await
|
|
608
|
-
.map_err(|e| e.to_string())?;
|
|
609
|
-
|
|
610
|
-
let text = response.text().await.map_err(|e| e.to_string())?;
|
|
611
|
-
Ok(text)
|
|
612
|
-
}
|
|
613
|
-
```
|
|
614
|
-
|
|
615
|
-
### State Management
|
|
616
|
-
|
|
617
|
-
Use `Arc` and `RwLock` for shared state:
|
|
618
|
-
|
|
619
|
-
```rust
|
|
620
|
-
use std::sync::Arc;
|
|
621
|
-
use tokio::sync::RwLock;
|
|
622
|
-
|
|
623
|
-
pub struct ServerState {
|
|
624
|
-
counter: Arc<RwLock<i32>>,
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
impl ServerState {
|
|
628
|
-
pub fn new() -> Self {
|
|
629
|
-
Self {
|
|
630
|
-
counter: Arc::new(RwLock::new(0)),
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
pub async fn increment(&self) -> i32 {
|
|
635
|
-
let mut counter = self.counter.write().await;
|
|
636
|
-
*counter += 1;
|
|
637
|
-
*counter
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
## Logging and Tracing
|
|
643
|
-
|
|
644
|
-
### Setup Tracing
|
|
645
|
-
|
|
646
|
-
Configure tracing for observability:
|
|
647
|
-
|
|
648
|
-
```rust
|
|
649
|
-
use tracing::{info, warn, error, debug};
|
|
650
|
-
use tracing_subscriber;
|
|
651
|
-
|
|
652
|
-
fn init_logging() {
|
|
653
|
-
tracing_subscriber::fmt()
|
|
654
|
-
.with_max_level(tracing::Level::DEBUG)
|
|
655
|
-
.with_target(false)
|
|
656
|
-
.with_thread_ids(true)
|
|
657
|
-
.init();
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
#[tool]
|
|
661
|
-
async fn my_tool(params: Parameters<MyParams>) -> String {
|
|
662
|
-
debug!("Tool called with params: {:?}", params);
|
|
663
|
-
info!("Processing request");
|
|
664
|
-
|
|
665
|
-
// Tool logic...
|
|
666
|
-
|
|
667
|
-
info!("Request completed");
|
|
668
|
-
"Done".to_string()
|
|
669
|
-
}
|
|
670
|
-
```
|
|
671
|
-
|
|
672
|
-
## Deployment
|
|
673
|
-
|
|
674
|
-
### Binary Distribution
|
|
675
|
-
|
|
676
|
-
Build optimized release binaries:
|
|
677
|
-
|
|
678
|
-
```bash
|
|
679
|
-
cargo build --release --target x86_64-unknown-linux-gnu
|
|
680
|
-
cargo build --release --target x86_64-pc-windows-msvc
|
|
681
|
-
cargo build --release --target x86_64-apple-darwin
|
|
682
|
-
```
|
|
683
|
-
|
|
684
|
-
### Cross-Compilation
|
|
685
|
-
|
|
686
|
-
Use cross for cross-platform builds:
|
|
687
|
-
|
|
688
|
-
```bash
|
|
689
|
-
cargo install cross
|
|
690
|
-
cross build --release --target aarch64-unknown-linux-gnu
|
|
691
|
-
```
|
|
692
|
-
|
|
693
|
-
### Docker Deployment
|
|
694
|
-
|
|
695
|
-
Create a Dockerfile:
|
|
696
|
-
|
|
697
|
-
```dockerfile
|
|
698
|
-
FROM rust:1.75 as builder
|
|
699
|
-
WORKDIR /app
|
|
700
|
-
COPY . .
|
|
701
|
-
RUN cargo build --release
|
|
702
|
-
|
|
703
|
-
FROM debian:bookworm-slim
|
|
704
|
-
RUN apt-get update && apt-get install -y ca-certificates
|
|
705
|
-
COPY --from=builder /app/target/release/my-mcp-server /usr/local/bin/
|
|
706
|
-
CMD ["my-mcp-server"]
|
|
707
|
-
```
|
|
708
|
-
|
|
709
|
-
## Additional Resources
|
|
710
|
-
|
|
711
|
-
- [rmcp Documentation](https://docs.rs/rmcp)
|
|
712
|
-
- [rmcp-macros Documentation](https://docs.rs/rmcp-macros)
|
|
713
|
-
- [Examples Repository](https://github.com/modelcontextprotocol/rust-sdk/tree/main/examples)
|
|
714
|
-
- [MCP Specification](https://spec.modelcontextprotocol.io/)
|
|
715
|
-
- [Rust Async Book](https://rust-lang.github.io/async-book/)
|