Skip to main content
Glama

CTX: Context as Code (CaC) tool

by context-hub
MIT License
235
  • Apple
  • Linux
UrlSourceFactory.php1.23 kB
<?php declare(strict_types=1); namespace Butschster\ContextGenerator\Source\Url; use Butschster\ContextGenerator\Source\Registry\AbstractSourceFactory; /** * Factory for creating UrlSource instances */ final readonly class UrlSourceFactory extends AbstractSourceFactory { #[\Override] public function getType(): string { return 'url'; } #[\Override] public function create(array $config): UrlSource { $this->logger?->debug('Creating URL source', [ 'path' => $this->dirs->getRootPath(), 'config' => $config, ]); if (!isset($config['urls']) || !\is_array($config['urls'])) { throw new \RuntimeException('URL source must have a "urls" array property'); } // Add headers validation and parsing $headers = []; if (isset($config['headers']) && \is_array($config['headers'])) { $headers = $config['headers']; } return new UrlSource( urls: $config['urls'], description: $config['description'] ?? '', headers: $headers, selector: $config['selector'] ?? null, tags: $config['tags'] ?? [], ); } }

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/context-hub/generator'

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