# Schema First MCP Server

This server offers four tools over the MCP Streamable HTTP transport at `/mcp`.

- `memo_write` saves a text note in the server's private SQLite database and returns its ID.
- `memo_search` finds saved notes by case-insensitive substring.
- `upload` saves a UTF-8 or base64 file and returns a public URL on this server. Anyone with that URL can read the file.
- `transcribe` fetches audio from a public HTTPS URL and returns transcript segments with start times. When configured, it runs local `whisper.cpp`; otherwise it can use the optional configured speech-to-text API.

## Sign-in

The server offers OAuth authorization-code sign-in with PKCE S256. When a client connects, the owner reviews the client name and requested permission, enters the owner passphrase, and approves or denies access. Approved access tokens last one hour and are bound to this MCP endpoint. The owner sets `MCP_OWNER_PASSWORD` in the server's secret environment configuration; use a unique passphrase of at least 24 characters. The server stores only token hashes. The OAuth protected-resource metadata at `/.well-known/oauth-protected-resource` identifies this plan page and this host's authorization server.

## Data kept

Notes are stored in the private server data directory as `memos.sqlite3`; uploaded files and their media types are stored in its `uploads/` directory. The private request audit is stored beside them as `challenge-log.jsonl` with file mode 0600. Logs omit authorization headers and redact bearer-like strings and URL query values. Audio is fetched only for the duration of a transcription request and is not retained by this server. Local `whisper.cpp` processing keeps audio on this host; the optional API fallback sends audio to its configured provider.

The owner can remove notes by deleting the SQLite database, remove uploaded files from the private `uploads/` directory, and remove the audit by deleting `challenge-log.jsonl`. Stop the service to prevent further access. Public upload links stop working when their files are removed or the service is taken down.
