1. Go to this page and download the library: Download seolinkmap/waasup 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/ */
seolinkmap / waasup example snippets
Slim\Factory\AppFactory;
use Slim\Psr7\Factory\{ResponseFactory, StreamFactory};
use Seolinkmap\Waasup\Storage\DatabaseStorage;
use Seolinkmap\Waasup\Tools\Registry\ToolRegistry;
use Seolinkmap\Waasup\Prompts\Registry\PromptRegistry;
use Seolinkmap\Waasup\Resources\Registry\ResourceRegistry;
use Seolinkmap\Waasup\Integration\Slim\SlimMCPProvider;
// Database connection
$pdo = new PDO('mysql:host=localhost;dbname=mcp_server', $user, $pass, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]);
// Initialize components
$storage = new DatabaseStorage($pdo, ['table_prefix' => 'mcp_']);
$toolRegistry = new ToolRegistry();
$promptRegistry = new PromptRegistry();
$resourceRegistry = new ResourceRegistry();
$responseFactory = new ResponseFactory();
$streamFactory = new StreamFactory();
// Configuration
$config = [
'server_info' => [
'name' => 'My MCP Server',
'version' => '0.0.7'
],
'auth' => [
'context_types' => ['agency'],
'base_url' => 'https://your-domain.com'
]
];
// Create MCP provider
$mcpProvider = new SlimMCPProvider(
$storage, $toolRegistry, $promptRegistry, $resourceRegistry,
$responseFactory, $streamFactory, $config
);
// Setup Slim app
$app = AppFactory::create();
$app->addErrorMiddleware(true, true, true);
// OAuth discovery endpoints
$app->get('/.well-known/oauth-authorization-server',
[$mcpProvider, 'handleAuthDiscovery']);
// Main MCP endpoint
$app->map(['GET', 'POST', 'OPTIONS'], '/mcp/{agencyUuid}[/{sessID}]',
[$mcpProvider, 'handleMCP'])
->add($mcpProvider->getAuthMiddleware());
$app->run();
use Seolinkmap\Waasup\Content\AudioContentHandler;
// In your tool
return [
'content' => [
['type' => 'text', 'text' => 'Here is the audio file:'],
AudioContentHandler::createFromFile('/path/to/audio.mp3', 'example.mp3')
]
];
// Request structured input from user
$requestId = $server->requestElicitation(
$sessionId,
'Please provide your contact information',
[
'type' => 'object',
'properties' => [
'name' => ['type' => 'string'],
'email' => ['type' => 'string', 'format' => 'email']
]
]
);