feat: Add weDocs Abilities API and MCP integration guide#313
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
…tes, and MCP guide Agent-Logs-Url: https://github.com/weDevsOfficial/wedocs-plugin/sessions/3697e186-f7d9-4519-8840-6e107565d440 Co-authored-by: iftakharul-islam <88052038+iftakharul-islam@users.noreply.github.com>
Agent-Logs-Url: https://github.com/weDevsOfficial/wedocs-plugin/sessions/3697e186-f7d9-4519-8840-6e107565d440 Co-authored-by: iftakharul-islam <88052038+iftakharul-islam@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
iftakharul-islam
May 12, 2026 07:38
View session
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.
Summary
Introduces a centralized Abilities API that lets MCP clients (and any external integration) discover exactly what the currently authenticated user is allowed to do before making mutating REST calls.
Changes
New files
includes/API/AbilitiesPolicy.phpglobal_abilities(),doc_abilities($id),resolve_read_access($post), andcan($key)static helpers. Exposeswedocs_global_abilitiesandwedocs_doc_abilitiesfilters so weDocs Pro and third-party plugins can extend the ability set.includes/API/AbilitiesApi.phpGET /wp/v2/docs/abilities(global) andGET /wp/v2/docs/{id}/abilities(per-doc). Both endpoints are publicly accessible and returnfalsefor all protected abilities when called without credentials. JSON schemas included.docs/mcp-integration.mdModified files
includes/API/API.phpAbilitiesApiin constructor. Delegatessortable_item_permissions_check,delete_item_permissions_check,get_promotional_notice_check,ai_generate_permissions_check,ai_upload_permissions_check, andget_promotional_notice()toAbilitiesPolicy.includes/API/SettingsApi.phpget_items_permissions_checkandcreate_item_permissions_checkdelegate toAbilitiesPolicy::can('settings.read/write').Abilities matrix (summary)
docs.read,docs.search,summary.read/generate,feedback.submit,contributors.readtrue)docs.create/edit/delete/publish/sort,ai.generate,summary.save/deleteedit_docsdocs.read_privateread_private_docsdocs.edit_othersedit_others_docsdocs.publishpublish_docssettings.read/write,ai.configure,notices.managemanage_optionsai.upload_imageedit_docs+upload_files+ Pro activehelpfulness.voteBackward compatibility
All existing REST endpoint behaviors are unchanged. The permission_callbacks now delegate to
AbilitiesPolicywhich resolves the samecurrent_user_can()calls as before.