### Start and Setup Metabase with Docker Compose Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/DATABASE_TOOLS_GUIDE.md This snippet details the process of starting Metabase using Docker Compose and performing an initial setup via its API. It includes waiting for Metabase to be ready and configuring database connections and user details. Ensure Docker and curl are installed. ```shell docker-compose -f docker-compose.metabase.yml up -d echo "Waiting for Metabase to start..." while ! curl -f http://localhost:3030/api/health; do sleep 5 done curl -X POST \ http://localhost:3030/api/setup \ -H 'Content-Type: application/json' \ -d '{ \ "token": "'$(cat /tmp/setup_token)'", \ "user": { \ "first_name": "Admin", \ "last_name": "User", \ "email": "admin@your-domain.com", \ "password": "'$METABASE_ADMIN_PASSWORD'" \ }, \ "database": { \ "engine": "postgres", \ "name": "MCP Server Database", \ "details": { \ "host": "'$NEON_DB_HOST'", \ "port": 5432, \ "dbname": "'$NEON_DB_NAME'", \ "user": "metabase_readonly", \ "password": "'$METABASE_READONLY_PASSWORD'", \ "ssl": true \ } \ }, \ "invite": null, \ "prefs": { \ "site_name": "MCP Server Analytics", \ "site_locale": "en" \ } \ }' echo "Metabase setup complete!" echo "Access Metabase at: http://localhost:3030" ``` -------------------------------- ### Quick Start Deployment - Setup and Run MCP Server Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/analysis/COMPLETE_AI_CAPABILITIES_ANALYSIS.md This snippet outlines the steps to clone the MCP server repository, install dependencies, set up environment variables, migrate the database, and start the development server. It concludes with a command to test the MCP connection. ```bash # 1. Clone and install git clone https://github.com/PSYGER02/mcpserver.git cd mcpserver npm install # 2. Environment setup cp .env.example .env # Edit .env with your API keys # 3. Database setup npm run migrate # 4. Start development server npm run dev # 5. Test MCP connection curl http://localhost:3000/health ``` -------------------------------- ### Install Dependencies for mcp-server Setup Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/guides/FREE_TIER_SETUP_GUIDE.md Install necessary Node.js packages, specifically the 'pg' library for PostgreSQL interactions and its corresponding TypeScript types, to support the Neon Database connection. ```bash npm install pg @types/pg ``` -------------------------------- ### Manual Deployment Steps for MCP Server Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/deployment/PRODUCTION_DEPLOYMENT_GUIDE.md Details the manual deployment steps for the MCP Server, including installing production dependencies, building TypeScript code, setting up databases, and starting the application. ```bash # Install dependencies npm ci --production # Build TypeScript npm run build # Set up databases # Apply business database schema psql "$SUPABASE_URL" -f sql/business-database-monitoring.sql # Apply memory database schema psql "$MEMORY_DB_URL" -f sql/memory-tables-schema.sql # Start application NODE_ENV=production node dist/src/index.js ``` -------------------------------- ### Setup Environment Variables (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/DOCKER_DEPLOYMENT.md Copies the example environment file and instructs on editing it. Requires Supabase, Gemini API, and JWT secret keys for configuration. ```bash # Copy the environment template cp .env.example .env # Edit .env with your configuration # Required variables: # - SUPABASE_URL # - SUPABASE_SERVICE_ROLE_KEY # - GEMINI_API_KEY # - JWT_SECRET ``` -------------------------------- ### Deploy mcp-server Production Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/guides/FREE_TIER_SETUP_GUIDE.md Commands to deploy the mcp-server to production on Linux/macOS or Windows systems after successful setup and testing. ```bash ./deploy-production.sh # Linux/macOS # OR deploy-production.bat # Windows ``` -------------------------------- ### Bash Script for Metabase Setup Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/DATABASE_TOOLS_GUIDE.md This is a simple bash script intended for automating the Metabase setup process for the MCP Server. It starts with an echo statement to indicate the beginning of the setup process. This script would typically be expanded to include commands for setting up environment variables, deploying configurations, or initializing services. ```bash #!/bin/bash # setup-metabase.sh echo "Setting up Metabase for MCP Server..." ``` -------------------------------- ### Quick Start Integration Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/MCP_API_DOCUMENTATION.md Guides for integrating with the MCP Server API using the SDK and WebSocket. ```APIDOC ## QUICK START INTEGRATION ### Install Dependencies Install the necessary Node.js packages. ```bash npm install @modelcontextprotocol/sdk axios ws ``` ### Basic MCP Client Example of how to use the MCPClient class for API interactions. ```javascript import axios from 'axios'; class MCPClient { constructor(baseURL, token) { this.baseURL = baseURL; this.token = token; this.headers = { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }; } async callTool(toolName, args, context = {}) { try { const response = await axios.post( `${this.baseURL}/api/tools/${toolName}`, { args, context }, { headers: this.headers } ); return response.data; } catch (error) { throw new Error(`MCP Tool Error: ${error.response?.data?.error?.message}`); } } // Sales operations async createSale(saleData) { return this.callTool('create_sale', saleData); } async getSales(filters = {}) { return this.callTool('get_sales', filters); } // AI consultation async getBusinessAdvice(question, userRole) { return this.callTool('get_business_advice', { question, userRole }); } } // Usage const client = new MCPClient('http://localhost:3000', 'your_jwt_token'); // Create a sale const sale = await client.createSale({ product_name: 'Fried Chicken', quantity: 2, price: 150, worker_id: 'worker_123' }); // Get business advice const advice = await client.getBusinessAdvice( 'How can I increase sales?', 'owner' ); ``` ### WebSocket Integration Example of setting up a WebSocket connection for real-time updates. ```javascript class MCPWebSocket { constructor(url, token) { this.ws = new WebSocket(url); this.token = token; this.setupConnection(); } setupConnection() { this.ws.onopen = () => { this.authenticate(); this.subscribe(['sales_updates', 'stock_alerts']); }; this.ws.onmessage = (event) => { const data = JSON.parse(event.data); this.handleMessage(data); }; } authenticate() { this.send({ type: 'auth', token: this.token }); } subscribe(channels) { this.send({ type: 'subscribe', channels }); } send(data) { this.ws.send(JSON.stringify(data)); } handleMessage(data) { switch(data.type) { case 'business_update': this.onBusinessUpdate(data.data); break; case 'stock_alert': this.onStockAlert(data.data); break; } } onBusinessUpdate(data) { console.log('New business update:', data); } onStockAlert(data) { console.log('Stock alert:', data); } } // Usage const wsClient = new MCPWebSocket('ws://localhost:3000/ws', 'your_jwt_token'); ``` ``` -------------------------------- ### Render.com Deployment Steps Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DEPLOYMENT/FINAL_DEPLOYMENT_GUIDE_PRODUCTION_v1.0.md Instructions for deploying the mcp-server to Render.com, including service creation, build and start commands, and repository connection. ```bash 1. Go to https://render.com 2. Sign up/login with GitHub account 3. Click "New Web Service" 4. Connect GitHub repository: DeltaRhoSygnis/mcp-server 5. Configure service: - Name: mcp-server-production - Branch: typescript-fixes-deployment - Build Command: npm install && npm run build - Start Command: npm start ``` -------------------------------- ### Direct MCP API Usage: Get AI Advice (TypeScript) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/CHARNOKSV3_INTEGRATION_GUIDE.md Illustrates how to use the MCP client to get AI-driven business advice. It demonstrates calling the `getBusinessAdvice` method with a question, user role, and business context, returning the advice if successful. ```typescript // Anywhere in your code import { mcpClient } from './services/mcpClient'; // Get AI business advice async function getAIAdvice(question: string) { const result = await mcpClient.getBusinessAdvice({ question, userRole: 'owner', context: { /* your business context */ } }); return result.success ? result.result : null; } ``` -------------------------------- ### Test mcp-server Production Readiness Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/guides/FREE_TIER_SETUP_GUIDE.md Execute a TypeScript file to test the overall production readiness of your mcp-server setup, including all configured connections and integrations. ```bash npx ts-node production-readiness-test.ts ``` -------------------------------- ### Heroku CLI Setup and App Creation Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/HEROKU_DEPLOYMENT_GUIDE.md Commands to install the Heroku CLI, log in to your Heroku account, create a new Heroku application, and set the Node.js buildpack. ```bash # 1. Install Heroku CLI # Download from: https://devcenter.heroku.com/articles/heroku-cli # 2. Login to Heroku heroku login # 3. Create Heroku app heroku create charnoks-mcp-server # 4. Add buildpacks (Node.js is auto-detected) heroku buildpacks:set heroku/nodejs -a charnoks-mcp-server ``` -------------------------------- ### Install and Manage MCP Server Service on Linux (Systemd) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/deployment/PRODUCTION_DEPLOYMENT_GUIDE.md This snippet details the steps to install, enable, and manage the MCP server as a systemd service on Linux systems. It includes commands for starting, stopping, restarting, and checking the service status, as well as viewing logs. ```bash # Install service sudo cp mcp-server.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable mcp-server.service # Manage service sudo systemctl start mcp-server sudo systemctl stop mcp-server sudo systemctl restart mcp-server sudo systemctl status mcp-server # View logs journalctl -u mcp-server -f ``` -------------------------------- ### Install MCP Integration Dependencies (NPM) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/CHARNOKSV3_INTEGRATION_GUIDE.md Installs necessary npm packages for MCP integration, including axios for HTTP requests and ws with its types for WebSocket communication. ```npm npm install axios ws npm install --save-dev @types/ws ``` -------------------------------- ### Install MCP SDK Dependencies Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/MIGRATION-GUIDE-HTTP-vs-SDK.md Instructions to install the MCP SDK and add it to your project's dependencies. This involves updating `package.json` and running `npm install`. ```json { "dependencies": { "@modelcontextprotocol/sdk": "^0.5.0" } } ``` -------------------------------- ### Setup MCP Server Environment Variables (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/deployment/DOCKER_DEPLOYMENT.md This snippet demonstrates how to set up the environment for the MCP server by copying an example `.env` file and instructing the user to edit it with required configuration variables such as Supabase URL, API keys, and JWT secret. ```bash # Copy the environment template cp .env.example .env # Edit .env with your configuration # Required variables: # - SUPABASE_URL # - SUPABASE_SERVICE_ROLE_KEY # - GEMINI_API_KEY # - JWT_SECRET ``` -------------------------------- ### Deploy Frontend with Vercel CLI Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/deployment/QUICK_DEPLOYMENT_GUIDE.md Commands to install the Vercel CLI globally and then log in and deploy the frontend application to production. ```bash npm install -g vercel vercel login vercel --prod ``` -------------------------------- ### Troubleshoot Service Start Issues (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/DOCKER_DEPLOYMENT.md Commands to diagnose why a service might not be starting, including checking logs, verifying environment configurations, and inspecting the `.env` file. ```bash # Check logs docker-compose logs mcp-server # Check environment variables docker-compose config # Verify .env file cat .env ``` -------------------------------- ### Vercel CLI Installation and Deployment Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/QUICK_DEPLOYMENT_GUIDE.md Installs the Vercel CLI globally and deploys the frontend application to production. It also provides commands for adding production environment variables. ```bash npm install -g vercel vercel login vercel --prod vercel env add VITE_MCP_SERVER_URL production vercel env add VITE_MCP_WS_URL production vercel env add VITE_MCP_AUTH_TOKEN production ``` -------------------------------- ### Node.js Package.json Scripts Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/HEROKU_DEPLOYMENT_GUIDE.md Example package.json scripts for building, starting, and developing the Node.js application, including TypeScript compilation. ```json { "scripts": { "build": "tsc", "start": "node dist/index.js", "dev": "tsx src/index.ts" } } ``` -------------------------------- ### List All Pinecone Indexes (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/analysis/PINECONE_INDEX_SETUP.md This command lists all available Pinecone indexes associated with your account by querying the Pinecone controller API. It requires your API key. The response contains details of all databases. ```bash # List all indexes curl -H "Api-Key: $PINECONE_API_KEY" \ https://controller.us-east1-gcp.pinecone.io/databases ``` -------------------------------- ### Backend Deployment Commands (Render) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/deployment/QUICK_DEPLOYMENT_GUIDE.md Instructions for deploying the backend application to Render. This involves connecting a GitHub repository, configuring build and start commands, and setting the Node.js environment. ```bash # Build Command: npm install && npm run build # Start Command: npm start ``` -------------------------------- ### Manage MCP Server Service on Windows (NSSM) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/deployment/PRODUCTION_DEPLOYMENT_GUIDE.md Instructions for managing the MCP server as a service on Windows using NSSM (Non-Sucking Service Manager). This covers installing and managing the service lifecycle (start, stop, restart). ```batch REM Download NSSM from https://nssm.cc/download REM Run as Administrator REM Install service install-windows-service.bat REM Manage service nssm start chicken-business-mcp nssm stop chicken-business-mcp nssm restart chicken-business-mcp ``` -------------------------------- ### Apply Docker Compose Service Profiles (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/DOCKER_DEPLOYMENT.md Demonstrates how to use Docker Compose profiles to selectively start services, such as production or monitoring stacks. ```bash # Start with production services (nginx) docker-compose --profile production up -d # Start with monitoring services docker-compose --profile monitoring up -d # Start everything docker-compose --profile production --profile monitoring up -d ``` -------------------------------- ### Pinecone Index Configuration Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/analysis/PINECONE_INDEX_SETUP.md Defines the essential settings for creating a new Pinecone index. This includes the index name, vector dimensions, similarity metric, pod type, and environment. ```text Index Name: chicken-business-memory Dimensions: 1536 Metric: cosine Pod Type: Starter (Free) Environment: us-east1-gcp Replicas: 1 Shards: 1 ``` -------------------------------- ### Test Neon Database Connection (Node.js) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/guides/FREE_TIER_SETUP_GUIDE.md A Node.js script to directly test the connection to your Neon PostgreSQL database using the provided NEON_DATABASE_URL environment variable. ```javascript const {Client} = require('pg'); const client = new Client('$NEON_DATABASE_URL'); client.connect().then(() => console.log('✅ Neon connected')).catch(console.error); ``` -------------------------------- ### Update package.json Scripts for Deployment (JSON) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/RENDER_DEPLOYMENT_CONFIGURATION.md Provides an updated `scripts` section for the `package.json` file, essential for building and starting the MCP server in a production environment. It defines commands for starting the server, building TypeScript, running in development mode, and a combined deploy script. ```json { "scripts": { "start": "node dist/index.js", "build": "tsc", "dev": "ts-node src/index.ts", "deploy": "npm run build && npm start" } } ``` -------------------------------- ### Test Google Drive API Access (curl) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/guides/FREE_TIER_SETUP_GUIDE.md Uses curl to test access to the Google Drive API by making a request to list files, requiring a valid GOOGLE_DRIVE_ACCESS_TOKEN. ```bash curl -H "Authorization: Bearer $GOOGLE_DRIVE_ACCESS_TOKEN" https://www.googleapis.com/drive/v3/files ``` -------------------------------- ### Test Pinecone Database Connection (curl) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/guides/FREE_TIER_SETUP_GUIDE.md Uses curl to test connection to the Pinecone controller API, requiring your PINECONE_API_KEY for authentication. ```bash curl -H "Api-Key: $PINECONE_API_KEY" https://controller.us-east1-gcp.pinecone.io/databases ``` -------------------------------- ### Heroku Deployment Steps for mcp-server Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DEPLOYMENT/FINAL_DEPLOYMENT_GUIDE_PRODUCTION_v1.0.md Steps to deploy the mcp-server to Heroku, including installing the Heroku CLI, creating an app, setting environment variables, and pushing the deployment branch. ```bash # Install Heroku CLI npm install -g heroku # Login and create app heroku login heroku create mcp-server-production # Set environment variables (use same as above, but with heroku config:set) heroku config:set NODE_ENV=production heroku config:set CEREBRAS_API_KEY=csk-9fnhk2vx5wkcvk93jhk4tj86tt622f689ewe8vyy6dd4f8fe # ... (add all environment variables) # Deploy git push heroku typescript-fixes-deployment:main ``` -------------------------------- ### Integrate Let's Encrypt with Certbot for SSL Certificates Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/NGINX_COMPREHENSIVE_GUIDE.md A bash script demonstrating the installation and usage of Certbot with the Nginx plugin to obtain and renew Let's Encrypt SSL certificates. It includes commands for installation, certificate generation, and setting up auto-renewal. ```bash #!/bin/bash # Setup Let's Encrypt with certbot # Install certbot apt-get update apt-get install -y certbot python3-certbot-nginx # Generate certificate certbot --nginx -d your-domain.com -d www.your-domain.com \ --email your-email@example.com \ --agree-tos \ --non-interactive # Auto-renewal cron job echo "0 12 * * * /usr/bin/certbot renew --quiet" | crontab - # Test renewal certbot renew --dry-run ``` -------------------------------- ### Manage Docker Services with Docker Compose (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/DOCKER_DEPLOYMENT.md Basic Docker Compose commands for managing the MCP server and its dependencies. Includes starting, stopping, restarting, viewing logs, and checking status. ```bash # Start services docker-compose up -d # Stop services docker-compose down # Restart services docker-compose restart # View logs docker-compose logs -f # Check status docker-compose ps ``` -------------------------------- ### Copy Integration Files to Charnoksv3 (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/CHARNOKSV3_INTEGRATION_GUIDE.md This snippet demonstrates how to copy the required integration files (mcpClient.ts, mcpWebSocket.ts, mcpIntegrationExamples.ts) from the MCP server to the Charnoksv3 repository's services directory. ```bash # Copy integration files cp mcpClient.ts /path/to/Charnoksv3/src/services/ cp mcpWebSocket.ts /path/to/Charnoksv3/src/services/ cp mcpIntegrationExamples.ts /path/to/Charnoksv3/src/services/ ``` -------------------------------- ### Supabase SQL for mcp-server Production Setup Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DEPLOYMENT/FINAL_DEPLOYMENT_GUIDE_PRODUCTION_v1.0.md SQL commands to create necessary tables (chicken_notes, business_metrics) and enable Row Level Security (RLS) in Supabase for the mcp-server. Policies are set to allow all operations initially. ```sql -- Quick Supabase Setup: 1. Go to https://supabase.com 2. Create new project: "mcp-server-production" 3. Go to Settings → API 4. Copy URL and service_role key to environment variables above 5. Run this SQL in SQL Editor: -- Create tables CREATE TABLE chicken_notes ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, note TEXT NOT NULL, processed_note JSONB, language VARCHAR(10), cultural_context JSONB, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() ); CREATE TABLE business_metrics ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, metrics JSONB NOT NULL, analysis JSONB, recommendations JSONB, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() ); -- Enable Row Level Security ALTER TABLE chicken_notes ENABLE ROW LEVEL SECURITY; ALTER TABLE business_metrics ENABLE ROW LEVEL SECURITY; -- Create policies (allow all for now, restrict later) CREATE POLICY "Allow all operations" ON chicken_notes FOR ALL TO authenticated USING (true); CREATE POLICY "Allow all operations" ON business_metrics FOR ALL TO authenticated USING (true); ``` -------------------------------- ### Test Pinecone Index with curl Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/analysis/PINECONE_INDEX_SETUP.md A command-line interface (CLI) command using curl to verify if the Pinecone index exists by making a GET request to the Pinecone controller API. ```bash # Test index exists curl -X GET \ "https://controller.us-east1-gcp.pinecone.io/databases/chicken-business-memory" \ -H "Api-Key: YOUR_PINECONE_API_KEY" # Expected response: Index details in JSON ``` -------------------------------- ### Kubernetes Scenario Examples (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/KUBERNETES_COMPREHENSIVE_GUIDE.md Illustrative bash comments demonstrating real-world scenarios where Kubernetes excels in managing the MCP Server. These scenarios highlight automatic scaling during traffic spikes, resilience to node failures, and zero-downtime deployments for updates. ```bash # Scenario 1: Traffic Spike # Your MCP server suddenly gets 10x more AI requests # K8s automatically spins up more pods to handle the load # Scenario 2: Node Failure # A server crashes, but K8s moves your application to healthy nodes # Users don't even notice the interruption # Scenario 3: New Feature Deploy # You push an update, K8s gradually replaces old pods with new ones # Zero downtime deployment ``` -------------------------------- ### Get Pinecone Index Statistics (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/analysis/PINECONE_INDEX_SETUP.md This command retrieves statistics for a specific Pinecone index, such as the number of vectors and dimensions. It requires the index name, API key, and the index's service URL. The response is in JSON format. ```bash # Get index stats curl -X POST \ "https://chicken-business-memory-xxxxx.svc.us-east1-gcp.pinecone.io/describe_index_stats" \ -H "Api-Key: $PINECONE_API_KEY" \ -H "Content-Type: application/json" ``` -------------------------------- ### Configure .env Variables for mcp-server Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/guides/FREE_TIER_SETUP_GUIDE.md This snippet shows the essential environment variables to add to your .env file for setting up the Neon Database, Google Drive integration, and performance configurations. Ensure you replace placeholder values with your actual credentials and settings. ```bash # Sign up at https://neon.tech (Free: 0.5GB storage) NEON_DATABASE_URL=postgresql://username:password@ep-xxx.us-east-2.aws.neon.tech/database_name GOOGLE_DRIVE_CLIENT_ID=your_google_client_id_here GOOGLE_DRIVE_CLIENT_SECRET=your_google_client_secret_here GOOGLE_DRIVE_REFRESH_TOKEN=your_refresh_token_here GOOGLE_DRIVE_FOLDER_ID=your_backup_folder_id MCP_SEPARATED_ARCHITECTURE=true MCP_MEMORY_DB_TYPE=neon MCP_CONTEXT_WINDOW_SIZE=2000000 MCP_MAX_TOKENS_PER_MINUTE=100000 MCP_ENABLE_RATE_LIMITING=true MCP_ENABLE_CACHING=true PINECONE_INDEX_NAME=chicken-business-memory ``` -------------------------------- ### Verify Pinecone Index Existence (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/analysis/PINECONE_INDEX_SETUP.md This command verifies if a specific Pinecone index exists by making a GET request to the Pinecone controller API. It requires an API key and the index name. The output will indicate success or failure of the request. ```bash # Check index exists curl -H "Api-Key: $PINECONE_API_KEY" \ https://controller.us-east1-gcp.pinecone.io/databases/chicken-business-memory ``` -------------------------------- ### Business Database SQL Commands Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/deployment/PRODUCTION_DEPLOYMENT_GUIDE.md SQL commands for setting up and verifying the business database schema in Supabase. Includes applying monitoring tables and checking related metrics and logs. ```sql -- Run this on your primary Supabase instance \i sql/business-database-monitoring.sql -- Verify monitoring tables SELECT * FROM business_db_metrics; SELECT * FROM backup_logs; ``` -------------------------------- ### Configure MCP Environment Variables (.env) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/CHARNOKSV3_INTEGRATION_GUIDE.md Sets up environment variables in the Charnoksv3 repository's .env file to configure the MCP server URL, authentication token, and WebSocket URL. Includes examples for both deployed and local development environments. ```env # MCP Server Configuration MCP_SERVER_URL=https://your-mcp-server.onrender.com MCP_AUTH_TOKEN=your_secure_auth_token_here MCP_WEBSOCKET_URL=wss://your-mcp-server.onrender.com # For development # MCP_SERVER_URL=http://localhost:3002 # MCP_WEBSOCKET_URL=ws://localhost:3002 ``` -------------------------------- ### Docker Deployment Commands for MCP Server Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/deployment/PRODUCTION_DEPLOYMENT_GUIDE.md Illustrates the process of deploying the MCP Server using Docker, including building the production image, running with docker-compose, and verifying the deployment status and logs. ```bash # Build production image docker build -f Dockerfile.production -t mcp-server:production . # Run with docker-compose docker-compose -f docker-compose.production.yml up -d # Check container status docker-compose -f docker-compose.production.yml ps # Check logs docker-compose -f docker-compose.production.yml logs -f mcp-server # Test health endpoint curl http://localhost:3000/health ``` -------------------------------- ### Direct MCP API Usage: Process Note (TypeScript) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/CHARNOKSV3_INTEGRATION_GUIDE.md Provides an example of directly using the MCP client to process a business note. It shows how to call the `processChickenNote` method with note content, user role, and branch ID, and how to handle the success or error response. ```typescript // Anywhere in your code import { mcpClient } from './services/mcpClient'; // Process a business note async function handleBusinessNote(noteText: string) { const result = await mcpClient.processChickenNote({ content: noteText, userRole: 'owner', branchId: 'main' }); if (result.success) { console.log('Processed:', result.result); return result.result; } else { console.error('Error:', result.error); throw new Error(result.error); } } ``` -------------------------------- ### Reverse Proxy Setup - Basic Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/NGINX_COMPREHENSIVE_GUIDE.md This section describes a basic reverse proxy setup for the MCP backend servers, including upstream server definitions and proxy headers. ```APIDOC ## Reverse Proxy Setup - Basic ### Description Sets up a basic Nginx reverse proxy to forward requests to the MCP backend servers. ### Method N/A (Configuration file) ### Endpoint N/A (Configuration file) ### Parameters N/A ### Request Example N/A ### Response N/A (Configuration file) ``` -------------------------------- ### Quick Start Deployment Commands (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/README.md A collection of bash commands to quickly set up and deploy the MCP server. Includes copying configuration files, making scripts executable, and initiating deployment via script or Docker Compose. ```bash # Copy all configs to your project cp -r DEPLOYMENT_CONFIGS/* /path/to/your/project/ # Make scripts executable chmod +x scripts/*.sh # Run production deployment ./scripts/deploy-production.sh # Or use Docker docker-compose up -d ``` -------------------------------- ### Start Voice Stream API Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/COMPLETE_MCP_INTEGRATION_GUIDE.md Starts a live voice streaming session via WebSocket. Requires a stream ID and authentication token. ```APIDOC ## WebSocket /ws/voice/{streamId} ### Description Start a live voice streaming session. ### Method WebSocket ### Endpoint /ws/voice/{streamId} ### Parameters #### Path Parameters - **streamId** (string) - Required - The ID of the voice stream. #### Query Parameters - **token** (string) - Optional - Authentication token for the WebSocket connection. ### Response #### Success Response (101 Switching Protocols) - A WebSocket connection is established for the voice stream. ### Example Usage ```javascript const ws = await mcpClient.startVoiceStream('stream123'); ws.onopen = () => { console.log('Voice stream connected'); }; ``` ``` -------------------------------- ### Sale Creation Workflow Diagram Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/COMPLETE_AUTHENTICATION_GUIDE.md A flowchart illustrating the steps involved in creating a sale, from user interaction on the frontend to backend processing, database insertion, and AI pattern learning. It highlights key components like authentication, data validation, service calls, and real-time updates. ```mermaid flowchart TD A[Worker/Owner] --> B[Frontend: Create Sale Form] B --> C[Collect Sale Data] C --> D{User Authenticated?} D -->|No| E[Redirect to Login] D -->|Yes| F[POST /api/tools/create_sale] F --> G[authenticateJWT Middleware] G --> H[Validate Sale Data] H --> I[MCP Tool: create_sale] I --> J[SalesService.createSale()] J --> K[Insert into Supabase] K --> L[Update Stock Levels] L --> M[Generate Receipt] M --> N[Return Sale Data] N --> O[WebSocket Broadcast] O --> P[Update Frontend UI] O --> Q[Notify Other Users] R[AI Processing] --> S[Learn Sale Pattern] S --> T[Update Business Memory] M --> R style A fill:#e3f2fd style F fill:#f3e5f5 style K fill:#e8f5e8 style O fill:#fff3e0 ``` -------------------------------- ### Start Docker Monitoring Stack Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/GRAFANA_COMPREHENSIVE_GUIDE.md Bash command to initiate the monitoring services defined in the docker-compose.monitoring.yml file. This command should be executed in the directory containing the YAML file. It will start Prometheus, Grafana, and exporters in detached mode. ```bash # Start monitoring stack docker-compose -f docker-compose.monitoring.yml up -d ``` -------------------------------- ### Run Development Server and Build Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/IMPLEMENTATION_STATUS.md These commands are used to build the project and start the development server. This is a standard procedure for testing and running Node.js applications during development. ```bash npm run build npm run dev ``` -------------------------------- ### Install Development Dependencies with npm Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/dependencies-install.txt Installs npm packages necessary for development and testing of the Charnok's MCP Server. This includes testing frameworks like Jest, TypeScript support, and type definitions for various Node.js modules. ```bash npm install --save-dev @jest/globals @types/cors @types/express @types/jest @types/node @types/uuid @types/jsonwebtoken @types/ws @types/p-limit jest tsx typescript ``` -------------------------------- ### Get Server Health Status - TypeScript Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/COMPLETE_MCP_INTEGRATION_GUIDE.md Checks the health status of the MCP server. It sends a GET request to the '/health' endpoint and returns an MCPResponse indicating the server's operational status. ```typescript async getHealthStatus(): Promise { return this.apiCall('/health'); } ``` -------------------------------- ### Performance Configuration Environment Variables Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/deployment/PRODUCTION_DEPLOYMENT_GUIDE.md Configuration parameters for optimizing MCP Server performance, including setting the context window size, maximum tokens per minute, and enabling features like rate limiting, caching, and compression. ```bash # Environment variables for optimal performance export MCP_CONTEXT_WINDOW_SIZE=2000000 # 2M tokens export MCP_MAX_TOKENS_PER_MINUTE=100000 # 100k TPM export MCP_ENABLE_RATE_LIMITING=true export MCP_ENABLE_CACHING=true export MCP_ENABLE_COMPRESSION=true ``` -------------------------------- ### Get Available MCP Tools - TypeScript Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/COMPLETE_MCP_INTEGRATION_GUIDE.md Retrieves a list of available tools from the MCP server. This function makes a GET request to the '/api/tools' endpoint and returns an MCPResponse containing the tool information. ```typescript async getAvailableTools(): Promise { return this.apiCall('/api/tools'); } ``` -------------------------------- ### Docker Deployment Commands Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/PRODUCTION_DEPLOYMENT_GUIDE.md Illustrates the commands for deploying the MCP Server using Docker. This includes creating a production environment file, building the Docker image for production, and running the application using Docker Compose. Verification steps using Docker commands are also provided. ```bash # Build production image docker build -f Dockerfile.production -t mcp-server:production . # Run with docker-compose docker-compose -f docker-compose.production.yml up -d # Verify deployment # Check container status docker-compose -f docker-compose.production.yml ps # Check logs docker-compose -f docker-compose.production.yml logs -f mcp-server # Test health endpoint curl http://localhost:3000/health ``` -------------------------------- ### GET /health Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/COMPLETE_MCP_INTEGRATION_GUIDE.md Checks the health status of the MCP server and its backend integration. ```APIDOC ## GET /health ### Description Performs a health check on the MCP server to ensure it is operational and connected to its backend services. ### Method GET ### Endpoint /health ### Parameters None ### Request Example ``` GET /health HTTP/1.1 Host: your-mcp-server.com ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the health check passed. - **mcpServerHealthy** (boolean) - True if the MCP server and its backend are healthy, false otherwise. - **timestamp** (string) - The ISO 8601 timestamp of when the health check was performed. #### Response Example ```json { "success": true, "mcpServerHealthy": true, "timestamp": "2023-10-27T10:20:00.000Z" } ``` #### Error Response (500) - **success** (boolean) - Indicates failure. - **mcpServerHealthy** (boolean) - Always false in case of error. - **error** (string) - A message describing the health check failure. - **timestamp** (string) - The ISO 8601 timestamp of when the error occurred. ``` -------------------------------- ### Install Production Dependencies with npm Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/dependencies-install.txt Installs the essential npm packages required for the Charnok's MCP Server to run in a production environment. These include SDKs for AI providers like Gemini, OpenRouter, Cohere, and HuggingFace, along with utility and networking packages. ```bash npm install @google-cloud/language @google/generative-ai @huggingface/inference @modelcontextprotocol/sdk @supabase/supabase-js cohere-ai cors dotenv express express-rate-limit node-fetch openai uuid jsonwebtoken zod ws p-limit ``` -------------------------------- ### Define RBAC Role for MCP Server Access Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/KUBERNETES_COMPREHENSIVE_GUIDE.md This Kubernetes Role defines permissions for the MCP Server service account, allowing it to 'get', 'list', and 'watch' pods, services, and configmaps, and 'get', 'list' deployments. It specifies the API groups and resources the role applies to. ```yaml apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: mcp-server-role rules: - apiGroups: [""] resources: ["pods", "services", "configmaps"] verbs: ["get", "list", "watch"] - apiGroups: ["apps"] resources: ["deployments"] verbs: ["get", "list"] ``` -------------------------------- ### Install All Dependencies Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/MD files/API_PROVIDER_ANALYSIS_AND_FIXES.md This command installs all necessary production dependencies for the project, including AI SDKs, utility packages, and web framework components. ```bash # Install all dependencies at once npm install @google-cloud/language @google/generative-ai @huggingface/inference @modelcontextprotocol/sdk @supabase/supabase-js cohere-ai cors dotenv express express-rate-limit node-fetch openai uuid jsonwebtoken zod ws p-limit ``` -------------------------------- ### Optional Environment Variables (Bash) Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/RENDER_DEPLOYMENT_CONFIGURATION.md Lists optional but recommended environment variables for configuring the MCP server's behavior, such as port, allowed origins for CORS, database connection strings, and frontend URLs. These provide flexibility in deployment. ```bash PORT=3000 ALLOWED_ORIGINS=https://your-frontend.com MAX_REQUESTS_PER_MINUTE=1000 DATABASE_URL=postgresql://... FRONTEND_URL=https://your-frontend.com ``` -------------------------------- ### Project Recommendation Object Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/MIGRATION-GUIDE-HTTP-vs-SDK.md This JavaScript object provides a final recommendation for the Charnoks project. It highlights the strengths of the current HTTP API approach and suggests when to use the SDK version. It also categorizes enhancement files. ```javascript export default { message: "Your current HTTP API approach is actually the RIGHT choice for your project!", recommendation: "Keep your current mcpClient.ts - it's excellent architecture", useSDKFor: "Server-side scripts, CLI tools, and desktop apps only", enhancementFiles: "Examples to learn concepts from, not production code" }; ``` -------------------------------- ### Get Server Health Status API Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/integration/COMPLETE_MCP_INTEGRATION_GUIDE.md Checks the health status of the MCP server. ```APIDOC ## GET /health ### Description Get the server health status. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - **status** (string) - The health status of the server (e.g., 'OK', 'Degraded'). #### Response Example ```json { "status": "OK" } ``` ``` -------------------------------- ### Environment Variables for MCP Server Deployment Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/deployment/PRODUCTION_DEPLOYMENT_GUIDE.md Defines essential environment variables required for setting up the MCP Server, covering database connections (Supabase, Vector DB), AI service API keys, Google Drive integration, and caching. ```bash # Business Database (Primary Supabase) SUPABASE_URL=your_primary_supabase_url SUPABASE_KEY=your_primary_supabase_key # Backup Database (Secondary Supabase) SUPABASE_BACKUP_URL=your_backup_supabase_url SUPABASE_BACKUP_KEY=your_backup_supabase_key # AI Services GEMINI_API_KEY=your_gemini_api_key OPENROUTER_API_KEY=your_openrouter_api_key HUGGINGFACE_API_KEY=your_huggingface_api_key COHERE_API_KEY=your_cohere_api_key # Vector Database PINECONE_API_KEY=your_pinecone_api_key PINECONE_ENVIRONMENT=your_pinecone_environment # Google Drive Integration GOOGLE_DRIVE_CLIENT_ID=your_google_drive_client_id GOOGLE_DRIVE_CLIENT_SECRET=your_google_drive_client_secret GOOGLE_DRIVE_REFRESH_TOKEN=your_google_drive_refresh_token # Caching (Optional) REDIS_URL=your_redis_url ``` -------------------------------- ### Heroku Procfile Configuration Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/documentation/HEROKU_DEPLOYMENT_GUIDE.md The Procfile content that defines the web process for the Heroku application, specifying the command to start the server. ```bash web: npm start ``` -------------------------------- ### Automated Deployment Script - Linux/macOS Source: https://github.com/deltarhosygnis/mcp-server/blob/typescript-fixes-deployment/ORGANIZED_WORKSPACE/DOCUMENTATION/deployment/PRODUCTION_DEPLOYMENT_GUIDE.md Provides commands to make the deployment script executable and run it after setting environment variables. This is the recommended automated deployment method for Linux and macOS environments. ```bash # Make script executable chmod +x deploy-production.sh # Set environment variables first export SUPABASE_URL="your_url" export SUPABASE_KEY="your_key" # ... set all required variables # Run deployment ./deploy-production.sh ```