mcp-pdp-server

mulyana08/mcp-pdp-server

3.2

If you are the rightful owner of mcp-pdp-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 dayong@mcphub.com.

MCP PDP Server is designed to handle queries related to the Personal Data Protection Act using RAG with Pinecone and Google Gemini.

Tools
4
Resources
0
Prompts
0

MCP PDP Server - UU No 27 Tahun 2022

Server MCP (Model Context Protocol) untuk menjawab pertanyaan terkait UU Perlindungan Data Pribadi menggunakan RAG dengan Pinecone dan Google Gemini.

🚀 Quick Start (Local)

# 1. Setup virtual environment
python3.11 -m venv venv
source venv/bin/activate

# 2. Install dependencies
pip install -r requirements.txt

# 3. Setup environment variables
cp .env.example .env
# Edit .env dengan API keys Anda

# 4. Run server
python -m src.server

🐳 Docker

Build & Run Locally

docker build -t mcp-pdp-server .
docker run -d --name mcp-pdp-server \
  -p 8000:8000 \
  -e GOOGLE_API_KEY=your_key \
  -e PINECONE_API_KEY=your_key \
  -e PINECONE_INDEX_NAME=uu-pdp-27-2022 \
  mcp-pdp-server

Docker Compose

# Edit .env file terlebih dahulu
docker-compose up -d

🔧 GitHub Actions Deployment

Setup GitHub Secrets

Buka repository GitHub → Settings → Secrets and variables → Actions → New repository secret

Tambahkan secrets berikut:

Secret NameValueKeterangan
SSH_HOST103.164.191.212IP server
SSH_PORT22193SSH port
SSH_USERdevjcSSH username
SSH_PRIVATE_KEY(isi file devops01_openssh.pem)SSH private key (OpenSSH format)
DEPLOY_PATH/home/devjc/mcp-pdp-serverPath di server
GHCR_TOKEN(GitHub PAT)Token untuk pull image
GOOGLE_API_KEYAIzaSyBKJy...Google API key
PINECONE_API_KEYpcsk_6Rn8S4...Pinecone API key
PINECONE_INDEX_NAMEuu-pdp-27-2022Nama index Pinecone

Cara mendapatkan SSH_PRIVATE_KEY

cat devops01_openssh.pem
# Copy seluruh isi file termasuk -----BEGIN RSA PRIVATE KEY----- dan -----END RSA PRIVATE KEY-----

Cara mendapatkan GHCR_TOKEN

  1. Buka https://github.com/settings/tokens
  2. Generate new token (classic)
  3. Beri nama: GHCR Deploy Token
  4. Pilih scope: read:packages, write:packages
  5. Copy token dan simpan sebagai secret GHCR_TOKEN

📦 CI/CD Pipeline

Push ke main/master
       │
       ▼
   ┌─────────┐
   │  Test   │ ← Syntax check Python
   └────┬────┘
        │
        ▼
   ┌─────────┐
   │  Build  │ ← Build Docker image
   └────┬────┘
        │
        ▼
   ┌─────────┐
   │  Push   │ ← Push ke ghcr.io
   └────┬────┘
        │
        ▼
   ┌─────────┐
   │ Deploy  │ ← SSH ke server, pull & run
   └─────────┘

🛠️ Manual Deployment

SSH ke server dan jalankan:

# Download deploy script
curl -O https://raw.githubusercontent.com/mulyana08/latihan_mcp/main/scripts/deploy.sh
chmod +x deploy.sh

# Setup .env
cat > .env << EOF
GOOGLE_API_KEY=your_key
PINECONE_API_KEY=your_key
PINECONE_INDEX_NAME=uu-pdp-27-2022
EOF

# Deploy
./deploy.sh

📋 MCP Tools

Server ini menyediakan tools berikut:

ToolDeskripsi
tanya_pdpTanya jawab tentang UU PDP menggunakan RAG
cari_pasalCari pasal tertentu dalam UU PDP
ringkasan_babDapatkan ringkasan per bab
info_uu_pdpInformasi umum tentang UU PDP

📁 Project Structure

latihan_mcp/
├── src/
│   ├── server.py          # MCP Server
│   ├── pdp_tools.py        # Tool definitions
│   ├── document/
│   │   ├── pdf_loader.py   # PDF extractor
│   │   └── chunker.py      # Text chunker
│   └── rag/
│       ├── embeddings.py   # Google embeddings
│       ├── pinecone_client.py # Vector DB
│       └── retriever.py    # RAG retriever
├── data/
│   └── uu_pdp_27_2022.pdf  # Dokumen UU PDP
├── scripts/
│   └── deploy.sh           # Deploy script
├── .github/
│   └── workflows/
│       └── deploy.yml      # GitHub Actions
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
└── README.md

📝 License

MIT