RibbonSmith
Allows adding custom ribbon buttons in Dynamics 365 that trigger SAP integrations, such as calling JavaScript functions to send data to SAP.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@RibbonSmith Add a 'Send Email' button to the contact ribbon."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
RibbonSmith talks to your Dataverse environment with plain Web API calls under
your own identity. Nothing is installed in the environment; a small
unmanaged container solution (RibbonEditMCP_<entity>) is created per edited
entity to carry the customizations — the same "workspace solution" mechanism
the Ribbon Workbench used.
Why
Hand-writing RibbonDiffXml fails easily: ids, locations, template aliases and
element order must all be exactly right, and the feedback loop (import → publish
→ check) is slow. RibbonSmith closes the loop for an agent:
Grounding — read tools return the real composed ribbon (every valid location, control id, command and sequence) as compact JSON.
Declarative writes —
ribbon_add_button& friends generate schema-correct XML; the escape hatchribbon_edit_diffaccepts raw XML for advanced cases.Validation before anything touches the server — references, locations, element order, web-resource existence, unsupported-entity blocklist.
Transactional publish — validate → backup → async import → publish → verify the change is actually live by re-reading the composed ribbon.
Instant revert — every checkout and publish snapshots a restorable backup.
Related MCP server: mcp-dynamics-365
Setup
Prerequisites: Node.js ≥ 20 and a Dataverse user with permission to create/ import solutions and publish (e.g. System Administrator / System Customizer).
npm install
npm run buildRegister with Claude Code:
claude mcp add ribbonsmith --env RIBBON_MCP_ENV_URL=https://yourorg.crm4.dynamics.com -- node <absolute-path>/ribbonsmith/dist/index.jsOr copy .mcp.json.example to your project's .mcp.json.
Authentication
On the first call that needs the network, RibbonSmith acquires a token using
the first strategy that works (override with RIBBON_MCP_AUTH):
Strategy |
| How it works |
Service principal |
| Set |
Azure CLI |
| Reuses your |
Browser SSO |
| Opens your browser for a normal Microsoft Entra sign-in (auth code + PKCE on a localhost loopback), then caches and silently refreshes tokens — the same sign-in experience as Microsoft's official Dataverse MCP local proxy. |
In auto mode (default) the order is: clientsecret (if env vars present) →
azcli (if available) → interactive. Tokens from the interactive flow are
cached in the workspace directory; delete token-cache.json to sign out.
The interactive flow uses the public client id Microsoft ships in its own
Dataverse QuickStart samples (51f81489-…), requesting the standard
user_impersonation delegated permission — so unlike the official Dataverse
MCP server's proxy, no tenant admin consent or Power Platform admin center
enablement is required. If your tenant restricts that client id, register
your own public client app (redirect URI http://localhost, Dynamics CRM
user_impersonation permission) and set RIBBON_MCP_CLIENT_ID.
The edit lifecycle
ribbon_checkout ──► edit tools (local only) ──► ribbon_preview_diff ──► ribbon_publish
│ │
└── backup (restorable) backup (pre-publish) ──────────────┘
ribbon_restore_backup ◄── revert anytimeribbon_checkout{ entity: "account" }— snapshots the current ribbon customizations (backup) and creates a local working copy of the entity'sRibbonDiffXml.Edit locally — none of these touch the environment:
ribbon_get_structure(your map of valid targets),ribbon_add_button,ribbon_hide_control,ribbon_customize_command(copy an out-of-the-box command into the diff to modify it),ribbon_edit_diff(validated raw XML),ribbon_remove_customization,ribbon_discard.ribbon_preview_diff— the exact XML that will be published + full validation report.ribbon_publish— validates, backs up, submits an async solution import, publishes, then verifies the controls are live (or hidden) in the freshly retrieved composed ribbon. Server-side imports take 1–3 minutes; if the import outlastswaitSeconds(default 120), the tool returnsstatus: "importing"— callribbon_publish_statusto complete it.ribbon_restore_backup— re-import any backup and publish: full revert.
Working files and backups live under ~/.dataverse-ribbon-mcp/<env-host>/
(override with RIBBON_MCP_WORKSPACE). Everything is a plain file; worst case,
import a backup zip manually through the maker portal.
Example: agent session
User: Add a "Send to SAP" button on the account form that calls
new_/js/sap.js: sendToSap(recordId), only for existing records.
ribbon_checkout { entity: "account" }
ribbon_get_structure { entity: "account", location: "Form" }
ribbon_add_button {
entity: "account",
id: "new_.account.SendToSap.Button",
location: "Mscrm.Form.account.MainTab.Save.Controls._children",
label: "Send to SAP",
sequence: 45,
modernImage: "ExportToExcel",
action: { type: "JavaScriptFunction", library: "new_/js/sap.js",
functionName: "sendToSap",
parameters: [{ type: "CrmParameter", value: "FirstPrimaryItemId" }] },
enableRules: [{ type: "FormStateRule", id: "new_.account.SendToSap.Existing",
state: "Existing", default: true }]
}
ribbon_preview_diff { entity: "account" }
ribbon_publish { entity: "account" }
→ { status: "published", verification: { status: "verified" }, backupId: "..." }Tool reference
Tool | Network | Purpose |
| yes | WhoAmI, checkouts, recent backups |
| yes | Begin editing; snapshot backup + local working copy |
| cached | Composed ribbon as JSON (tabs → groups → controls) |
| cached | One command's actions + rules (for reuse/customization) |
| no | Current working |
| no* | Declarative button/command/rules/labels |
| no* |
|
| no* | Copy an OOTB command into the diff |
| no* | Replace the whole working diff (validated) |
| no | Remove one element from the diff by id |
| no* | Diff XML + validation report |
| yes | Validate → backup → async import → publish → verify |
| yes | Poll/complete a pending publish or restore import |
| no | Reset working copy to last exported state |
| no | List restorable snapshots |
| yes | Re-import a snapshot + publish (revert) |
* validation may consult the cached composed ribbon and check web-resource existence over the network.
Safety model
Every
ribbon_checkoutand everyribbon_publishwrites a timestamped solution zip before any change;ribbon_restore_backupre-imports it.Publishes only ever touch the
RibbonDiffXmlnode inside a fresh export of the container solution — entity metadata is never round-tripped (the entity ships as anunmodified="1"shell).Validation blocks publishes on: malformed XML, wrong element order, missing
Mscrm.Templates, duplicate ids, unresolved command/rule/label references, missing web resources, unsupported system entities.Import failures surface the importjob's own error text; imports are transactional server-side, so a failed import changes nothing.
Status & limitations
Entity ribbons: stable. The full lifecycle (add → publish → verify → hide → publish → verify → restore → verify) is covered by a live E2E suite (
test/e2e/run-e2e.ts) plus 56 unit tests over a real composed ribbon.Application ribbon (
APPLICATION): EXPERIMENTAL. Implemented per the documented schema (component type 50, diff underImportExportXml) but not yet covered by the live E2E suite. Keep backup ids at hand.Classic
RibbonDiffXmlonly: commands built with the modern Power Apps command designer (Power Fx /appaction) are not read or written. Classic customizations render fine in Unified Interface.Flyout/Menu/group/tab creation goes through
ribbon_edit_diff(raw XML).One editor per entity at a time is assumed (shared container solution).
Development
npm test # unit tests (vitest)
npx tsc --noEmit # typecheck
npx tsx test/e2e/run-e2e.ts https://yourorg.crm4.dynamics.com
# live E2E — modifies + restores the
# 'contact' ribbon in that environment!docs/ARCHITECTURE.md — module map, data flows, why async import, testing strategy.
docs/RIBBON-CONCEPTS.md — a primer on ribbon XML (composed ribbon vs diff, locations, commands/rules, Command Checker).
Acknowledgments
RibbonSmith re-implements, as MCP tools, the declarative editing model pioneered by Scott Durow's Ribbon Workbench — for years the way humans customized Dynamics ribbons safely. This project shares no code with it; the mechanism (workspace solution → RibbonDiffXml splice → import → publish) was studied from its observable behavior and from Microsoft's public documentation of the ribbon schemas and solution APIs.
License
Available Tools
16 toolsribbon_add_buttonAdd a button (declarative)A
Add a button with its command, rules and labels to the local working copy in one declarative call. The server generates schema-correct XML with proper id conventions, $LocLabels:/$webresource: prefixes and element order. Requires ribbon_checkout first. Get the location from ribbon_get_structure (a group id + '.Controls._children').
Inputs: id (required), label (required), entity (required), location (required), +13 more.
ribbon_checkoutCheck out a ribbon for editingA
Begin editing the ribbon of an entity (or the application ribbon). Creates/reuses a temporary unmanaged solution containing only the entity shell, exports it, stores the export as a restorable backup, and initializes a local working copy of the entity's RibbonDiffXml. All edit tools operate on this local copy; nothing changes in the environment until ribbon_publish.
Inputs: entity (required), environment.
ribbon_customize_commandCustomize an existing commandA
Copy an out-of-the-box command definition from the composed ribbon into the working diff so it can be modified (the Ribbon Workbench 'Customise Command' operation). Rule definitions that are core (Mscrm.*) stay as id references; non-core rule bodies are copied too. After copying, edit the returned XML with ribbon_edit_diff, or publish as-is to pin the current behavior.
Inputs: entity (required), commandId (required), environment.
ribbon_discardDiscard local changesA
Reset the working copy to the last exported/published state. Does not touch the environment.
Inputs: entity (required), environment.
ribbon_edit_diffReplace the working RibbonDiffXmlA
Escape hatch for anything the declarative tools don't cover (flyouts, menus, groups, tabs, command edits): replace the entire working RibbonDiffXml with the supplied XML. The XML is parsed, normalized to schema element order and validated; errors are returned without saving unless 'force' is set. Read the current state first with ribbon_get_diff.
Inputs: entity (required), ribbonDiffXml (required), force, environment.
ribbon_get_commandGet a command definitionA
Return the full definition of a command from the composed ribbon: its actions, enable rules and display rules (with rule bodies where they are defined). Use this before customizing or reusing an out-of-the-box command.
Inputs: entity (required), commandId (required), environment.
ribbon_get_diffGet the working RibbonDiffXmlA
Return the current working copy of the entity's RibbonDiffXml (requires checkout) — the complete declarative customization state that will be published.
Inputs: entity (required), environment.
ribbon_get_structureGet composed ribbon structureA
Return the entity's fully composed ribbon (base + all customizations) as a compact JSON tree of tabs, groups and controls with ids, commands, labels, sequences and template aliases. This is the ground truth for valid Location values ('.Controls._children'), ids to hide, commands to reuse, and sequence placement. Filter by location and optionally by tab/group id to keep output small.
Inputs: entity (required), tabId, groupId, refresh, +2 more.
ribbon_hide_controlHide a ribbon controlA
Remove an existing (usually out-of-the-box) control from the ribbon via HideCustomAction in the local working copy. The control id comes from ribbon_get_structure. Note: per Microsoft docs, for commands you own, an always-false display rule is often preferable; HideCustomAction removes the node others may target.
Inputs: entity (required), controlId (required), environment.
ribbon_list_backupsList ribbon backupsA
List backup zips (taken at checkout and before every publish) that ribbon_restore_backup can re-import.
Inputs: entity, environment.
ribbon_preview_diffPreview and validate pending changesA
Show the working RibbonDiffXml alongside the full validation report (schema order, id uniqueness, command/rule/label references, location existence against the real ribbon, web resource existence) without touching the environment. Always call before ribbon_publish.
Inputs: entity (required), environment.
ribbon_publishPublish the working diff to the environmentA
Validate, back up the current server state, then write the working RibbonDiffXml to the environment: splice into a fresh solution export, submit an async solution import, wait up to waitSeconds, then PublishXml and verify the changes are live by re-reading the composed ribbon. If the import outlasts the wait, returns status 'importing' — finish with ribbon_publish_status. Returns the backup id for ribbon_restore_backup.
Inputs: entity (required), environment, waitSeconds.
ribbon_publish_statusCheck / complete a pending publish or restoreA
Poll the async solution import started by ribbon_publish or ribbon_restore_backup. When the import has finished, this completes the operation: publishes the ribbon, verifies it live, and syncs local state. Call repeatedly (imports typically take 1-3 minutes) until status is 'published'/'restored'.
Inputs: entity (required), environment.
ribbon_remove_customizationRemove an element from the working diffA
Remove a CustomAction, HideCustomAction, CommandDefinition, rule or LocLabel from the local working copy by its Id. Un-hides / un-customizes after the next publish. Use ribbon_get_diff to list current ids.
Inputs: id (required), entity (required), environment.
ribbon_restore_backupRestore a ribbon backupA
Re-import a backup solution zip (restoring the entity's RibbonDiffXml to that point in time), publish, and reset the local working copy to match. This is the revert mechanism. Like ribbon_publish, the import runs async — if it outlasts waitSeconds, finish with ribbon_publish_status.
Inputs: backupId (required), environment, waitSeconds.
ribbon_statusRibbon workspace statusA
Show the connection (WhoAmI), current checkouts with dirty state, and recent backups for a Dataverse environment. Start here to orient yourself.
Inputs: environment.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Each tool targets a distinct aspect of the ribbon editing workflow: status, checkout, inspection, editing actions, validation, publishing, and backup/restore. Even the get_* tools return different data (structure, command, diff), leaving no ambiguity about which tool to call.
All tools share the 'ribbon_' prefix and use snake_case with a verb_noun structure (get_structure, add_button, restore_backup). Single-word verbs like status, checkout, and publish are also clear and consistent with the overall pattern, with no mixed conventions.
With 16 tools, the set is slightly above the typical 3-15 range, but each tool maps to a distinct step in the ribbon lifecycle (checkout, edit, validate, publish, backup). The count is justified by the complexity of Dataverse ribbon customization and no tool feels redundant.
The tool set provides full lifecycle coverage: start (status, checkout), inspect (get_*), modify (add, hide, customize, edit, remove), validate (preview_diff), publish (publish, publish_status), and revert (backups, restore). The escape hatch 'ribbon_edit_diff' covers any edge cases, leaving no obvious dead ends.
Maintenance
Related MCP Connectors
Debug, build, and manage Power Automate cloud flows with AI agents
Read-only finance and operations controls for AI agents with evidence and safe next actions.
Governed app access for AI agents: 1,000+ apps & 12,000+ tools via Code Mode MCP.
Zendesk configuration management for AI agents: propose, review, apply and roll back changes.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI agents to query, inspect, and manage Microsoft Dataverse records, metadata, schema, forms, views, and Power Platform environments via the Dataverse OData Web API.9774 PyPI3MIT
- AlicenseBqualityDmaintenanceEnables AI agents to perform CRUD operations, query data, fetch schemas, and execute custom operations on Microsoft Dynamics 365 CRM entities.1021 npm2MIT
- AlicenseCqualityDmaintenanceEnables AI assistants to edit Power Automate cloud flows live, including reading/writing flow definitions, managing connectors, and syncing changes, with no admin rights or app registration required.181MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI clients to securely access and query Microsoft Dynamics 365 data through natural language, supporting data analysis, reporting, and business workflows.-