All posts

Audit logging for MCP servers on AWS

How can you be sure every request to an MCP server on AWS is captured for audit logging? In many organizations the first instinct is to grant a service account a long‑lived AWS credential and let the application talk directly to the MCP endpoint. The credential is often stored in a shared secret manager, copied into CI pipelines, and used by multiple services without a single point of visibility. When a request fails, or when a data breach is suspected, there is no reliable trail that shows who

Free White Paper

K8s Audit Logging + AWS IAM Policies: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

How can you be sure every request to an MCP server on AWS is captured for audit logging? In many organizations the first instinct is to grant a service account a long‑lived AWS credential and let the application talk directly to the MCP endpoint. The credential is often stored in a shared secret manager, copied into CI pipelines, and used by multiple services without a single point of visibility. When a request fails, or when a data breach is suspected, there is no reliable trail that shows who invoked which API, what parameters were passed, or what response was returned.

This practice leaves three critical gaps. First, the credential itself becomes a high‑value target; any compromise grants unrestricted access to every MCP server in the account. Second, because the traffic bypasses any central control plane, the organization cannot enforce policies such as masking of sensitive fields or blocking of dangerous commands. Third, without a unified log, compliance audits become a manual effort of stitching together CloudTrail entries, application logs, and ad‑hoc instrumentation, none of which guarantee completeness.

The immediate need is clear: teams want audit logging for MCP servers while still allowing their existing applications to reach the service. In other words, they need a way to capture every request and response without redesigning the client code or altering the network topology. The precondition fixes the visibility problem – the request now has a place where it can be observed – but the request still travels directly to the MCP endpoint, meaning no inline masking, no just‑in‑time approval, and no guarantee that the recorded data cannot be tampered with by the client process.

Why audit logging matters for MCP servers on AWS

MCP servers often host proprietary models, confidential prompts, or downstream data pipelines. A single rogue request can exfiltrate intellectual property or corrupt a model’s training data. Auditing provides three concrete benefits. It creates an immutable record of who called which endpoint, it enables post‑incident forensics, and it satisfies regulatory expectations for traceability. However, audit logging is only effective when the log is generated at the point where the request is actually executed, not after the fact in a downstream system.

The missing control plane

In the current setup, the control plane is split between the identity provider that issues the AWS credential and the MCP service that processes the request. The identity provider defines who can obtain the credential, but it does not see the individual API call. The MCP service sees the call but has no knowledge of the original requester’s identity beyond the credential itself. This separation means that any enforcement – masking, command approval, or session replay – must be built into the application code, which is error‑prone and hard to standardize across teams.

Embedding audit logging with hoop.dev

hoop.dev solves the problem by becoming the sole data‑path gateway for MCP traffic. It sits between the identity layer and the AWS‑hosted MCP endpoint, acting as an identity‑aware proxy that inspects every wire‑level request. Because the gateway is the only place the request passes, hoop.dev can record the full request and response, apply inline masking to any fields marked as sensitive, and enforce just‑in‑time approvals for high‑risk operations.

From a setup perspective, organizations continue to use their existing OIDC or SAML identity provider. Users authenticate once, receive a token, and present that token to hoop.dev. The gateway validates the token, extracts group membership, and decides whether the user is allowed to initiate a session. The actual AWS credential used to reach the MCP server is stored securely inside the gateway; the client never sees it.

Continue reading? Get the full guide.

K8s Audit Logging + AWS IAM Policies: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Once a session is established, hoop.dev records each interaction in a log that lives outside the client process. The log includes the user identity, timestamp, request payload, and response metadata. Because the gateway controls the flow, it can also mask any secret fields before they are written to the log, ensuring that compliance‑sensitive data does not leak into storage.

In addition to audit logging, hoop.dev can trigger an approval workflow for commands that match a risk policy. For example, a request that attempts to delete a model can be paused and require a manager’s sign‑off before the gateway forwards it to the MCP server. This capability further reduces the blast radius of accidental or malicious actions.

Key enforcement outcomes

  • hoop.dev records each MCP request and response, providing a complete audit trail.
  • hoop.dev masks configured sensitive fields in the stored logs, protecting secret data.
  • hoop.dev enforces just‑in‑time approvals for high‑risk operations, adding a human check before execution.
  • hoop.dev isolates the AWS credential from the client, eliminating credential sprawl.

All of these outcomes are possible only because hoop.dev occupies the data path. The identity provider alone cannot produce these results, and the MCP server alone cannot enforce them without a proxy.

Getting started

To implement audit logging for MCP servers on AWS, follow the high‑level steps outlined in the getting‑started guide. Deploy the gateway near your MCP service, register the MCP endpoint as a connection, and configure the desired masking and approval policies through the web UI. The documentation on how hoop.dev handles masking and session recording provides deeper insight into policy definition.

FAQ

Does hoop.dev replace CloudTrail?

No. CloudTrail records AWS API activity, while hoop.dev records the application‑level MCP requests that travel through the gateway. Together they give a full picture of both infrastructure and business‑logic actions.

Can I use existing AWS IAM roles with hoop.dev?

Yes. The gateway stores the role credentials and uses them to reach the MCP server. Users never handle the role directly.

Is the audit log stored in an immutable store?

hoop.dev writes logs to a durable backend configured by the operator. The design ensures that the logs cannot be altered by the client that initiated the request.

For a complete view of the source code, contribution guidelines, and to spin up your own instance, visit the GitHub repository.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts