7e7820f823
The server has to be reachable by the Harness, Claude Code and Codex, and all three of those are clients of an address rather than of a source tree — a stdio child process only serves whichever machine spawned it. So it is packaged and deployed: namespace `paper-doc`, one Deployment, one NodePort Service at `http://192.168.1.88:30931/mcp` behind a bearer token, talking to the in-cluster TiDB Service rather than the node's NodePort. The namespace is `paper-doc` and not `paper_doc`, which is not a preference: a namespace name is an RFC 1123 label, underscores are outside that alphabet, and the API server rejects it outright. The database keeps its underscore. Two routes were added to the server for the deployment, and they are the only unauthenticated ones. `/healthz` answers "is this process alive" without touching anything, `/readyz` answers "can it serve" by running `SELECT 1`. The split is the point: a failing readiness probe takes the pod out of the Service's endpoints and puts it back when TiDB returns, while a failing liveness probe kills a process that was working correctly. There is no container runtime on this host — k3s runs containerd and neither `ctr` nor `crictl` builds from a Dockerfile — so `deploy/build-mcp-image.sh` builds inside a throwaway privileged docker-in-docker pod, mounting the working tree through a hostPath so the build context is the tree you are looking at, uncommitted edits included. It reads the registry credentials out of the cluster's own pull secret, so no password is in the script or in a shell history. One Dockerfile serves both entry points, because the API and the MCP server share the domain layer and differ by one argv. Verified against the deployed Service, not against a local process: 47 MCP checks pass over the NodePort, and the Node MCP SDK — the one the Harness's mcp-client plugin uses — lists all 29 tools and calls them. The same 47 pass in stdio and against a local HTTP server, and the REST suite still passes its 45.
26 lines
953 B
YAML
26 lines
953 B
YAML
# Template for the paper-doc Secret. Do not fill this file in and commit it —
|
|
# create the real Secret out of band, so the values live in the cluster and not
|
|
# in git history:
|
|
#
|
|
# kubectl -n paper-doc create secret generic paper-doc-secrets \
|
|
# --from-literal=DB_USER='Govin' \
|
|
# --from-literal=DB_PASSWORD='<tidb-password>' \
|
|
# --from-literal=MCP_HTTP_TOKEN="$(openssl rand -hex 32)"
|
|
#
|
|
# Rotating the token is then one `kubectl create secret ... --dry-run=client -o
|
|
# yaml | kubectl apply -f -` plus a rollout restart, and no image rebuild.
|
|
#
|
|
# The registry pull secret is separate and not described here: it is
|
|
# `aliyun-acr`, copied into this namespace from `default`, and it holds the
|
|
# container registry's credentials rather than the application's.
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: paper-doc-secrets
|
|
namespace: paper-doc
|
|
type: Opaque
|
|
stringData:
|
|
DB_USER: Govin
|
|
DB_PASSWORD: change-me
|
|
MCP_HTTP_TOKEN: change-me
|