Tilbage til blog

Blog

Permissions and audit logs for AI agents that touch production

How platform teams scope MCP access, rotate credentials once, and keep an audit trail when agents query GitHub, Forge, and PostHog.

Af Andreas Gade Hjarnø

Fremhævede integrationer

Agents need the same controls as humans

Giving an AI client a personal GitHub PAT, a Forge API key, and a PostHog project token works until security asks three questions:

  • Which tools can this agent call?
  • Who rotated the credential last, and which clients still hold a copy?
  • Can we prove what the agent read during last night's incident?

Direct MCP connections answer none of those cleanly. Each vendor token lives in a different client config, scopes are all-or-nothing, and there is no shared audit log.

Centralize credentials, decentralize privilege

stackgate.ai's private gateway (/mcp/private) is the control plane between your agents and production systems:

  1. Connect once in the hub — OAuth or API keys stay in stackgate.ai; MCP clients never store upstream secrets.
  2. Issue scoped hub tokens — grant mcp:private-gateway plus only the integrations an agent needs (for example read-only GitHub + Forge, no deploy triggers).
  3. Audit every call — each tools/call records integration, tool name, and outcome for review after an incident.

Namespaced tools such as github__list-workflow-runs-tool, forge__list-deployments-tool, and PostHog query tools all share that trail.

What least privilege looks like in practice

Concern Gateway approach
On-call agent Token limited to GitHub, Forge, and PostHog — no CRM or mail access
Deploy safety Prefer read-only Forge scopes; require a human for trigger-deployment-tool
Credential rotation Rotate the Forge or GitHub secret in My Integrations; every client keeps the same hub bearer
Post-incident review Export audit logs for the incident window and attach them to the handoff

Where to start

  1. Connect GitHub, Forge, and PostHog under My Integrations.
  2. Create an API token scoped to those three integrations.
  3. Point your MCP client at the private gateway URL with that bearer token.
  4. Run list-services-tool, then a read-only call such as listing recent Forge deployments.

When you are ready for a full on-call flow — correlating PostHog spikes with deploys and CI — use the incident triage workflow playbook.

Prøv det relaterede workflow

Korrelér en produktionsfejl-spike med fejlende GitHub Actions-kørsler og Forge deploy-historik.