Attestable MCP Server in Gramine TEE with RA-TLS
Verify an MCP server in a Gramine TEE using RA-TLS to enable client-side remote attestation before connecting.
npx -y @co-browser/attestable-mcp-serverOverview
This repository implements an MCP (Model Context Protocol) server that runs inside a Gramine Trusted Execution Environment (TEE) and exposes an RA‑TLS-capable endpoint so clients can perform remote attestation before they connect. RA‑TLS extends TLS certificates with attestation evidence from the enclave, enabling clients to verify the server enclave identity and integrity as part of the TLS handshake or during certificate validation.
Running the MCP server inside Gramine helps isolate sensitive model/context state, keys, and inference logic from the host. The RA‑TLS flow prevents clients from sending secrets or private data to an untrusted host by requiring proof that the server is executing the expected code and configuration inside the TEE before any confidential interaction.
Features
- RA‑TLS-enabled TLS certificate generation and server runtime that embed enclave attestation evidence
- Server packaged to run inside Gramine (supports TEE-enabled platforms such as Intel SGX / other Gramine-supported backends)
- Example build and runtime scripts for creating attested server binaries and Gramine manifests
- Client-side guidance to verify attestation evidence before exchanging sensitive data
- Minimal MCP protocol example to demonstrate attestation-first connection patterns
Installation / Configuration
Prerequisites
- Linux host with TEE support (e.g., Intel SGX) enabled and appropriate kernel drivers
- Gramine runtime installed and configured (see Gramine docs)
- Docker or Podman (optional, for building images)
- go / rust / build tools if building from source (language depends on the implementation in the repo)
Clone and build
# Example build (adjust for actual build system: make, go build, cargo build)
Generate RA‑TLS cert/key (example)
# This is an example; actual project includes scripts for producing
# a certificate that contains attestation evidence (RA-TLS style).
# The script will call the Gramine attestation tooling / quoting service.
Run the server inside Gramine
# Run server under Gramine with the generated cert/key
# Replace gramine-sgx with the appropriate gramine runner on your system.
Run with Docker (optional)
# Build container (example)
# Run with access to SGX device and Gramine support (host-specific)
Client-side verification (example)
# Use openssl to fetch the server cert (or use the included client verifier)
| \
# Then run the project's attestation verifier on the certificate
Adjust these commands to match the build and runtime tooling provided in the repository (scripts and README inside the project show the exact commands).
Available Resources
- Project repository: https://github.com/co-browser/attestable-mcp-server
- Gramine project and docs: https://gramineproject.io
- RA‑TLS overviews and examples: look for “RA-TLS” in Gramine and enclave vendor documentation
- Attestation services: vendor-specific services (Intel, AMD, cloud attestation services) and local DCAP tools depending on platform
Included in the repo
- Build scripts and Dockerfile(s)
- Example Gramine manifest(s) for enclave packaging
- Scripts to produce RA‑TLS certificates with embedded attestation evidence
- A simple MCP server implementation and a lightweight client/verifier
Use Cases
- Secure model serving: Clients verify the server enclave with RA‑TLS before sending private inputs for inference, ensuring the model and code are running in a trusted enclave.
- Federated learning aggregation: Participants only send gradients or model updates after verifying the aggregator runs inside an attested TEE, protecting contributors from a malicious aggregator.
- Privacy-preserving APIs: Sensitive analytics or context enrichment services accept data only after clients confirm enclave authenticity.
- Developer testing and research: Rapidly iterate on enclave-enabled application patterns that require attestation-first connection guarantees.
Tips for Developers
- Start by running the included verifier on the example certificate to understand the attestation payload format and verification steps.
- Validate your environment (SGX drivers, Gramine installation) with Gramine’s sample apps before attempting to run the MCP server.
- Customize the Gramine manifest to declare file system and network access minimally — principle of least privilege reduces attack surface.
- When integrating into production, plan for remote attestation service availability (cloud vendor attestation or on-prem verification tooling) and certificate lifecycle management.
For detailed, environment-specific commands and the exact build/run scripts, consult the repository’s README and scripts folder.