tips-mcp-server

eagleisbatman/tips-mcp-server

3.2

If you are the rightful owner of tips-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A database-backed MCP server for delivering AI-generated farming tips, designed for agricultural applications with support for multiple regions and bilingual content.

Tips MCP Server

A database-backed MCP (Model Context Protocol) server for delivering AI-generated farming tips. Designed for agricultural applications with support for multiple regions and bilingual content.

Features

  • 12 Tip Categories: Weather alerts, pest & disease, irrigation, planting, crop care, harvesting, post-harvest, livestock, aquaculture, market trends, seasonal, and knowledge
  • Regional Support: Configurable regions (default: Vietnam agricultural zones)
  • Bilingual Content: Vietnamese and English support
  • Weather-Triggered Tips: Contextual tips based on weather conditions
  • Interaction Tracking: Analytics for views, dismissals, and actions
  • RESTful API: Easy integration with mobile and web clients

Tech Stack

  • Runtime: Node.js 18+
  • Framework: Express.js
  • Database: PostgreSQL
  • Language: JavaScript (ES Modules)

API Endpoints

MethodEndpointDescription
GET/healthHealth check
GET/categoriesList all tip categories
GET/tipsGet tips with filtering
GET/tips/contextualGet contextual tips based on location/weather
POST/tips/:id/interactionRecord tip interaction

Query Parameters for /tips

ParameterTypeDescription
languagevi | enResponse language (default: vi)
regionstringFilter by region code
categorystringFilter by category ID
limitnumberMax tips to return (default: 10)

Query Parameters for /tips/contextual

ParameterTypeDescription
languagevi | enResponse language (default: vi)
locationstringLocation name for region detection
weather_conditionstringCurrent weather condition
temperaturenumberCurrent temperature in Celsius
humiditynumberCurrent humidity percentage

Installation

Prerequisites

  • Node.js 18+
  • PostgreSQL database

Local Development

# Clone the repository
git clone https://github.com/eagleisbatman/tips-mcp-server.git
cd tips-mcp-server

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env
# Edit .env with your database credentials

# Run database migrations (see Database Schema section)

# Run in development mode
npm run dev

Production Deployment

Deploy to any Node.js hosting platform (Railway, Heroku, Render, etc.):

  1. Connect your repository
  2. Set environment variables:
    • DATABASE_URL: PostgreSQL connection string
    • NODE_ENV: production
  3. Deploy

Environment Variables

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string
PORTNoServer port (default: 3001)
NODE_ENVNoEnvironment (development | production)

Database Schema

Required Tables

-- Tip categories
CREATE TABLE tip_categories (
  id VARCHAR(50) PRIMARY KEY,
  name_vi VARCHAR(100) NOT NULL,
  name_en VARCHAR(100) NOT NULL,
  icon VARCHAR(10) NOT NULL,
  color VARCHAR(7) NOT NULL,
  background_color VARCHAR(7) NOT NULL,
  priority INT NOT NULL DEFAULT 10,
  active BOOLEAN DEFAULT true,
  created_at TIMESTAMP DEFAULT NOW(),
  updated_at TIMESTAMP DEFAULT NOW()
);

-- Tips
CREATE TABLE tips (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  category_id VARCHAR(50) REFERENCES tip_categories(id),
  title_vi VARCHAR(100) NOT NULL,
  title_en VARCHAR(100) NOT NULL,
  content_vi TEXT NOT NULL,
  content_en TEXT NOT NULL,
  actionable BOOLEAN DEFAULT false,
  action_vi VARCHAR(50),
  action_en VARCHAR(50),
  action_type VARCHAR(50),
  action_data JSONB DEFAULT '{}',
  regions TEXT[] DEFAULT '{}',
  crops TEXT[] DEFAULT '{}',
  conditions JSONB DEFAULT '{}',
  urgency VARCHAR(20) DEFAULT 'medium',
  valid_from TIMESTAMP,
  valid_to TIMESTAMP,
  source VARCHAR(50) DEFAULT 'manual',
  active BOOLEAN DEFAULT true,
  view_count INT DEFAULT 0,
  dismiss_count INT DEFAULT 0,
  action_count INT DEFAULT 0,
  created_at TIMESTAMP DEFAULT NOW(),
  updated_at TIMESTAMP DEFAULT NOW()
);

-- Tip interactions
CREATE TABLE tip_interactions (
  id SERIAL PRIMARY KEY,
  tip_id UUID REFERENCES tips(id) ON DELETE CASCADE,
  device_id VARCHAR(255) NOT NULL,
  interaction_type VARCHAR(20) NOT NULL,
  region VARCHAR(50),
  language VARCHAR(10) DEFAULT 'vi',
  created_at TIMESTAMP DEFAULT NOW()
);

Tip Categories

IDVietnameseEnglishIcon
weather_alertCảnh báo thời tiếtWeather Alert🌤️
pest_diseaseSâu bệnhPest & Disease🐛
irrigationTưới tiêuIrrigation💧
plantingGieo trồngPlanting🌱
crop_careChăm sóc cây trồngCrop Care🌾
harvestingThu hoạchHarvesting🌿
post_harvestSau thu hoạchPost-Harvest📦
livestockChăn nuôiLivestock🐄
aquacultureThủy sảnAquaculture🐟
marketThị trườngMarket📈
seasonalMùa vụSeasonal📅
knowledgeKiến thứcKnowledge💡

Default Regions (Vietnam)

CodeVietnameseEnglish
mekong_deltaĐồng bằng sông Cửu LongMekong Delta
central_highlandsTây NguyênCentral Highlands
red_riverĐồng bằng sông HồngRed River Delta
coastalVùng ven biểnCoastal Region

Customization

Adding New Regions

Insert into tip_categories and update the region detection logic in src/index.js.

Adding New Categories

Insert into tip_categories table with appropriate icon and colors.

Changing Languages

The server supports any language pair. Update the _vi and _en field naming convention as needed.

License

MIT License - see for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.