Conversation
Register friendly snake_case and crove_post/post aliases for MCP tools (schedule_post, list_channels, list_posts) alongside upstream Postiz tool names, ensuring full ecosystem compatibility for DOSClaw and AI agents. Co-authored-by: Cursor <cursoragent@cursor.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_5e37a1e4-308e-492f-8099-c3d02425d33f) |
There was a problem hiding this comment.
Code Review
This pull request introduces MCP tool aliasing and multi-agent support to accommodate Crove OS ecosystem conventions alongside upstream Postiz conventions. It updates the architecture documentation, maps friendly snake_case and prefixed aliases to existing tools, and dynamically configures multiple agents (postiz, crove_post, and post) using brand configurations. The review feedback highlights two critical issues: first, assigning the same tool instance to multiple alias keys will fail because Mastra relies on the tool's internal name property, requiring the tools to be cloned and renamed; second, the MCP server registration incorrectly reuses the same postiz agent instance for all keys instead of retrieving the distinct agent instances from Mastra.
| const expandedTools = { ...directTools }; | ||
| for (const [originalName, aliasList] of Object.entries(aliases)) { | ||
| if (directTools[originalName]) { | ||
| for (const alias of aliasList) { | ||
| expandedTools[alias] = directTools[originalName]; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Assigning the same tool instance reference to multiple alias keys will not work as expected because Mastra registers tools using their internal name property. Since all aliases share the same reference, they will all have the original name (e.g., integrationSchedulePostTool), causing them to overwrite each other or fail to register under their alias names.
To fix this, we should shallow-clone each tool instance and update its internal name property to the respective alias.
| const expandedTools = { ...directTools }; | |
| for (const [originalName, aliasList] of Object.entries(aliases)) { | |
| if (directTools[originalName]) { | |
| for (const alias of aliasList) { | |
| expandedTools[alias] = directTools[originalName]; | |
| } | |
| } | |
| } | |
| const expandedTools = { ...directTools }; | |
| for (const [originalName, aliasList] of Object.entries(aliases)) { | |
| const originalTool = directTools[originalName]; | |
| if (originalTool) { | |
| for (const alias of aliasList) { | |
| const clonedTool = Object.create( | |
| Object.getPrototypeOf(originalTool), | |
| Object.getOwnPropertyDescriptors(originalTool) | |
| ); | |
| clonedTool.name = alias; | |
| expandedTools[alias] = clonedTool; | |
| } | |
| } | |
| } |
| agents: { | ||
| postiz: agent, | ||
| crove_post: agent, | ||
| post: agent, | ||
| }, |
There was a problem hiding this comment.
In mastra.service.ts, three distinct agent instances (postiz, crove_post, and post) are created with their respective IDs and names. However, here you are registering the same postiz agent instance (agent) under all three keys. This causes the other agents to report their ID and name as postiz instead of their respective values.
We should retrieve the correct agent instance for each key from mastra.
| agents: { | |
| postiz: agent, | |
| crove_post: agent, | |
| post: agent, | |
| }, | |
| agents: { | |
| postiz: mastra.getAgent('postiz'), | |
| crove_post: mastra.getAgent('crove_post'), | |
| post: mastra.getAgent('post'), | |
| }, |
What kind of change does this PR introduce?
Feature & MCP Ecosystem Standard
Why was this change needed?
Implements dual-registration and aliasing for Crove Post MCP tools:
schedule_post,list_channels,list_posts,list_groups,update_post_settings,trigger_integration,validate_integration,upload_from_url) and namespaced aliases (crove_post_*,post_*,postiz_*) alongside original upstream tool names (integrationSchedulePostTool,integrationList,postsListTool).postiz,crove_post, andpostagent IDs on Mastra MCP server.docs/architecture.md(Section 8.2).Checklist:
Note
Medium Risk
Changes expand the external MCP tool and agent contract; risk is mostly compatibility and client confusion, not new business logic, since aliases reuse existing tool handlers.
Overview
MCP clients can call the same Crove Post capabilities under multiple tool names without breaking upstream Postiz names (
integrationSchedulePostTool,postsListTool, etc.).loadTools()now registers snake_case and prefixed aliases (schedule_post,crove_post_*,post_*,postiz_*) that point to the same tool implementations.Mastra and the MCP server expose three agent IDs (
postiz,crove_post,post) built from the same agent factory with a configurableagentIdand brand-aware prompts (generic “application” wording instead of hardcoded Postiz).Claude directory-facing MCP continues to hide media-generation tools; the hide list now includes the new alias names so those tools stay off that endpoint.
docs/architecture.mdadds Section 8.2 with the tool name / aliasing catalog for Tier 2 MCP.Reviewed by Cursor Bugbot for commit df1e1cb. Bugbot is set up for automated code reviews on this repo. Configure here.