use Superconductor\Support\Facades\SchemaManager;
// Get the active protocol version
$version = config('mcp.versions.active'); // '2025-03-26'
// Check available versions
$available = config('mcp.versions.available');
// ['2025-03-26' => true, '2024-11-05' => true]
// Schema objects are automatically selected based on protocol version
// Tools, Resources, and Prompts use version-specific Data classes
// Superconductor\Schema\Definitions\V20250326\Tools\Tool
// extends Superconductor\Schema\Definitions\V20241105\Tools\Tool
// This ensures backward compatibility while adding new features
use Superconductor\Support\Facades\SessionManager;
// Using the helper function (recommended)
generate_mcp_session('user-123');
// Or via the Facade
$session = SessionManager::createOrLoad('user-123');
// Sessions are automatically created and managed
// The session object extends AbstractMCPSession
// Create a session (uses cached driver by default)
generate_mcp_session('demo-session');
// Get protocol version (from config, defaults to 2025-03-26)
$version = config('mcp.versions.active');
// List available capabilities using helper functions
$tools = list_tools();
$resources = list_resources();
$prompts = list_prompts();
// Or specify a protocol version
$tools = list_tools('2024-11-05');
namespace App\MCP\Tools;
use Superconductor\Capabilities\Tools\BaseTool;
use Superconductor\Support\Attributes\ToolCall;
#[ToolCall(
tool: 'weather_lookup',
description: 'Get current weather for a location',
inputSchema: [
'type' => 'object',
'properties' => [
'location' => ['type' => 'string', 'description' => 'City name'],
'unit' => ['type' => 'string', 'enum' => ['celsius', 'fahrenheit'], 'default' => 'celsius']
],
' return $results;
}
private function execute(string $location, string $unit = 'celsius'): string
{
// Your implementation here
$weather = $this->fetchWeatherData($location, $unit);
return "Weather in {$location}: {$weather['temperature']}°{$unit[0]} - {$weather['condition']}";
}
private function fetchWeatherData(string $location, string $unit): array
{
// Integrate with your weather API
return [
'temperature' => 22,
'condition' => 'sunny',
];
}
}
// List capabilities using helper functions
$tools = list_tools(); // Get all available tools
$resources = list_resources(); // Get all available resources
$prompts = list_prompts(); // Get all available prompts
// Specify protocol version
$tools = list_tools('2024-11-05');
use Tests\TestCase;
class MCPCapabilityTest extends TestCase
{
public function test_tool_execution()
{
// Test your tools using the helper functions
$tools = list_tools();
$this->assertNotEmpty($tools);
// Test specific tool functionality
// Implementation depends on your transport layer
}
public function test_resource_access()
{
$resources = list_resources();
$this->assertNotEmpty($resources);
}
public function test_prompt_generation()
{
$prompts = list_prompts();
$this->assertNotEmpty($prompts);
}
}
## Contributing
We welcome contributions to Superconductor! Whether it's improving documentation, fixing bugs, or adding new features, your help is appreciated.
### Development Setup
1. Clone the repository
2. Install dependencies: `composer install`
3. Run tests: `composer test`
4. Run static analysis: `composer analyse`
### Contribution Guidelines
- Follow PSR-12 coding standards
- Write tests for new features
- Update documentation as needed
- Ensure backward compatibility
## Security
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
### Security Considerations
- **Validate all tool inputs** - Never trust user-provided arguments
- **Implement proper authorization** - Check user permissions before executing tools
- **Sanitize resource access** - Prevent path traversal and unauthorized file access
- **Rate limiting** - Implement appropriate rate limits for resource-intensive operations
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
---
**Ready to supercharge your Laravel app with MCP?**
bash
php artisan vendor:publish --tag=mcp
bash
php artisan vendor:publish --tag=mcp
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.