Introduces ExposurePolicy (option lit_mcp_exposure) deciding per ability whether it is a direct MCP tool, only reachable via mcp-adapter's execute-ability meta-tool, or disabled entirely (not registered with the Abilities API at all). Ability::isDirect() remains the default when no override applies. lit/guide can never be disabled or made indirect; lit/media-preview and lit/media-download (image/embedded-resource results) can never be made indirect, only direct or disabled. AbilityRegistrar and ServerRegistrar take an optional ExposurePolicy and use it to filter registered abilities / compute the direct tool list. IntegrationRegistry::directAbilityNames() is removed (superseded by ExposurePolicy::directNames()). InstructionsBuilder now also takes the policy and lists the currently direct tools by name (lit-<name>), noting the rest are reachable via mcp-adapter-execute-ability as lit/<name>. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
46 lines
1.0 KiB
PHP
46 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace LIT\MCP\Integrations;
|
|
|
|
use LIT\MCP\Abilities\Ability;
|
|
|
|
final class IntegrationRegistry
|
|
{
|
|
/** @var list<Integration> */
|
|
private array $integrations;
|
|
|
|
/** @var list<Ability>|null */
|
|
private ?array $abilities = null;
|
|
|
|
public function __construct(Integration ...$integrations)
|
|
{
|
|
$this->integrations = array_values($integrations);
|
|
}
|
|
|
|
/** @return list<Integration> */
|
|
public function available(): array
|
|
{
|
|
return array_values(array_filter(
|
|
$this->integrations,
|
|
static fn (Integration $integration): bool => $integration->isAvailable()
|
|
));
|
|
}
|
|
|
|
/** @return list<Ability> */
|
|
public function abilities(): array
|
|
{
|
|
if ($this->abilities === null) {
|
|
$abilities = [];
|
|
foreach ($this->available() as $integration) {
|
|
array_push($abilities, ...$integration->abilities());
|
|
}
|
|
|
|
$this->abilities = $abilities;
|
|
}
|
|
|
|
return $this->abilities;
|
|
}
|
|
}
|