Files
conversation-history/SquareMCP/Infrastructure Fixes - 2026-04-28.md

130 lines
4.8 KiB
Markdown

# Infrastructure Fixes — 2026-04-28
Session with Kimi CLI debugging DNS, K8s self-healing, and a critical MCP server crash.
---
## 1. DNS Resolution Failure for squaremcp.com
**Symptom:** `squaremcp.com` was not resolving locally (SERVFAIL from systemd-resolved).
**Root cause:** ISP DNS servers (`68.94.156.1`, `68.94.157.1`) were returning empty responses for `squaremcp.com`. The domain was correctly configured at GoDaddy (authoritative NS: `ns23`/`ns24.domaincontrol.com`).
**Fix:** Switched the local machine's DNS to Google (`8.8.8.8`) and Cloudflare (`1.1.1.1`) via NetworkManager:
```bash
nmcli device modify enp2s0 ipv4.dns "8.8.8.8 1.1.1.1"
```
**Verification:** Both `squaremcp.com` and `fetcherpay.com` now resolve and return HTTP 200.
---
## 2. K8s Self-Healing Confirmation
**Question:** Will the deployments recover automatically after a server reboot?
**Answer:** Yes. Both sites are K8s Deployments with probes configured:
| Site | Deployment | Namespace | Replicas | Probes |
|------|-----------|-----------|----------|--------|
| `squaremcp.com` | `squaremcp-site` | `fetcherpay` | 1 | readiness + liveness |
| `hermes.fetcherpay.com` | `hermes-mcp` | `fetcherpay` | 1 | readiness + liveness |
| `fetcherpay.com` | `fetcherpay-marketing` | `fetcherpay-marketing` | 2 | — |
- `microk8s` is `enabled` to start on boot.
- No separate "healing script" is needed — the K8s controller manager handles it.
- `deploy-and-verify.sh` is only for manual builds/deploys, not for healing.
**Caveat:** `imagePullPolicy: Always` + `localhost:32000/...:latest` means pods try to pull from the local registry on restart. If the registry pod is slow to start, there can be a brief `ImagePullBackOff`, but containerd's local cache usually resolves this quickly.
---
## 3. Removed Broken Ghost Services
### `fetcherpay-marketing.service` (systemd)
- **Status:** Restarting in an infinite loop (>1,600 restarts).
- **Cause:** `/opt/fetcherpay-marketing/` was empty; `node server.js` failed with `MODULE_NOT_FOUND`.
- **Impact:** None on actual traffic — `fetcherpay.com` is served by the K8s `fetcherpay-marketing` Deployment.
- **Cleanup:**
```bash
sudo systemctl stop fetcherpay-marketing.service
sudo systemctl disable fetcherpay-marketing.service
sudo rm -f /etc/systemd/system/fetcherpay-marketing.service
sudo systemctl daemon-reload
sudo rm -rf /opt/fetcherpay-marketing
```
### `hermes-mcp` Docker container (redundant)
- **Status:** Restarting in a loop (3,961 restarts).
- **Cause:** `ECONNREFUSED 127.0.0.1:3306` — the Docker container could not reach MySQL because it was trying to connect to `localhost` instead of the Docker Compose `mysql` service.
- **Impact:** Competing for host port 3456 with the K8s pod (which uses `hostNetwork: true`).
- **Cleanup:**
```bash
docker rm -f hermes-mcp
```
---
## 4. Critical MCP Server Crash — ChatGPT Connection Failure
**Symptom:** ChatGPT clients got "Something went wrong with setting up the connection" during OAuth login.
**Root cause:** A code patch added a `ListResourcesRequestSchema` handler without adding `resources: {}` to the server's advertised capabilities. The MCP SDK's `Server.setRequestHandler()` throws synchronously when this mismatch occurs:
```
Error: Server does not support resources (required for resources/list)
```
This unhandled exception inside the Express `/mcp` handler crashed the Node.js process every time an authenticated client tried to initialize.
**Fix in `src/index.ts`:**
```typescript
// Before (broken)
const server = new Server(
{ name: 'hermes', version: '1.0.0' },
{ capabilities: { tools: {} } }
);
// After (fixed)
const server = new Server(
{ name: 'hermes', version: '1.0.0' },
{ capabilities: { tools: {}, resources: {} } }
);
```
Also added the handler:
```typescript
server.setRequestHandler(ListResourcesRequestSchema, async () => ({ resources: [] }));
```
**Verification:**
- Local `curl` to `POST /mcp` with `initialize` now returns HTTP 200 with correct capabilities.
- e2e tests pass.
- Vault writes via `obsidian_append_to_note` are confirmed working.
---
## Action Items
- [x] Fix DNS (switched to 8.8.8.8 / 1.1.1.1)
- [x] Remove broken systemd service
- [x] Remove broken Docker container
- [x] Patch MCP server capabilities
- [x] Rebuild and redeploy hermes-mcp + squaremcp-site
- [x] Verify e2e tests pass
- [ ] Monitor for any remaining ChatGPT client connection issues
## 5. ChatGPT Connection Verified — 2026-04-28 (Follow-up)
**Status:** ChatGPT is now successfully connecting to the MCP server.
**Confirmed working:**
- OAuth login no longer crashes the server
- ChatGPT client reaches `DEVELOPER MODE` (authenticated + tool access active)
- Vault writes via Hermes (`obsidian_append_to_note`) confirmed functional from ChatGPT session
**Action item update:**
- [x] Monitor for any remaining ChatGPT client connection issues — **RESOLVED**