#!/usr/bin/env node

/**
 * Vibn MCP Server Entry Point
 * 
 * This script starts the Vibn MCP server which exposes project data
 * and capabilities to AI assistants through the Model Context Protocol.
 * 
 * Usage:
 *   npm run mcp:server
 * 
 * Or add to your AI assistant's MCP configuration:
 *   {
 *     "mcpServers": {
 *       "vibn": {
 *         "command": "node",
 *         "args": ["path/to/vibn-frontend/mcp-server.js"]
 *       }
 *     }
 *   }
 */

const { spawn } = require('child_process');
const path = require('path');

// Load environment variables
require('dotenv').config({ path: path.join(__dirname, '.env.local') });

// Run the TypeScript server using tsx
const server = spawn('npx', ['tsx', path.join(__dirname, 'lib/mcp/server.ts')], {
  stdio: 'inherit',
  env: process.env,
});

server.on('error', (error) => {
  console.error('Failed to start MCP server:', error);
  process.exit(1);
});

server.on('exit', (code) => {
  process.exit(code || 0);
});

