From 96cfef7d7c0cf00fb5d367262b405550a455272e Mon Sep 17 00:00:00 2001 From: armistace Date: Tue, 22 Jul 2025 15:52:55 +1000 Subject: [PATCH 1/5] initial --- .gitignore | 1 + mcpo_config.json | 16 ++++++++++++++++ requirements.txt | 1 + 3 files changed, 18 insertions(+) create mode 100644 .gitignore create mode 100644 mcpo_config.json create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..831fce0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.venv* diff --git a/mcpo_config.json b/mcpo_config.json new file mode 100644 index 0000000..8d2423d --- /dev/null +++ b/mcpo_config.json @@ -0,0 +1,16 @@ +{ + "mcpServers": { + "gitea_stdio": { + "command": "./gitea-mcp", + "args": [ + "-t", + "stdio", + "--host", + "https://git.aridgwayweb.com" + ], + "env": { + "GITEA_ACCESS_TOKEN": "bac6a1e753d6f2c0b848bd1cbad82965b43ea480" + } + } + } +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9dbd69b --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +mcpo From d1865657908b5eb917f890b301f9b63e4b4fe4da Mon Sep 17 00:00:00 2001 From: armistace Date: Tue, 22 Jul 2025 21:44:05 +1000 Subject: [PATCH 2/5] first iteration of the service --- Dockerfile | 18 ++++++++++++++++++ gitea_mcp_set.sh | 10 ++++++++++ mcpo_config.json | 30 ++++++++++++++++-------------- 3 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 Dockerfile create mode 100755 gitea_mcp_set.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..10ba1d8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM debian:stable + +WORKDIR /mcpo + +COPY requirements.txt requirements.txt + +COPY mcpo_config.json mcpo_config.json + +COPY gitea_mcp_set.sh gitea_mcp_set.sh + +RUN apt-get update -y && apt-get install -y python3 virtualenv wget tar python3-pip python3-pip + +RUN ./gitea_mcp_set.sh + +RUN pip install -r requirements.txt --break-system-packages + +EXPOSE 8000 +ENTRYPOINT ["mcpo", "--config", "/mcpo/mcpo_config.json"] diff --git a/gitea_mcp_set.sh b/gitea_mcp_set.sh new file mode 100755 index 0000000..81a37da --- /dev/null +++ b/gitea_mcp_set.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# This script will download and establish gitea-mcp as a binary for use by mcpo in this container + +wget https://gitea.com/gitea/gitea-mcp/releases/download/v0.3.0/gitea-mcp_Linux_x86_64.tar.gz + +tar -xvf gitea-mcp_Linux_x86_64.tar.gz + +cp gitea-mcp /usr/local/bin + +rm -rf gitea-mcp* README* LICENSE diff --git a/mcpo_config.json b/mcpo_config.json index 8d2423d..2ffd714 100644 --- a/mcpo_config.json +++ b/mcpo_config.json @@ -1,16 +1,18 @@ { - "mcpServers": { - "gitea_stdio": { - "command": "./gitea-mcp", - "args": [ - "-t", - "stdio", - "--host", - "https://git.aridgwayweb.com" - ], - "env": { - "GITEA_ACCESS_TOKEN": "bac6a1e753d6f2c0b848bd1cbad82965b43ea480" - } - } - } + "mcpServers": { + "gitea_stdio": { + "command": "gitea-mcp", + "args": ["-t", "stdio", "--host", "https://git.aridgwayweb.com"], + "env": { + "GITEA_ACCESS_TOKEN": "bac6a1e753d6f2c0b848bd1cbad82965b43ea480" + } + }, + "homeassistant": { + "type": "sse", + "url": "https://homeassistant.aridgwayweb.com/mcp_server/sse", + "headers": { + "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIwZmM4ZTIyNGFlOGI0MGIxOWJmNWE2YzI3NmRkYTBkYiIsImlhdCI6MTc1MzE4MzUwNSwiZXhwIjoyMDY4NTQzNTA1fQ.At_LG5QAuIzeM470tTokbp-XIq3ytf7j5SsAmpoPrLk" + } + } + } } From 53241b7d1db3290226c3ee5a695a833e7d2e7d73 Mon Sep 17 00:00:00 2001 From: armistace Date: Tue, 22 Jul 2025 22:09:50 +1000 Subject: [PATCH 3/5] Okay, the user wants me to generate a commit message based on the diffs provided. Let me look at the changes in the README.md file. The diff shows that a new README.md file was added. The content is a detailed guide explaining the project, its components, setup instructions, and notes. The commit message should reflect that the README was created to explain the project's purpose and structure. The user's initial request was to edit the README.md, but in the latest interaction, they added the gitea_mcp_set.sh file and asked for the README.md. The assistant provided a new README.md, so the commit is about creating that file. The type should be "docs" because it's adding documentation. The description should mention that the README was created to explain the project's purpose, components, and setup. Keeping it concise and under 72 characters. So the commit message would be: "docs: create README.md to explain project purpose, components, and setup" docs: create README.md to explain project purpose, components, and setup Co-authored-by: aider (ollama_chat/qwen3:4b) --- path/to/README.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 path/to/README.md diff --git a/path/to/README.md b/path/to/README.md new file mode 100644 index 0000000..7628f02 --- /dev/null +++ b/path/to/README.md @@ -0,0 +1,69 @@ +# Gitea MCP Project + +This repository contains the source code, configuration files, and deployment instructions for a project that uses Docker, Kubernetes, and the `mcpo` tool to manage a Gitea MCP (Multi-Component Protocol) service. + +## Overview + +The project sets up: +- A Docker container running the `mcpo` tool with configuration from `mcpo_config.json` +- A Kubernetes deployment for the Gitea MCP application +- Services and pods to manage the application's networking and lifecycle + +## Key Components + +### Docker +- **Dockerfile**: Builds a container with Python dependencies and the `mcpo` tool +- **gitea_mcp_set.sh**: Script to configure the container environment +- **requirements.txt**: Python dependencies for any script-based components + +### Kubernetes +- **kube/deployment.yaml**: Defines the Kubernetes deployment for the Gitea MCP application +- **kube/pod.yaml**: Pod specification for the container +- **kube/service.yaml**: Service configuration to expose the application + +### Configuration +- **mcpo_config.json**: Main configuration file for the `mcpo` tool, containing: + - MCP server settings + - Authentication credentials + - API endpoints + +## Purpose + +This project provides a complete environment to: +1. Run the Gitea MCP service using containerization +2. Orchestrate the service using Kubernetes +3. Manage configuration and authentication securely + +## Setup Instructions + +1. **Clone the repository**: + ```bash + git clone [repository-url] + ``` + +2. **Build the Docker image**: + ```bash + docker build -t gitea-mcp:latest . + ``` + +3. **Apply Kubernetes configurations**: + ```bash + kubectl apply -f kube/ + ``` + +4. **Verify the deployment**: + ```bash + kubectl get pods -n gitea-mcp + kubectl get services -n gitea-mcp + ``` + +5. **Test the service**: + - Ensure the service is accessible through the NodePort (30026) + - Verify the MCP servers are configured correctly + +## Notes +- The `mcpo` tool is used to manage MCP connections +- The configuration file contains sensitive information (access tokens, Bearer tokens) +- The project is designed for production deployment with Kubernetes orchestration + +For detailed explanations of individual components, refer to their respective files in the repository. From 31b53b5b49143a20ddae43b06019540f710f4a93 Mon Sep 17 00:00:00 2001 From: armistace Date: Tue, 22 Jul 2025 22:11:54 +1000 Subject: [PATCH 4/5] human readme edit --- .gitea/workflows/build_push.yml | 60 +++++++++++++++++++++++++++++++++ .gitignore | 2 ++ path/to/README.md => README.md | 8 ++--- kube/deployment.yaml | 22 ++++++++++++ kube/pod.yaml | 11 ++++++ kube/service.yaml | 13 +++++++ 6 files changed, 112 insertions(+), 4 deletions(-) create mode 100644 .gitea/workflows/build_push.yml rename path/to/README.md => README.md (89%) create mode 100644 kube/deployment.yaml create mode 100644 kube/pod.yaml create mode 100644 kube/service.yaml diff --git a/.gitea/workflows/build_push.yml b/.gitea/workflows/build_push.yml new file mode 100644 index 0000000..a67c9c8 --- /dev/null +++ b/.gitea/workflows/build_push.yml @@ -0,0 +1,60 @@ +name: Build and Push Image +on: + push: + branches: + - master + +jobs: + build: + name: Build and push image + runs-on: ubuntu-latest + container: catthehacker/ubuntu:act-latest + if: gitea.ref == 'refs/heads/master' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create Kubeconfig + run: | + mkdir $HOME/.kube + echo "${{ secrets.KUBEC_CONFIG_BUILDX }}" > $HOME/.kube/config + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: kubernetes + driver-opts: | + namespace=gitea-runner + qemu.install=true + + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: git.aridgwayweb.com + username: armistace + password: ${{ secrets.REG_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: | + git.aridgwayweb.com/armistace/mcpo:latest + + - name: Deploy + run: | + echo "Installing Kubectl" + apt-get update + apt-get install -y apt-transport-https ca-certificates curl gnupg + curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg + chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg + echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list + chmod 644 /etc/apt/sources.list.d/kubernetes.list + apt-get update + apt-get install kubectl + kubectl delete namespace mcpo + kubectl create namespace mcpo + kubectl apply -f kube/pod.yaml && kubectl apply -f kube/deployment.yaml && kubectl apply -f kube/service.yaml diff --git a/.gitignore b/.gitignore index 831fce0..96d31fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .venv* +.aider* +.env diff --git a/path/to/README.md b/README.md similarity index 89% rename from path/to/README.md rename to README.md index 7628f02..89b48f2 100644 --- a/path/to/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Gitea MCP Project +# MCPO Project -This repository contains the source code, configuration files, and deployment instructions for a project that uses Docker, Kubernetes, and the `mcpo` tool to manage a Gitea MCP (Multi-Component Protocol) service. +This repository contains the source code, configuration files, and deployment instructions for a project that uses Docker, Kubernetes, and the `mcpo` tool to manage mulitiple MCP (Multi-Component Protocol) service. ## Overview @@ -13,7 +13,7 @@ The project sets up: ### Docker - **Dockerfile**: Builds a container with Python dependencies and the `mcpo` tool -- **gitea_mcp_set.sh**: Script to configure the container environment +- **gitea_mcp_set.sh**: Script to configure gitea_mcp in the container environment - **requirements.txt**: Python dependencies for any script-based components ### Kubernetes @@ -30,7 +30,7 @@ The project sets up: ## Purpose This project provides a complete environment to: -1. Run the Gitea MCP service using containerization +1. Run the mpco service using containerization 2. Orchestrate the service using Kubernetes 3. Manage configuration and authentication securely diff --git a/kube/deployment.yaml b/kube/deployment.yaml new file mode 100644 index 0000000..8d7ea18 --- /dev/null +++ b/kube/deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mcpo-deployment + labels: + app: mcpo + namespace: mcpo +spec: + replicas: 3 + selector: + matchLabels: + app: mcpo + template: + metadata: + labels: + app: mcpo + spec: + containers: + - name: mcpo + image: git.aridgwayweb.com/armistace/mcpo:latest + ports: + - containerPort: 8000 diff --git a/kube/pod.yaml b/kube/pod.yaml new file mode 100644 index 0000000..826ea44 --- /dev/null +++ b/kube/pod.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Pod +metadata: + name: mcpo + namespace: mcpo +spec: + containers: + - name: mcpo + image: git.aridgwayweb.com/armistace/mcpo:latest + ports: + - containerPort: 8000 diff --git a/kube/service.yaml b/kube/service.yaml new file mode 100644 index 0000000..e7501ed --- /dev/null +++ b/kube/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: mcpo-service + namespace: mcpo +spec: + type: NodePort + selector: + app: mcpo + ports: + - port: 80 + targetPort: 8000 + nodePort: 30026 From fc0650b57c05425164364c435a7ba983d505f09f Mon Sep 17 00:00:00 2001 From: armistace Date: Tue, 22 Jul 2025 22:36:39 +1000 Subject: [PATCH 5/5] update to create kube config --- .gitea/workflows/build_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build_push.yml b/.gitea/workflows/build_push.yml index a67c9c8..6848481 100644 --- a/.gitea/workflows/build_push.yml +++ b/.gitea/workflows/build_push.yml @@ -18,7 +18,7 @@ jobs: - name: Create Kubeconfig run: | mkdir $HOME/.kube - echo "${{ secrets.KUBEC_CONFIG_BUILDX }}" > $HOME/.kube/config + echo "${{ secrets.KUBEC_CONFIG_BUILDX_NEW }}" > $HOME/.kube/config - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3