GuanMCP Deployment Guide
Deployment Overview
GuanMCP supports two deployment modes: local stdio mode and production streamable-http mode.
| Mode | Scenario | Description |
|---|---|---|
stdio | Personal desktop clients, demos, development debugging | The MCP client starts a local GuanMCP process, usually representing one fixed user accessing one BI site. |
streamable-http | Enterprise AI platform or gateway integration | GuanMCP runs as a resident HTTP service. Clients call it through POST /mcp. |
stdio is a local fixed-user solution and is not suitable for enterprise multi-user access. For enterprise multi-user scenarios, use streamable-http mode and deploy through Kubernetes, an enterprise container platform, or a gateway.
The Kubernetes ConfigMap, Secret, Deployment, and Service are the base deployment files.
Roles and Responsibilities Before Deployment
GuanMCP usually requires collaboration among BI administrators, IT/O&M, and AI platform administrators.
| Item | Recommended Owner | Description |
|---|---|---|
| BI access URL and public path | BI administrator / O&M | Confirm BI_BASE_URL and BI_PUBLIC_PATH. |
| MCP service domain, gateway, and certificate | IT/O&M | Confirm that the external AI platform can access /mcp. |
| Entry authentication token | IT/O&M | Generate and manage MCP_ENTRYPOINT_TOKEN through Secret. |
| Account synchronization token | BI administrator | Obtain the token from GuanBI before deployment and write it to Secret as BI_APP_TOKEN. |
| User identity mapping | BI administrator / AI platform administrator | Confirm how users from DecideX or an enterprise-built assistant map to GuanBI users. See the Custom Enterprise MCP Integration Guide. |
| Pilot resources and test accounts | BI administrator / business owner | Prepare pilot metrics, pages, ChatBI topics, and accounts with different permissions. |
For demos or development debugging, you can start with local stdio or temporary fixed-user HTTP validation. For production multi-user use, switch to real user identity passing and permission isolation.
Local stdio Deployment
Local stdio mode is suitable for personal desktop clients, demos, and development debugging. The client starts a local GuanMCP process that accesses one BI site as one fixed user.
Login Methods
Choose one:
| Login Method | Description |
|---|---|
BI_PAT | Log in with the current user's personal access token (recommended). |
BI_UID_TOKEN | Log in with the current user's token. |
BI_LOGIN_DOMAIN, BI_LOGIN_ID, BI_LOGIN_PASSWORD | Log in with account and password. |
Client Configuration Example
Add the service configuration in an MCP-supported client. The core settings are BI URL and current-user login information.
{
"mcpServers": {
"guanbi": {
"command": "npx",
"args": ["-y", "@guandata/guanbi-mcp-server@latest"],
"env": {
"BI_BASE_URL": "https://your-bi-host.example.com",
"BI_UID_TOKEN": "current-user-token"
}
}
}
}
If using account/password login, replace BI_UID_TOKEN with the corresponding account/password environment variables.
Production HTTP Deployment
Production should use streamable-http mode. The image listens on 0.0.0.0:9090 by default.
Key Endpoints
| Endpoint | Purpose |
|---|---|
| POST /mcp | MCP call entry |
| GET /healthz | Health check |
| GET /sysmon/health/liveness | Liveness probe |
| GET /sysmon/health/readiness | Readiness probe |
Routing Suggestions
- Prefer a dedicated domain, such as
https://guanbi-mcp.example.com/mcp. - If reusing the BI domain, use an independent prefix and rewrite it to backend
/mcpin the gateway. - Multiple replicas require sticky routing by Mcp-Session-Id. If sticky routing cannot be configured, start with a single replica.
Prepare Before Deployment
Confirm BI Access URL
In guanbi-mcp-server-configmap.yaml, set BI_BASE_URL to the actual BI URL accessible by the customer.
BI_BASE_URL: "https://your-bi-host.example.com"
Configure BI_PUBLIC_PATH according to the BI access path:
| BI Access Method | BI_PUBLIC_PATH |
|---|---|
No path prefix, such as https://bi.example.com | / |
With path prefix, such as https://bi.example.com/guanbi | /guanbi |
BI_PUBLIC_PATH: "/"
# or
BI_PUBLIC_PATH: "/guanbi"
Generate MCP Entry Token
MCP_ENTRYPOINT_TOKEN is used by clients to connect to the MCP service. Generate it separately and inject it through Kubernetes Secret.
openssl rand -base64 32
Create guanbi-mcp-server-secret.yaml:
apiVersion: v1
kind: Secret
metadata:
name: guanbi-mcp-server
type: Opaque
stringData:
MCP_ENTRYPOINT_TOKEN: "<replace_with_generated_token>"
Send the generated token securely. Do not commit real tokens to code repositories, ticket attachments, or public documents.
Kubernetes Configuration Files
guanbi-mcp-server-configmap.yaml
kind: ConfigMap
apiVersion: v1
metadata:
name: guanbi-mcp-server
data:
MCP_TRANSPORT: streamable-http
MCP_HTTP_HOST: "0.0.0.0"
MCP_HTTP_PORT: "9090"
BI_BASE_URL: "https://your-bi-host.example.com"
BI_PUBLIC_PATH: "/"
BI_REQUEST_TIMEOUT_MS: "120000"
BI_MAX_ROWS: "1000"
GUANBI_MCP_USAGE_STATS: ""
MCP_TRUSTED_GATEWAY: "false"
guanbi-mcp-server-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: guanbi-mcp-server
type: Opaque
stringData:
MCP_ENTRYPOINT_TOKEN: "<replace_with_generated_mcp_entry_token>"
guanbi-mcp-server-controller.yaml
kind: Deployment
apiVersion: apps/v1
metadata:
name: guanbi-mcp-server-controller
spec:
replicas: 1
selector:
matchLabels:
app: guanbi-mcp-server
template:
metadata:
labels:
app: guanbi-mcp-server
spec:
imagePullSecrets:
- name: gd-cr-registry
containers:
- name: guanbi-mcp-server
image: guandata-registry.cn-hangzhou.cr.aliyuncs.com/guandata/guanbi-mcp-server:0.1.14
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: guanbi-mcp-server
env:
- name: TZ
value: Asia/Shanghai
- name: MCP_ENTRYPOINT_TOKEN
valueFrom:
secretKeyRef:
name: guanbi-mcp-server
key: MCP_ENTRYPOINT_TOKEN
optional: false
ports:
- name: http
containerPort: 9090
livenessProbe:
httpGet:
path: /sysmon/health/liveness
port: 9090
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
readinessProbe:
httpGet:
path: /sysmon/health/readiness
port: 9090
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 1000m
memory: 1Gi
Replace image with the actual image address and version for the customer environment. If the customer uses a private registry, confirm image pull credentials are configured.
guanbi-mcp-server-service.yaml
kind: Service
apiVersion: v1
metadata:
name: guanbi-mcp-server
spec:
type: ClusterIP
ports:
- name: http
port: 9090
targetPort: 9090
selector:
app: guanbi-mcp-server
This example uses ClusterIP. To expose the service externally, configure Ingress, gateway, or another exposure method according to the customer environment.
Deployment Steps
kubectl apply -f guanbi-mcp-server-configmap.yaml
kubectl apply -f guanbi-mcp-server-secret.yaml
kubectl apply -f guanbi-mcp-server-controller.yaml
kubectl apply -f guanbi-mcp-server-service.yaml
Check Pod and Service status:
kubectl get pod -l app=guanbi-mcp-server
kubectl get svc guanbi-mcp-server
View startup logs:
kubectl logs -l app=guanbi-mcp-server --tail=200
If the customer cluster uses a non-default namespace, add -n <namespace> to all kubectl apply and check commands.
Client Integration
HTTP Client
Call the MCP entry:
POST https://guanbi-mcp.example.com/mcp
If trusted gateway is not enabled, include:
Authorization: Bearer <mcp_service_token>
Then pass the current real user identity according to the identity solution:
| Identity Method | Request Carries | Scenario |
|---|---|---|
| Direct uIdToken | X-GuanBI-Uid-Token: <current_user_uid_token> | Upstream already has GuanBI user token. |
| loginId exchange | X-GuanBI-Login-Id: <current_user_login_id> | Upstream can confirm GuanBI loginId. |
| External account mapping | <external-user-header>: <external_user_id> | Upstream has an external business system account ID. |
Prefer gateway-injected identity headers and drop same-name headers from external requests.
Key Configuration
| Configuration | Description |
|---|---|
BI_BASE_URL | Required. BI site accessed by the current MCP service. |
BI_PUBLIC_PATH | Required. Use / when there is no prefix; use the corresponding prefix such as /guanbi when deployed under a sub-path. |
MCP_TRANSPORT | stdio or streamable-http. |
BI_UID_TOKEN | Local user token for stdio. |
BI_LOGIN_DOMAIN / BI_LOGIN_ID / BI_LOGIN_PASSWORD | Local account/password login for stdio. |
MCP_ENTRYPOINT_TOKEN | HTTP entry credential. Store it in Secret. |
MCP_TRUSTED_GATEWAY | When set to true, MCP_ENTRYPOINT_TOKEN is not required. Enable only when a trusted gateway already authenticates and injects identity. |
BI_APP_TOKEN | Server-side key for identity exchange. Must be stored in Secret. Not needed for base deployment. |
BI_LOGIN_ID_HEADER | loginId identity header. Default: x-guanbi-login-id. |
BI_USER_PROPERTY_HEADER / BI_USER_PROPERTY_KEY | Used when mapping external accounts to BI users. |
BI_MAX_ROWS | SQL row limit. Default: 1000. |
GUANBI_MCP_USAGE_STATS | Set to 0, false, off, or no to disable anonymous statistics. |
Permissions and Security Boundaries
- MCP entry credentials only prove that the caller can access MCP, not that the caller can view BI data.
- BI data permissions are determined by GuanBI according to the current user identity.
- HTTP mode must resolve the current real user on every request. Do not query for all users through a process-level fixed user.
x-tenant-id,x-end-user-id, andx-trace-idare for observability only and cannot replace BI authorization.BI_APP_TOKENmust be stored on the server and must not be passed from clients.- Identity exchange debug is only for temporary troubleshooting and should be disabled afterward.
- GuanMCP only reports aggregated tool-call statistics by default. It does not collect questions, SQL, tokens, returned content, or user identity.
Launch Acceptance
Before launch, check:
- Health checks are normal.
get_bi_capabilitiescan show BI site, run mode, and tool list.- Low-permission users can only access BI resources they are allowed to access.
- HTTP requests without entry credentials are rejected unless trusted gateway is enabled.
- The enterprise platform passes the authenticated current user's identity dynamically and maps it to one enabled BI user.
- Card flow works: search resource -> read card information -> read data in read-only mode.
- Metric flow works: search metric -> read definition -> query data.
- ChatBI flow works: list topics -> ask question -> view result.
- SQL flow confirms BI version and Advanced SQL switch; table names use dataset display names.
Use at least two accounts for acceptance: one high-permission account and one regular business account. The same question should return scopes consistent with each user's BI permissions.
Common Misunderstandings
- Tool visibility does not mean the user has resource permission.
BI_APP_TOKENmust not be passed by clients; it is stored only on the server.- Normal card queries read saved results in read-only mode and do not modify cards.
- SQL query is not always available by default. It depends on BI capabilities and switches.
Notes
BI_BASE_URLmust be the actual BI address accessible by the customer.BI_PUBLIC_PATHmust match the customer's BI access prefix; use/when there is no prefix.MCP_ENTRYPOINT_TOKENandBI_APP_TOKENare sensitive and must be managed through Secret. Do not write them in plaintext YAML, repositories, or public documents.BI_APP_TOKENis only required for account synchronization or external account mapping. It is not required for base deployment.- The example image version is 0.1.14; confirm the image tag before deployment if a specific version is required.
- The example Service type is
ClusterIP. To expose externally, configure Ingress, gateway, or another method based on the customer environment. - If the customer cluster namespace is not default, add
-n <namespace>to allkubectl applyand check commands.