# Cortex Cloud

> Your own AI memory, in the cloud you own. Deploy a private, single-owner AI memory service (web Hub + MCP for any AI) to Azure in ~15 minutes.

- **Type:** MCP server
- **Install:** `agentstack add mcp-turfptax-cortex-cloud`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [turfptax](https://agentstack.voostack.com/s/turfptax)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [turfptax](https://github.com/turfptax)
- **Source:** https://github.com/turfptax/Cortex-Cloud

## Install

```sh
agentstack add mcp-turfptax-cortex-cloud
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

Your own AI memory, in the cloud you own.
  Deploy a private, single-owner AI memory service to Azure in about 15 minutes.

  
  
  
  
  
  

---

**Cortex Cloud** turns [Cortex](https://github.com/turfptax/cortex-core), a personal
AI memory engine, into a private website. Sign in with your Microsoft account and your
entire memory corpus becomes a URL: searchable from any browser or phone, and readable
by your AI assistants (Claude, ChatGPT, Grok) over the [Model Context
Protocol](https://modelcontextprotocol.io). It is one Azure Container App that scales to
zero, so at rest it costs a few dollars a month, and it is locked to exactly one person:
you.

> No shared servers, no multi-tenant database, no vendor lock-in. Your corpus, your keys,
> your Azure subscription, your bill. Clone this repo and you own the whole stack.

## Why

Most "AI memory" products keep your data on their servers and read it on their terms.
Cortex Cloud flips that: the memory lives in **your** cloud, gated by **your** identity
provider, and your AI tools connect to it as a first-class source rather than a scrape.
It is small enough to understand end to end and cheap enough to leave running.

|  |  |
|---|---|
| 🔒 **Single-owner by design** | Sign-in is locked to one Microsoft account. Others in your tenant cannot even get a session, and every API call is pinned to your identity. |
| 💤 **Scale-to-zero economics** | The app sleeps when idle and wakes on the first request. Roughly $7 to $9 a month, most of it just the registry and storage. |
| 🧠 **Semantic recall built in** | An embedding server ships in the same image, so search understands meaning, not just keywords. |
| 🔌 **MCP for any AI** | Claude, ChatGPT, and Grok connect over OAuth 2.1 + PKCE, default-deny until you approve. An approved connection can read your corpus and log back into it. |
| 📱 **Any device** | A responsive web Hub, served from the same container, works from your desktop or your phone. No install. |
| 🗃️ **SQLite + Litestream** | The corpus is a plain SQLite file, continuously replicated to Blob storage and restored on cold start. No database server to run or pay for. |

## Quickstart

You need an Azure subscription, a Microsoft account, and an
[OpenRouter](https://openrouter.ai/keys) API key.

```bash
git clone https://github.com/turfptax/Cortex-Cloud.git
cd Cortex-Cloud
cp .env.example .env      # add your subscription, a unique suffix, your OWNER_OID, your name, your key
#                           OWNER_OID:  az ad signed-in-user show --query id -o tsv
#                           CORTEX_OWNER_NAME: how connecting AIs refer to you (blank = "the owner")

bash deploy/deploy.sh     # provisions everything, prints your URL
bash deploy/tick-job.sh   # schedules the memory loop
```

Open the printed URL, sign in with Microsoft, and you have an empty corpus ready to fill.
`deploy.sh` creates the resource group, registry, storage, Key Vault, the Entra app
(locked to you), builds the image from source, and deploys the Container App with
Microsoft sign-in wired up.

> **Run it once in a throwaway resource group first.** These scripts codify the exact
> sequence used to stand up the reference instance, and the README walks each of the nine
> steps. WSL, macOS, or Azure Cloud Shell give the smoothest `az` experience.

## Architecture

One Container App, four containers off a single image, sharing an ephemeral volume.
Only the gateway is public.

```
                 you (browser / phone)          AI assistants
                        |  Microsoft login          |  OAuth 2.1 + MCP
                        v                            v
        +--------------------------------------------------+
        |  gateway  :8430  (public)                        |
        |   /  SPA    /api facade    /oauth   /mcp   /ops   |
        +----------------------+---------------------------+
                        | localhost (service token)
        +---------------v-----------+   +--------------+
        |  core :8420 (private)     |-->|  embed :8082 |
        |  SQLite corpus + loop     |   +--------------+
        +---------------+-----------+
                        | litestream (continuous)
                   +----v----+
                   |  Blob   |   restored on cold start
                   +---------+
```

| Container | Role |
|-----------|------|
| **core** | the memory engine and interpretive loop; the only writer of the corpus |
| **gateway** | public ingress: the `/api` facade, the web Hub, the OAuth 2.1 server, the MCP endpoint |
| **embed** | a small llama.cpp server for semantic recall |
| **litestream** | streams the SQLite databases to Blob storage while the app is warm |
| *init:* **restore** | restores the databases from Blob on cold start, before the writer starts |

The gateway forwards browser requests to the co-located core with a service token
injected server-side, so the browser never holds a corpus credential. Its session is your
Microsoft sign-in, and nothing else.

## Security model

- **Sign-in is locked to one account.** The Entra app is single-tenant with
  `appRoleAssignmentRequired` on and only you assigned, so Microsoft refuses to issue a
  session to anyone else before any application code runs.
- **Owner pin in the app.** Every `/api` request is additionally checked against your
  Entra object id. A stray session gets 403, never the corpus.
- **Secrets never touch the repo.** The LLM key lives in Key Vault; the internal service
  token and storage key are Container App secrets. The image build refuses to stage any
  database or identity file, and this repo ships with none.
- **Connectors are least-privilege.** AI assistants authorize over OAuth 2.1 with PKCE,
  start with no access; approving a connection grants read and write together.

## What you get

Cortex organizes what it remembers into five pillars, and the goal is for every one of
them to be reachable both in the web Hub and over MCP, so any AI you connect can use them:

| Pillar | What it holds |
|---|---|
| **Memory** | your corpus: searchable by meaning and by keyword, layered from summaries down to raw source |
| **Projects** | what you are working on, rolled up over time |
| **People** | your contacts and the interactions with them |
| **Rules** | the hard-won defaults you want every AI to respect |
| **Skills** | a living record of how you do things |

Three engines keep it alive: an **Overseer** that curates memory in the background, a
**Lemon Squeezer** that turns your interactions into durable lessons, and **Simples**, a
planner that turns goals into time blocks. A copy-context page at `/intro` hands a portable
brief to any AI that is not connected.

The MCP surface exposes Memory (search, read, recent, ingest) and, as of the pillar
release, Projects, Rules, and Skills as first-class tools: an AI you connect can list
and read your projects, respect your standing tech rules, and browse your skills
portfolio. An approved connection can both read and write; the pillar write tools
(cortex_project_upsert, cortex_rule_add, cortex_skill_log) sit alongside cortex_ingest.
People is kept owner-only by design, and planning (Simples) is next. See [docs/VISION.md](docs/VISION.md).

## Repo layout

One repo, one app. The image builds from these subdirs in a single
multi-stage `deploy/Dockerfile`, no external checkouts.

```
core/               the memory engine + the Overseer loop (the `core` container)
gateway/            the FastAPI gateway: OAuth server, /api facade, MCP, SPA serving
  cortex_gateway/     the package
  tests/              the gateway test suite (pytest)
web/                the web Hub SPA source (React + Vite); built into the image
deploy/             infrastructure as code plus the deploy scripts
  Dockerfile               self-contained multi-stage build (SPA + runtime)
  containerapp.tmpl.yaml   the four-container app, parameterized
  deploy.sh                one-shot provision and deploy
  entra-setup.sh           the Microsoft sign-in app, locked to you
  build-image.sh           az acr build from the repo root
  tick-job.sh              schedule the memory loop
docs/               OAuth flow, connector grants, Entra setup, operator notes, vision
```

Build the image with `az acr build --file deploy/Dockerfile .` from the
repo root; the SPA is compiled inside the build.

**Already running an instance?** Read
[docs/OPERATOR_NOTES.md](docs/OPERATOR_NOTES.md) before you redeploy. It records
what each release changes for you and what it needs you to do.

## FAQ

**Is my data sent anywhere?** Only to the LLM you choose (via OpenRouter) for the memory
loop, and to your AI assistants when you explicitly grant them access. The corpus lives in
your Azure storage.

**Can I use a different LLM?** Yes. The engine talks to OpenRouter, so any model it offers
works. Swap the key and the model name.

**Do I need a custom domain?** No. You get an `azurecontainerapps.io` URL for free. A
custom domain is a few DNS records if you want one.

**Can I self-host without Azure?** The engine ([cortex-core](https://github.com/turfptax/cortex-core))
runs anywhere Python does; this repo is the Azure cloud path specifically. A Cloudflare
Tunnel config for a home-server deployment is included under `deploy/`.

## Related

- [cortex-core](https://github.com/turfptax/cortex-core) is the memory engine that runs as the `core` container.
- [cortex-desktop](https://github.com/turfptax/cortex-desktop) is the local Hub and the web UI source that ships in the `gateway` container.

## Contributing

Issues and pull requests are welcome. The gateway suite runs with `pytest`; please keep it
green. If you deploy your own instance, a note on what tripped you up is genuinely useful.

## License

[MIT](LICENSE). Build your own memory. Own it.

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [turfptax](https://github.com/turfptax)
- **Source:** [turfptax/Cortex-Cloud](https://github.com/turfptax/Cortex-Cloud)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-turfptax-cortex-cloud
- Seller: https://agentstack.voostack.com/s/turfptax
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
