Connecting AI Clients (OAuth & MCP)
Step-by-step instructions for connecting Viewert to Claude Desktop, Cursor, Windsurf, ChatGPT, Gemini, Grok, Llama, and more — OAuth is the recommended method, with API key and local npx as fallbacks.
The short version, for Claude, ChatGPT and coding tools, is Connect Viewert to your AI. This page is the longer reference. Viewert supports four connection methods:
1. OAuth (recommended)
Add the remote MCP URL https://api.viewert.com/mcp to your AI client. On first connection, a consent screen opens — approve once and your account is linked automatically. No API key to copy or store. Works in Claude Desktop, Cursor, Windsurf, and any client that supports remote MCP with OAuth.
2. API Key + Remote MCP (fallback)
Generate a vwt_ key in Settings → API Keys and configure it in your client's remote MCP settings with an Authorization header. Use this if your client supports remote MCP but not OAuth.
3. The Viewert CLI (one command)
Install the CLI and run viewert mcp install: it adds Viewert to Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, Gemini CLI and Codex for you, using your sign-in (no key to copy). Add --read-only and the AI can read but never change anything. See the CLI guide.
4. API Key + Local npx (legacy fallback)
Run npx @viewert/mcp locally with your API key. This spawns a local MCP server via stdio. Use this only if your client does not support remote MCP at all.
Claude on the web, desktop and mobile adds Viewert as a custom connector and signs in with OAuth: no API key. (The same steps are in Connect Viewert to your AI.)
Open the connector settings
In Claude, open Customize, then Connectors.
Add Viewert
Choose + Add, then Add custom connector. Name it Viewert, enter https://api.viewert.com/mcp as the server address and choose Continue.
Sign in
Claude shows the sign-in settings it detected. Leave Authentication on Sign in now, choose Continue, then Add. Claude opens Viewert's approval page: check that it lists “Read your Librams”, “Read your Memories” and “Save Memories”, and choose Allow access.
Turn it on in a chat
In a chat (or a chat inside your project), choose + at the lower left, then Connectors, and switch Viewert on. You may need to do this in each new chat.
On a Team or Enterprise plan
An owner adds the connector once: Organization settings, then Connectors, then Add, then Custom, then Web, with the same address. Then each member opens Customize, then Connectors, finds Viewert and chooses Connect.
Try it
Type: "What Librams do I have in Viewert?" Claude calls list_librams, then get_libram_context for the one you pick.
Cursor and Windsurf both support remote MCP servers. Add the Viewert URL and authenticate once via OAuth.
Open MCP settings
Cursor: Cmd+Shift+P → "Open MCP Settings" (or edit ~/.cursor/mcp.json). Windsurf: Cmd+Shift+P → "Open MCP Config" (or edit ~/.codeium/windsurf/mcp_config.json).
Add the remote MCP server
Add the following entry: { "mcpServers": { "viewert": { "url": "https://api.viewert.com/mcp" } } }
Authenticate via OAuth
On the next tool call, your editor will open the Viewert OAuth consent screen in a browser. Click "Allow access" to link your account. The OAuth token is stored and refreshed automatically.
Reload the window
Run "Reload Window" from the command palette (Cmd+Shift+P). The Viewert tools load automatically.
Example coding prompt
"Load my Backend Architecture libram and help me refactor the auth middleware to match our conventions." The AI reads your docs and codes accordingly.
If your AI client does not support remote MCP or OAuth, use the local stdio server with an API key. API keys come with Basic (up to 3) and Pro (up to 10); on Free, connect with OAuth instead. Requires Node.js 18+ (nodejs.org).
Create an API key
Go to Settings → API Keys → Create Key. Give it a recognizable name. Copy the vwt_ key immediately — it is shown only once.
Run the setup wizard (easiest)
Open your terminal and run: npx -y @viewert/mcp The wizard verifies your API key, detects Claude Desktop, Cursor, and Windsurf, and writes the config automatically.
Or configure manually — macOS / Linux (Claude Desktop)
Config file: ~/Library/Application Support/Claude/claude_desktop_config.json { "mcpServers": { "viewert": { "command": "npx", "args": ["-y", "@viewert/mcp"], "env": { "VIEWERT_API_KEY": "vwt_your_key_here" } } } }
Or configure manually — macOS / Linux (Cursor)
Config file: ~/.cursor/mcp.json { "mcpServers": { "viewert": { "command": "npx", "args": ["-y", "@viewert/mcp"], "env": { "VIEWERT_API_KEY": "vwt_your_key_here" } } } }
Or configure manually — Windows
Claude: %APPDATA%\Claude\claude_desktop_config.json Cursor: %USERPROFILE%\.cursor\mcp.json Windsurf: %USERPROFILE%\.codeium\windsurf\mcp_config.json Same JSON structure as above.
Restart your client
Fully quit and reopen the app. The hammer icon (Claude) or MCP indicator (Cursor/Windsurf) confirms the tools are active.
ChatGPT connects to Viewert directly, as an app with developer mode (Connect Viewert to your AI has the steps and the fixes for the common failures). If your plan or workspace does not allow that, fetch your Libram content and paste it directly.
Fetch your Libram content
Run this in your terminal: curl -H "Authorization: Bearer vwt_your_key_here" \ "https://api.viewert.com/librams/YOUR_LIBRAM_ID/context" Windows (PowerShell): Invoke-RestMethod -Headers @{Authorization="Bearer vwt_your_key_here"} "https://api.viewert.com/librams/YOUR_LIBRAM_ID/context"
Paste into ChatGPT as context
"Here are my research notes: [paste markdown here] Based on these notes, what are the three strongest arguments for my thesis and where are the gaps?"
For public Librams — URL method (ChatGPT with browsing)
If your Libram is public and you have ChatGPT Plus with browsing enabled: "Please read https://api.viewert.com/librams/LIBRAM_ID/context and use it as context." Note: Only works with public Librams and a browsing-enabled model.
Gemini 1.5+ can read public URLs in some contexts. For private Librams, paste the content directly into AI Studio system instructions.
Most reliable: paste content directly
Fetch your Libram markdown (curl command above) and paste it into your Gemini conversation or AI Studio system instructions field.
For public Librams in Gemini app (1.5+ models)
"Please read https://api.viewert.com/librams/LIBRAM_ID/context and use it as your context for this session." Note: URL fetching is available on 1.5 Pro and later but not guaranteed on all plans.
Best experience: Google AI Studio with system instructions
Fetch your Libram content and paste it into the System Instructions field in AI Studio (aistudio.google.com). This loads it as persistent context for the entire session.
Grok has a large context window and handles pasted markdown well. The paste method is most reliable.
Paste the markdown directly
Fetch your Libram content (curl command above) and paste it into Grok's context window.
Via the xAI API (developers)
Inject your Libram content as a system message in the OpenAI-compatible API (see the API section below).
Running Llama, Mistral, Qwen, or any model locally? Fetch your context with curl and inject it into your system prompt.
Fetch your Libram as markdown
curl -H "Authorization: Bearer vwt_your_key_here" \ "https://api.viewert.com/librams/LIBRAM_ID/context" \ > context.md
Include it in your system prompt
Prepend context.md to your system prompt when calling the local API. Most local frontends (Open WebUI, LM Studio) have a system prompt field.
Example curl + ollama flow
CONTEXT=$(curl -s -H "Authorization: Bearer vwt_your_key" \ "https://api.viewert.com/librams/LIBRAM_ID/context") ollama run llama3 "Using this context: $CONTEXT\n\nWhat are the key design decisions in this project?"
The Viewert MCP server exposes these tools to any MCP-compatible client (Claude Desktop, Cursor, Windsurf, etc.). The first two read your Librams; the Graph tools below let an assistant that has read your systems draw them for you.
list_librams
Lists all Librams in your account. Inputs: none Returns: Array of { id, name, description, vellum_count, visibility, updated_at } Example prompt: "What librams do I have?" — Claude calls this automatically.
get_libram_context
Fetches the full context for a Libram — all AI-enabled Vellums concatenated as Markdown. Inputs: • libram_id (string, required) • libram_name (string, optional) Returns: Markdown string of all AI-enabled Vellum content. Example: "Load my Backend Architecture libram and review this function."
create_graph
Creates a Graph — an architecture or relationship diagram — from a VGF document and returns a link to open it. Inputs: • graph (object, required): a VGF 1.1 document. Guide: https://viewert.com/schemas/vgf-ai-guide.md • title, description (string, optional) Returns: what was created (counts, anything that was repaired, tips) and the link. Safety: the Graph is always created private — no tool can publish or share one. A document that appears to contain credentials (keys, tokens, passwords, connection strings) is refused, and the reply says where, never what. The same document sent twice within 15 minutes is one Graph. Limits: 20 creations an hour, and your plan's Graph limit. Example: "Map my AWS and DigitalOcean setup as a graph in Viewert." Needs the graphs:write permission.
validate_graph
Checks a VGF document exactly as create_graph would and saves nothing: credentials (by location), what would be repaired (unknown types, repeated ids, edges to nodes that do not exist), and tips (unconnected nodes, edges with no evidence). An assistant should fix what it reports, then call create_graph. Needs graphs:read or graphs:write.
list_graphs
Lists your Graphs (id, title, size, visibility, last change, link), optionally filtered by part of a title, so an assistant does not make a second copy of one you already have. Inputs: query (string, optional), limit (integer, optional, at most 50) Needs graphs:read.
search
Searches the documents in your Librams (the ones switched on for AI) and, with the memories permission, your memories, from a plain-language query. Returns ids, titles and links as JSON. This is one half of the pair ChatGPT looks for when it connects to a server. Input: query (string). Needs librams:read.
fetch
Returns one document or memory in full, given an id from search (vellum:… or memory:…). Another person's document, or a memory that is not in force, answers the same as one that does not exist. Input: id (string). Needs librams:read, and memories:read for a memory.
Prompts
The connector also offers two prompts that assistants list in their own menus: use_my_memories (the short rules, with an optional project name) and save_this_conversation (go back over the chat and save what is worth keeping). See Make your AI use Viewert by Default.
recall
Returns your approved memories that best match a query, most relevant first, packed to fit a token budget (default 2000, at most 20000). Optional filters: type, libram_id, tag, entity, slot, as_of (what was in force on a day). Everything returned is labelled as information about you, not instructions. Needs memories:read.
remember
Saves a memory. By default it takes effect at once and you can look through, edit or remove it under Memories; if you chose to approve this app's changes first, it waits under Activity until you accept it. A user keeps at most 100 memories, so it is refused when it is too short to stand alone, a question, true only for a short while (without valid_to) or longer than 400 characters; saving what is already remembered writes nothing; and when the list is full it is refused with the least useful memories named. A password or key in the text is refused. The reply lists memories that may overlap, so the AI can replace one instead of leaving both. Inputs: text (required, at most 400 characters), type, slot, entities, tags, libram_id, basis, valid_from, valid_to, source, client_ref. Needs memories:write.
supersede_memory
Writes a new memory to take the place of one that is out of date. The old one stays in force until you accept the change (at once, for a trusted app); afterwards it is kept, marked replaced. Needs memories:write.
retract_memory
Takes back a memory the same app wrote: it is set aside, not deleted. On a memory someone else wrote it only proposes removing it, shown to you as a change to accept or reject (a trusted app's removal takes effect at once, and you can discard it). Nothing is ever deleted by an app. Needs memories:write.
explain_memory
Where a memory came from, who wrote it, what it replaced, and every change to it. Needs memories:read.
Permissions (OAuth)
Connecting asks for the permissions an app needs, and the consent screen lists every one. The Graph tools need graphs:read (list and validate) and graphs:write (create). Whatever an app is given, it can never publish or share a Graph. Connected before Graphs existed? Disconnect Viewert in your AI app and connect it again, and approve the new permission. An API key has full access, as before.
OAuth tokens (remote MCP)
When connecting via OAuth, the client stores and auto-refreshes your access token. Tokens expire after 1 hour and are refreshed automatically using the refresh token (30-day lifetime). No manual action needed.
API key (local npx fallback)
Set VIEWERT_API_KEY in the env block of your MCP client config. Must be a valid vwt_ prefixed key from Settings → API Keys.
The context endpoints are stateless and require no SDK. Use them to fetch Libram content for any tool that accepts a system prompt or pasted text.
GET /api/librams/:id/context
Returns all AI-enabled Vellums in the Libram as a single Markdown document. Auth: None for public Librams. Authorization: Bearer vwt_your_key or OAuth Bearer token for private Librams. Query params: format=json — returns structured JSON instead of Markdown.
GET /api/librams/:id/context?format=json
Structured JSON response: { "libram_id": "01J...", "libram_name": "My Research", "vellums": [ { "id": "01J...", "title": "Section Title", "markdown": "..." } ] }
GET /api/librams (authenticated)
Returns all Librams in your account. Auth: Bearer token required (OAuth or API key). Response: Array of { id, name, description, vellum_count, visibility, updated_at, created_at }
Rate limits & errors
401 Unauthorized — missing or invalid token. 403 Forbidden — valid token but no access to this resource. 404 Not Found — Libram does not exist or is private. 429 Too Many Requests — rate limit hit. All errors: { "error": "message" }
Your knowledge is yours. Here is exactly how access control works:
OAuth tokens
OAuth access tokens are short-lived (1 hour) and limited to the permissions you approved on the consent screen. Revoke access anytime from Settings → OAuth Apps & Connections.
API keys
An API key acts as you: it is tied to your account but not limited to Librams. It cannot change billing, administer a team, change your security settings or delete your account: those need you signed in to Viewert. Revoke it instantly from Settings → API Keys.
Private Librams
Only accessible with your token. No one else can read your private Libram's context — not even if they know the Libram ID.
Private Vellums in public Librams
If a Libram is public but contains private Vellums, those private Vellums are automatically excluded from context served to non-owners.