Skip to main content
Glama

OpenFGA MCP

SdkCompletionProvider.php1.79 kB
<?php declare(strict_types=1); namespace OpenFGA\MCP\Completions; use OpenFGA\MCP\Documentation\{DocumentationIndex, DocumentationIndexSingleton}; use Override; use PhpMcp\Server\Contracts\{CompletionProviderInterface, SessionInterface}; use Throwable; final readonly class SdkCompletionProvider implements CompletionProviderInterface { private DocumentationIndex $documentationIndex; public function __construct() { $this->documentationIndex = DocumentationIndexSingleton::getInstance(); } /** * Get completion suggestions for SDK names. * * @param string $currentValue * @param SessionInterface $session * @return array<string> */ #[Override] public function getCompletions(string $currentValue, SessionInterface $session): array { try { $this->documentationIndex->initialize(); $sdks = $this->documentationIndex->getSdkList(); // Also include general documentation types $sdks[] = 'general'; $sdks[] = 'authoring'; return $this->filterCompletions($sdks, $currentValue); } catch (Throwable) { return []; } } /** * Filter completions based on the current input value. * * @param array<string> $completions * @param string $currentValue * @return array<string> */ private function filterCompletions(array $completions, string $currentValue): array { if ('' === $currentValue) { return $completions; } return array_values(array_filter( $completions, static fn (string $completion): bool => str_starts_with(strtolower($completion), strtolower($currentValue)), )); } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/evansims/openfga-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server