PHP code example of wp-media / mcp-oauth

1. Go to this page and download the library: Download wp-media/mcp-oauth library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wp-media / mcp-oauth example snippets


add_action( 'plugins_loaded', static function () {
	\WPMedia\MCP\OAuth\Bootstrap::instance();
} );

add_filter( 'wpmedia_mcp_oauth_server_enabled', '__return_false' );

add_filter( 'wpmedia_mcp_oauth_trusted_publishers', function ( array $publishers ) {
	$publishers['my-client'] = [
		'client_ids' => [ 'https://example.com/oauth/client-metadata' ],
		'host'       => 'example.com',
	];

	return $publishers;
} );

add_filter( 'wpmedia_mcp_oauth_allow_untrusted_providers', '__return_false' );

add_filter( 'wpmedia_mcp_oauth_cimd_fetch_limit', function ( int $max ) {
	return 100;
} );

add_filter( 'wpmedia_mcp_oauth_observability_handler', function () {
	return \WPMedia\MCP\OAuth\Transport\McpObservabilityHandler::class;
} );
nginx
location = /.well-known/oauth-protected-resource {
    try_files $uri /index.php?$args;
}

location = /.well-known/oauth-authorization-server {
    try_files $uri /index.php?$args;
}