Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
256f445
Add MCP package
eoigal Sep 8, 2025
b505c66
Add MCP package
eoigal Sep 8, 2025
dd0a61a
changelog
eoigal Sep 8, 2025
db3c249
Add Jetpack MCP package with AbilityRegistry port
eoigal Sep 8, 2025
6700ef8
Fix linting errors in MCP package
eoigal Sep 8, 2025
3efab21
Fix remaining critical linting errors
eoigal Sep 8, 2025
2a43719
Fix PHP 7.3 compatibility issues
eoigal Sep 8, 2025
0ee6dde
Fix all PHP linting warnings in MCP package
eoigal Sep 8, 2025
a977a2c
fix lint errors
eoigal Sep 8, 2025
da5b6c2
Fix syntax errors introduced by PHPCBF
eoigal Sep 8, 2025
fa8fa83
Fix remaining syntax errors in UserNotificationsInboxExecutor
eoigal Sep 8, 2025
b054812
Fix final syntax errors in remaining MCP executor files
eoigal Sep 8, 2025
f3aedc0
Fix final syntax errors in UserConnectionsExecutor
eoigal Sep 8, 2025
7625ef4
Fix indentation errors in PostsSearchExecutor
eoigal Sep 9, 2025
d48509b
Fix all remaining PHPCS coding standards violations
eoigal Sep 9, 2025
c489171
Fix PHP 7.4 compatibility issues
eoigal Sep 9, 2025
ee15d71
Fix remaining PHPCS coding standards violations
eoigal Sep 9, 2025
9246914
Fix Phan static analysis issues
eoigal Sep 9, 2025
2bdba81
Fix remaining Phan static analysis issues
eoigal Sep 9, 2025
396e2de
Fix duplicate Phan suppressions in Ability classes
eoigal Sep 9, 2025
2ec0bb7
Fix final Phan static analysis issues
eoigal Sep 9, 2025
4c99d46
Comprehensive Phan static analysis fixes for AbilitiesRegistry
eoigal Sep 9, 2025
07cb102
Fix final batch of Phan static analysis issues
eoigal Sep 9, 2025
51555d1
Fix comprehensive final batch of Phan static analysis issues
eoigal Sep 9, 2025
0dfad17
Fix final Phan type issue in UserConnectionsExecutor
eoigal Sep 9, 2025
291e4b1
Remove empty Phan baseline file
eoigal Sep 9, 2025
946d165
Add MCP package initialization
eoigal Sep 9, 2025
c553d98
Remove redundant package_init method
eoigal Sep 9, 2025
b653ea6
Fix PHPCS and Phan issues in class-mcp.php
eoigal Sep 9, 2025
9224779
Fix MCP package initialization
eoigal Sep 9, 2025
0feb5ad
Add MCP package to main Jetpack plugin dependencies
eoigal Sep 9, 2025
fa6212f
remove check on wp_abilities_api_init
eoigal Sep 9, 2025
0a10ecd
Remove Phan suppression comments from AbilityRegistry calls
lezama Sep 10, 2025
3294b67
remove check on is_automattican
eoigal Sep 10, 2025
cb4a8bb
remove sandbox handling of user ID - seems redundant
eoigal Sep 10, 2025
a07af16
add get_current_user_id method
eoigal Sep 10, 2025
070f303
add filters to abilities executors
eoigal Sep 10, 2025
f2fa492
fix phan errors
eoigal Sep 10, 2025
7c15a02
add casting and address some minor feedback
eoigal Sep 10, 2025
99c3b7c
add filter for jetpack_mcp_get_ordered_blogs_of_user
eoigal Sep 11, 2025
8de9cbc
Add Abilities API dependency
eoigal Sep 11, 2025
e4bf918
update abilities api version
eoigal Sep 11, 2025
f587d40
fix phan errors
eoigal Sep 11, 2025
8fc05d9
fix composer issues
eoigal Sep 11, 2025
126e429
fix composer issue
eoigal Sep 11, 2025
8ed0efd
try to resolve php version issue
eoigal Sep 11, 2025
61efd26
move autoloader to suggest
eoigal Sep 11, 2025
376f2a8
update jp composer.lock
eoigal Sep 11, 2025
ebfa955
tie jetpack mcp to php 7.4+
eoigal Sep 11, 2025
77eb148
update composer again to make jetpack-mcp optional (depending on php …
eoigal Sep 11, 2025
e4d3ddc
more composer meddling
eoigal Sep 12, 2025
cbb97d2
fix phan
eoigal Sep 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions projects/packages/mcp/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Files not needed to be distributed in the package.
.gitattributes export-ignore
.github/ export-ignore
package.json export-ignore

# Files to include in the mirror repo, but excluded via gitignore
# Remember to end all directories with `/**` to properly tag every file.
# /src/js/example.min.js production-include
/vendor/wordpress/abilities-api/** production-include

# Files to exclude from the mirror repo, but included in the monorepo.
# Remember to end all directories with `/**` to properly tag every file.
.gitignore production-exclude
changelog/** production-exclude
.phpcs.dir.xml production-exclude
tests/** production-exclude
.phpcsignore production-exclude
2 changes: 2 additions & 0 deletions projects/packages/mcp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor/
node_modules/
13 changes: 13 additions & 0 deletions projects/packages/mcp/.phan/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* This configuration will be read and overlaid on top of the
* default configuration. Command-line arguments will be applied
* after this file is read.
*
* @package automattic/jetpack-mcp
*/

// Require base config.
require __DIR__ . '/../../../../.phan/config.base.php';

return make_phan_config( dirname( __DIR__ ) );
24 changes: 24 additions & 0 deletions projects/packages/mcp/.phpcs.dir.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<ruleset>

<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="jetpack-mcp" />
</property>
</properties>
</rule>
<rule ref="Jetpack.Functions.I18n">
<properties>
<property name="text_domain" value="jetpack-mcp" />
</properties>
</rule>

<rule ref="WordPress.Utils.I18nTextDomainFixer">
<properties>
<property name="old_text_domain" type="array" />
<property name="new_text_domain" value="jetpack-mcp" />
</properties>
</rule>

</ruleset>
7 changes: 7 additions & 0 deletions projects/packages/mcp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

92 changes: 92 additions & 0 deletions projects/packages/mcp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Jetpack MCP Package

Provides MCP (Model Context Protocol) ability registry and related functionality for Jetpack. This package enables cross-platform MCP support across WPCOM, Atomic, and self-hosted Jetpack sites.

## Features

- **Complete Abilities Registry**: Port of the WordPress.com MCP Abilities Registry
- **Cross-Platform Support**: Works on WPCOM, Atomic, and self-hosted sites
- **Memory Efficient**: Configuration-driven architecture with lazy loading
- **Extensible**: Easy to add new abilities and executors
- **Integration Ready**: Powers site settings and MCP server functionality

## What's Included

This package contains the complete AbilitiesRegistry system:

- **Registry/AbilityRegistry.php** - Main registry class with lookup methods
- **abilities-config.php** - Central configuration for all abilities
- **Abilities/** - Lightweight ability classes (User, Post, Analytics, etc.)
- **Executors/** - Heavy execution logic classes
- **Interfaces/** - Contracts for abilities and executors
- **Traits/** - Shared functionality and user context
- **Helpers/** - Utility classes for common operations
- **Factories/** - On-demand executor creation with caching

## Usage

### Getting MCP Abilities

```php
use Automattic\Jetpack\AbilitiesRegistry\Registry\AbilityRegistry;

// Get all resources for site-level server
$resources = AbilityRegistry::get_resources_for_server( 'site-level' );

// Get all tools for site-level server
$tools = AbilityRegistry::get_tools_for_server( 'site-level' );

// Get all prompts for site-level server
$prompts = AbilityRegistry::get_prompts_for_server( 'site-level' );

// Get metadata for a specific ability
$metadata = AbilityRegistry::get_metadata( 'wpcom-mcp/posts-search' );
```

### Available Abilities

The package includes these ability categories:

- **User Abilities**: Profile, sites, achievements, connections, notifications, security, subscriptions
- **Post Abilities**: Search, retrieval, and management
- **Analytics Abilities**: Site statistics and metrics
- **Example Abilities**: Templates for creating new abilities
Comment on lines +46 to +53
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a big fan of this information being included in READMEs which will quickly get outdated.
Saying that because I already added a "Comment" related a "SiteCommentsSearch" ability in a separate "Comment Abilities" category [192057-ghe-Automattic/wpcom/files].


### Integration

This package integrates with:
- **Site Settings API**: Provides MCP abilities to the site settings endpoint
- **MCP Servers**: Used by MCP servers to determine available abilities
- **WordPress Admin**: Powers MCP ability configuration in WordPress admin

## Architecture

The Abilities Registry uses a memory-efficient, configuration-driven architecture:

- **Abilities**: Lightweight classes that handle registration and delegate execution
- **Executors**: Heavy classes containing the actual execution logic (only loaded when needed)
- **Registry**: Configuration-driven system that eliminates hardcoded ability names
- **Factory**: Creates executor instances on-demand with caching

## How to install mcp

### Installation From Git Repo

This package is part of the Jetpack monorepo and is automatically available when Jetpack is installed.

## Contribute

## Get Help

## Using this package in your WordPress plugin

If you plan on using this package in your WordPress plugin, we would recommend that you use [Jetpack Autoloader](https://packagist.org/packages/automattic/jetpack-autoloader) as your autoloader. This will allow for maximum interoperability with other plugins that use this package as well.

## Security

Need to report a security vulnerability? Go to [https://automattic.com/security/](https://automattic.com/security/) or directly to our security bug bounty site [https://hackerone.com/automattic](https://hackerone.com/automattic).

## License

mcp is licensed under [GNU General Public License v2 (or later)](./LICENSE.txt)

Empty file.
4 changes: 4 additions & 0 deletions projects/packages/mcp/changelog/initial-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

Initial version.
71 changes: 71 additions & 0 deletions projects/packages/mcp/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "automattic/jetpack-mcp",
"description": "Adds MCP tools support",
"type": "jetpack-library",
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.4",
"wordpress/abilities-api": "^0.1.1"
},
"config": {
"allow-plugins": {
"automattic/jetpack-autoloader": true
}
},
"require-dev": {
"yoast/phpunit-polyfills": "^4.0.0",
"automattic/jetpack-changelogger": "@dev",
"automattic/phpunit-select-config": "@dev",
"phpunit/phpunit": "^9.6"
},
"autoload": {
"classmap": [
"src/"
]
},
"scripts": {
"build-development": "echo 'Add your build step to composer.json, please!'",
"build-production": "echo 'Add your build step to composer.json, please!'",
"phpunit": [
"phpunit-select-config phpunit.#.xml.dist --colors=always"
],
"test-coverage": [
"php -dpcov.directory=. ./vendor/bin/phpunit-select-config phpunit.#.xml.dist --coverage-php \"$COVERAGE_DIR/php.cov\""
],
"test-php": [
"@composer phpunit"
]
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/WordPress/abilities-api"
},
{
"type": "path",
"url": "../../packages/*",
"options": {
"monorepo": true
}
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"autotagger": false,
"branch-alias": {
"dev-trunk": "0.1.x-dev"
},
"changelogger": {
"link-template": "https://github.com/Automattic/jetpack-mcp/compare/v${old}...v${new}"
},
"mirror-repo": "Automattic/jetpack-mcp",
"textdomain": "jetpack-mcp",
"version-constants": {
"::PACKAGE_VERSION": "src/class-mcp.php"
}
},
"suggest": {
"automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package."
}
}
24 changes: 24 additions & 0 deletions projects/packages/mcp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@automattic/jetpack-mcp",
"version": "0.1.0-alpha",
"private": true,
"description": "Adds MCP tools support",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/mcp/#readme",
"bugs": {
"url": "https://github.com/Automattic/jetpack/labels/[Package] Mcp"
},
"repository": {
"type": "git",
"url": "https://github.com/Automattic/jetpack.git",
"directory": "projects/packages/mcp"
},
"license": "GPL-2.0-or-later",
"author": "Automattic",
"scripts": {
"build": "echo 'Not implemented.'",
"build-js": "echo 'Not implemented.'",
"build-production": "echo 'Not implemented.'",
"build-production-js": "echo 'Not implemented.'",
"clean": "true"
}
}
36 changes: 36 additions & 0 deletions projects/packages/mcp/phpunit.11.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/php/bootstrap.php"
cacheDirectory=".phpunit.cache"
colors="true"
executionOrder="depends"
beStrictAboutOutputDuringTests="true"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
failOnDeprecation="true"
failOnEmptyTestSuite="true"
failOnPhpunitDeprecation="true"
failOnNotice="true"
failOnRisky="true"
failOnWarning="true"
>
<testsuites>
<testsuite name="main">
<directory suffix="Test.php">tests/php</directory>
</testsuite>
</testsuites>

<source>
<include>
<!-- Better to only include "src" than to add "." and then exclude "tests", "vendor", and so on, as PHPUnit still scans the excluded directories. -->
<!-- Add additional lines for any files or directories outside of src/ that need coverage. -->
<directory suffix=".php">src</directory>
</include>
</source>
<coverage ignoreDeprecatedCodeUnits="true">
</coverage>
</phpunit>
1 change: 1 addition & 0 deletions projects/packages/mcp/phpunit.12.xml.dist
1 change: 1 addition & 0 deletions projects/packages/mcp/phpunit.8.xml.dist
17 changes: 17 additions & 0 deletions projects/packages/mcp/phpunit.9.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="tests/php/bootstrap.php"
cacheResultFile=".phpunit.cache/test-results"
colors="true"
executionOrder="depends"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
failOnWarning="true"
>
<testsuites>
<testsuite name="main">
<directory suffix="Test.php">tests/php</directory>
</testsuite>
</testsuites>
</phpunit>
Loading
Loading