Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
<?php
declare(strict_types=1);
namespace App\Support\Mcp;
use App\Actions\Mcp\ListChatGptEgressRanges;
use App\Enums\Mcp\Method;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\IpUtils;
class ChatGptMcpClient
{
/**
* JSON-RPC methods ChatGPT may call without a token: connecting and
* reading the tool list. A tool call always needs a token.
*/
private const DISCOVERY_METHODS = [
Method::Initialize->value,
Method::NotificationsInitialized->value,
Method::Ping->value,
Method::ToolsList->value,
];
/**
* Passport blanks the Authorization header when it refuses a token, so
* whether the client sent one is recorded before authentication runs.
*/
public const TOKEN_SENT = 'mcp.token_sent';
/**
* ChatGPT, told by the egress ranges OpenAI publishes, the identification
* OpenAI documents. Any other client, Claude and local ones included,
* keeps the plain OAuth flow.
*/
public static function matches(Request $request): bool
{
return IpUtils::checkIp((string) $request->ip(), ListChatGptEgressRanges::execute());
}
/**
* ChatGPT connecting or listing tools before the user signed in. A
* request that carries a token, valid or not, is always authenticated.
*/
public static function allowsAnonymousDiscovery(Request $request): bool
{
return ! $request->attributes->get(self::TOKEN_SENT, filled($request->bearerToken()))
&& collect(self::DISCOVERY_METHODS)->containsStrict($request->json('method'))
&& self::matches($request);
}
}