# Overview

> **TL;DR** The Open Context Layer (OCL) is a user-owned system for managing and sharing context across AI agents and apps. You control the context you generate (preferences, identity, history, knowledge, intent) and decide who can access it, when, and how.

The **Open Context Layer (OCL)** is a user-owned, privacy-preserving system for managing and sharing context across AI agents, apps, and digital systems.

#### Why we're building it

The way humans interact with the internet is undergoing a once-in-a-generation transformation. Traditional search, static interfaces, and disconnected apps are giving way to fluid, conversational interactions powered by intelligent agents and large language models. In this new era (the Agentic Web), AI agents act on behalf of users, navigating digital spaces, making decisions, and personalizing services in real time.

But to be truly intelligent, agents need more than the last message. They need *context*: who you are, what you're working on, what you care about. Today, this context is fragmented across apps, owned by platforms, and lost with every session.

> OCL provides the missing foundation: **a portable, persistent, privacy-preserving context layer** that puts users back in control.

Instead of starting from scratch in every app, your preferences, memory, and intent follow you: encrypted, under your control, and shareable only with explicit consent.

OCL turns context into a first-class, programmable primitive: one that powers hyper-personalization without compromising privacy, and lets apps and agents work smarter, together.

Our vision is a world where:

* Context follows users across apps and agents
* AI assistants remember and adapt to your style and goals
* Users control who sees what, when, and how
* Personalization and privacy are balanced by design

This is the backbone of the Agentic Web: a future of AI systems aligned with individuals, not platforms.

#### How OCL works

OCL has three pieces that build on each other:

**Memory Buckets** are the underlying primitive. User-owned, encrypted containers that hold your context. You can have many (work, personal, health) and you decide what goes in each.&#x20;

[**AI Context Flow**](https://chromewebstore.google.com/detail/ai-context-flow-ai-memory/cfegfckldnmbdnimjgfamhjnmjpcmgnf) is the browser extension that makes memory buckets useful day-to-day. It captures context from your existing apps, websites and conversations. It allows you to organize your context, and prepares it to be shared with the AI tools you actually use.

**The Plurality MCP Server** is the bridge. It exposes your memory buckets to any AI agent that speaks the [Model Context Protocol](https://modelcontextprotocol.io) — Claude, Claude Code, ChatGPT, OpenClaw, Cursor, GitHub Copilot, Lovable, LMStudio, and others — so they can read your context (with your permission) without you provide context in each new session.

#### Where to go next

* **New here?** Read [Architecture at a glance](/overview/architecture-at-a-glance) for a one-page overview of the system.
* **Want to try it now?** Jump to the [Quickstart](/overview/quickstart) — five minutes to your first context-aware agent.
* **Just interested in connecting MCP?** Jump to the relevant [guides](/the-plurality-mcp-server/connect-your-agents-via-mcp).

## Join Our Community

Plurality has a healthy user and developer community. Here's how you can connect with us:

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Discord</strong></td><td></td><td></td><td><a href="/files/0LaPCzJDQpVmWn9azokG">/files/0LaPCzJDQpVmWn9azokG</a></td><td><a href="https://discord.com/invite/Mb6ZDgGjcP">https://discord.com/invite/Mb6ZDgGjcP</a></td></tr><tr><td><strong>X</strong></td><td></td><td></td><td><a href="/files/xud7M1QQghx9Dlb6Lt2L">/files/xud7M1QQghx9Dlb6Lt2L</a></td><td><a href="https://x.com/PluralityWeb3">https://x.com/PluralityWeb3</a></td></tr><tr><td><strong>LinkedIn</strong></td><td></td><td></td><td><a href="/files/5CfLCdhqpLiwlg04k4eE">/files/5CfLCdhqpLiwlg04k4eE</a></td><td><a href="https://www.linkedin.com/company/pluralitynetwork/">https://www.linkedin.com/company/pluralitynetwork/</a></td></tr></tbody></table>


# Architecture at a Glance

> **TL;DR** OCL has three layers. \
> \
> 1\. Memory Buckets store your context. \
> 2a. AI Context Flow lets you manage, share, and work with your context on any website or agent. \
> 2b. The Plurality MCP Server exposes your context to MCP-compatible AI agents and tools. \
> 3\. Your AI agents and tools consume the context. \
> \
> You own everything in the bottom layer (your memory buckets).

#### The four layers

```
                    ┌─────────────────────────────────┐
                    │  AI Agents                      │   The consumers
                    │  Claude · ChatGPT · Cursor      │
                    └────────────────┬────────────────┘
                                     │  MCP
   ┌─────────────────────────┐  ┌────▼─────────────────────┐
   │  AI Context Flow        │  │  Plurality MCP Server    │   The clients
   │  (Browser Extension)    │  │                          │
   │  capture · organize ·   │  │  exposes memory buckets  │
   │  permission · share     │  │  to AI agents            │
   └────────────┬────────────┘  └─────────────┬────────────┘
                │                             │
                │   read / write              │   read / write
                ▼                             ▼
   ┌──────────────────────────────────────────────────────┐
   │  Memory Buckets                                      │   The primitive
   │  user-owned · encrypted · portable                   │
   └──────────────────────────────────────────────────────┘
```

#### Layer 1 — Memory Buckets (the primitive)

A memory bucket is an encrypted, user-owned container of context. You can have multiple bucket for different parts of your life e.g. work, personal, health, a side project, and each one holds whatever context belongs to that slice of you.

#### Layer 2a — AI Context Flow (the product)

Memory buckets on their own are just storage. AI Context Flow is the product layer that makes them useful. It's a browser extension that helps you capture context from your activity, help you organize it into the right bucket, and lets you set permissions on what gets shared and with whom.

Think of it as the operating system for your context: capture, sort, permission, share.

→ Read more: [AI Context Flow](/ai-context-flow)

→ Download here: [AI Context Flow](https://chromewebstore.google.com/detail/ai-context-flow-use-your/cfegfckldnmbdnimjgfamhjnmjpcmgnf)

#### Layer 2b — The Plurality MCP Server (the bridge)

The Plurality MCP Server speaks the [Model Context Protocol](https://modelcontextprotocol.io), an open standard for connecting AI agents to data sources. By exposing your Memory Buckets through MCP, any compatible agent can request context from your profile and (with your permission) receive it in real time.

With MCP, you can also set it up as a context store for your programmatic agents to read and write from e.g. OpenClaw.

You don't paste your background into every new ChatGPT conversation or every new agent session. The agent asks; the MCP Server answers — under the rules you set.

→ Read more: [The Plurality MCP Server](/the-plurality-mcp-server)

#### Layer 3 — Your AI agents (the consumers)

The agents you already use. Claude (Desktop and Code), ChatGPT, Cursor, Windsurf, GitHub Copilot, LM Studio, Lovable, Replit, OpenClaw, and any other tool that speaks MCP. They see the context you choose to share, and nothing else.

→ Read more: [Connect Your Agents via MCP](/the-plurality-mcp-server/connect-your-agents-via-mcp)

#### How a request flows (the MCP Way)

When you ask Claude *"what was I working on last week?"* and have setup the MCP connection:

1. **Claude** receives your question and recognizes it needs context.
2. **Claude** queries the **Plurality MCP Server** through the standard protocol.
3. **The MCP Server** checks which bucket has the relevant context and retrieves it from the correct bucket.&#x20;
4. The context is returned to Claude, which uses it to answer.

#### How a request flows (the Browser Extension Way)

Alternatively, if you are on a browser AI Agent and not using MCP.&#x20;

When you ask ChatGPT website *"what was I working on last week?"* and then press "Optimize" button

1. Your Prompt is improved and the relevant context is fetched and added from the selected memory bucket into your prompt
2. ChatGPT gives you improved answers because it now got a better, more contextual prompt with all the right details<br>

> Note: The prompt optimization feature in AI Context Flow browser extension currently only works on the websites of ChatGPT, Claude, Gemini, Perplexity and Grok.

In both cases, you see a better, more fitting answer. The context never leaves your control without permission, and the answer is grounded in *your* history and is not a generic guess.


# Quickstart

> **TL;DR** Get your first AI agent reading your context in under five minutes

#### What you'll need

* An account on Memory Studio → [sign up](https://app.plurality.network)
* Any AI tools: e.g. Claude (Website or Desktop), Claude Code, Cursor, ChatGPT, etc.
* (optional) AI Context Flow Browser Extension → Download [here](https://chromewebstore.google.com/detail/ai-context-flow-use-your/cfegfckldnmbdnimjgfamhjnmjpcmgnf)

#### Step 1 — Create your first memory bucket

Open [Memory Studio](https://app.plurality.network/) and click **Create memory** . Give it a name (e.g. *Work*) and add a few starter pieces of context e.g. your role, current projects, anything you'd want a smart assistant to know.

#### Step 2 — Connect to your AI tool

Now let's connect this memory to your favorite AI agent or tool. \
You have two connection options:

<details>

<summary>Connect via Browser Extension</summary>

> The browser extension only supports prompt enhancements with context on these web based AI agents: ChatGPT, Claude, Grok, Perplexity and Gemini. \
> However, you can add and use your context from any website.

You can go to the supported AI agent websites and you will see AI Context Flow elements within the agents. Write a prompt, select your memory bucket and press Optimize. \
\
See the following tutorial to understand in detail how AI Context Flow works and all that it has to offer.

{% embed url="<https://www.youtube.com/watch?v=VO7Ro1uFiVQ>" %}

</details>

<details>

<summary>Connect via MCP Server</summary>

For detailed context usage and management, and for non UI environments (e.g. scripts, openclaw, etc.), we recommend our MCP Server. We have guides covering most of the tools. \
\
Read more: [Connect Your Agents via MCP](/the-plurality-mcp-server/connect-your-agents-via-mcp)\
\
Quick Links to some of the most famous tools:

| Tool                                                                                             | Setup time |
| ------------------------------------------------------------------------------------------------ | ---------- |
| [Claude Desktop / Web](/the-plurality-mcp-server/connect-your-agents-via-mcp/claude-desktop-web) | 1 min      |
| [Claude Code](/the-plurality-mcp-server/connect-your-agents-via-mcp/claude-code)                 | 1 min      |
| [ChatGPT](/the-plurality-mcp-server/connect-your-agents-via-mcp/chatgpt)                         | 1 min      |
| [LM Studio](/the-plurality-mcp-server/connect-your-agents-via-mcp/lm-studio)                     | 2 min      |
| [OpenClaw](/the-plurality-mcp-server/connect-your-agents-via-mcp/openclaw)                       | 5 min      |
| [Lovable](/the-plurality-mcp-server/connect-your-agents-via-mcp/lovable)                         | 2 min      |

</details>

#### Step 3 — Try it

Once connected, ask your agent something only your context could answer:

> *"What's my current project status?"*
>
> *"Draft an email in my usual style."*

If you are using the browser extension, you will need to select the correct memory bucket and press optimize. \
\
If you are using MCP server and the connection is already established, you don't need to do anything else.\
\
If the agent answers using information from your memory bucket, you're done. 🎉

#### What's next?

* Add more context to your memory buckets directly from websites, AI chats, MCP or through the [memory studio](https://app.plurality.network/)
* Create additional buckets for different parts of your life
* Share Your Memories — add collaborators to your memory buckets (advanced team features coming soon)


# AI Context Flow

> **TL;DR** AI Context Flow is the product that makes your context useful. It captures what you know and care about, helps you organizes it into memory buckets, lets you control what gets shared, and exposes it to your AI agents through the Plurality MCP Server.

### What it is

AI Context Flow is the application layer of the Open Context Layer. If memory buckets are the underlying primitive — encrypted, user-owned containers of context — then AI Context Flow is how you actually create, fill, and use them in everyday work.

### Two parts of AI Context Flow

* **Memory Studio:** The [dashboard](https://app.plurality.network/) where you can see your memory buckets, edit it, share them with friends, and more. Memory studio is your command center.
* **Browser Extension:**  The [chrome extension](https://chromewebstore.google.com/detail/ai-context-flow-use-your/cfegfckldnmbdnimjgfamhjnmjpcmgnf) that lets you capture information from any webpage, helps you optimize your prompts with the correct context, and gives you a sidebar that you can open on any website and cross reference the page's content with what you have stored in your memory.&#x20;

Together, these two parts combinedly are what we refer to as the "AI Context Flow".\
\
See the video below to see what AI Context Flow offers.

{% embed url="<https://www.youtube.com/watch?v=VO7Ro1uFiVQ>" %}

### What it does

AI Context Flow handles four jobs.

#### 1. Capture

Pull context in from the places it already lives — past or new AI chats, documents, notes, webpage highlights, etc. You don't have to manually type out who you are or what you're working on; AI Context Flow ingests, deduplicates, and structures it.

#### 2. Organize

Sort what you've captured into the right memory bucket. You might have one bucket for work, one for a side project, one for personal life. AI Context Flow lets you put things where they belong, and you decide what stays, what moves, and what gets deleted.

#### 3. Permission

Decide what each AI agent or other users are allowed to see. Permissions are per-bucket

#### 4. Connect

Expose your buckets to AI agents through the **Plurality MCP Server**. Once an agent is connected and permissioned, it can read your context the moment it needs to — no more pasting your background into every new conversation or session.

### Why this matters

Today, you re-explain yourself to every AI tool. *I work in product design. I'm building a B2B app. My team uses Linear. I prefer concise answers.* Every chat. Every tool. Every time.

AI Context Flow ends that. You set up your context once. Your agents know it. And because the data lives in *your* memory buckets — not in OpenAI's, not in Anthropic's, not in Gemini's — you can take it with you when you switch tools.

### What's next

* [Connect your first AI agent](/overview/quickstart) — five-minute setup
* [The Plurality MCP Server](/the-plurality-mcp-server) — the bridge between your context and your tools


# The Plurality MCP Server

> **TL;DR** The Plurality MCP Server exposes your memory buckets to any AI agent that speaks the Model Context Protocol. Connect once per tool, authenticate (via OAuth or a personal access token), and your context flows automatically (in both directions).

### What is MCP?

The [Model Context Protocol](https://modelcontextprotocol.io) is an open standard, originally developed by Anthropic, for connecting AI models to external data and tools. Think of it as a universal adapter: any agent that speaks MCP can talk to any data source that speaks MCP, without custom integration work on either side.

MCP support is now standard across the agent ecosystem. Claude Desktop, Claude Code, Cursor, Windsurf, GitHub Copilot, LM Studio, Lovable, Replit, ChatGPT (via custom connectors), OpenClaw, and many others speak it natively.

### What the Plurality MCP Server does

The Plurality MCP Server is the bridge between your memory buckets and the AI tools you use. It runs at:

```
https://app.plurality.network/mcp
```

When an AI agent connects to this URL, it gains **read and write access** to your Plurality memory layer — your documents, notes, conversations, and files stored across memory buckets — bounded by the permissions you set.

The server is the *only* component that talks to outside agents. Your memory buckets never leave your control; the MCP Server retrieves only what an agent is permitted to see, in the moment it's requested.

### How it fits

```
   ┌──────────────────────────────────────┐
   │  Your AI agent (Claude, Cursor, ...) │
   └─────────────────┬────────────────────┘
                     │  MCP request
                     ▼
   ┌──────────────────────────────────────┐
   │  Plurality MCP Server                │
   │  ─ verifies authentication           │
   │  ─ checks permissions                │
   │  ─ fetches/writes context            │
   └─────────────────┬────────────────────┘
                     │
                     ▼
   ┌──────────────────────────────────────┐
   │  Your memory buckets                 │
   └──────────────────────────────────────┘
```

### What's exposed

The Plurality MCP Server exposes the following tools to connected agents:

| Tool                          | Description                                            |
| ----------------------------- | ------------------------------------------------------ |
| `get_user_memory_buckets`     | List all memory buckets for the user                   |
| `list_items_in_memory_bucket` | List stored items in a specific bucket (metadata only) |
| `search_memory`               | Semantic search across buckets with relevance scoring  |
| `read_context`                | Read the full content of a stored item (paginated)     |
| `save_memory`                 | Save text content to a specific memory bucket          |
| `save_conversation`           | Save a conversation (chat history) to a memory bucket  |
| `create_memory_bucket`        | Create a new memory bucket                             |

Connected agents can **read** your context and **write** new context back to your buckets. For example, context saved from Cursor is immediately available in Claude or ChatGPT, with no manual syncing.

### Authentication

The Plurality MCP Server supports two authentication methods. Most users will use OAuth; API keys are available for advanced and programmatic use cases.

#### OAuth 2.1 (default)

OAuth is the recommended option for connecting interactive AI tools like Claude Desktop, ChatGPT, Cursor, Windsurf, GitHub Copilot, Lovable, Replit, LM Studio, OpenClaw, and others.

When you connect a tool, it opens a browser window and redirects you to Plurality's login flow. After you authenticate, the tool receives an access token scoped to your account. The tool stores this token locally; Plurality never sees the tool's session.

**Why use it:**

* No credentials to copy or paste
* Standard flow supported natively by every major MCP client

The Plurality MCP Server implements OAuth 2.1 with **Dynamic Client Registration (DCR)**, which is what allows any compliant MCP client to connect without prior coordination.

#### Personal Access Token (API key)

For environments where OAuth is impractical —  self-hosted agents, headless deployments, scripts — the Plurality MCP Server also accepts personal access tokens.

**To use a PAT:**

1. Generate a token in your Plurality dashboard under \
   **`Connect via MCP → Manage MCP Tokens → Create Token`**.

<figure><img src="/files/cxAM1gNa9i47nOsZqlFW" alt=""><figcaption></figcaption></figure>

1. When you click on Create Token, you need to give your token a name and set its expiry. Copy the PAT that gets generated (we show it only once)
2. In your MCP client's configuration, add an `Authorization` header:

```
Authorization: Bearer plur_pat_xxx
```

**Why use it:**

* Works in environments without a browser
* Easy to scope to specific buckets or operations
* Can be set per-environment (different tokens for dev/staging/prod)

**Treat PATs like passwords:** never commit them to source control, and rotate them when team members leave or you need to disallow a certain agent to access your memory buckets.

### Permissions and security

Three things to know:

1. **Per-agent permissions.** Each connected agent has its own access scope. Granting Claude Desktop access to your *Work* bucket doesn't grant any other tool access to it.
2. **Per-bucket permissions.** Buckets are independent units. An agent permitted on one is not automatically permitted on others.
3. **Shared Buckets:** If someone shared their buckets with you but only "Viewer" access, then you will not be able to add any information to that bucket (with or without MCP).
4. **Revocation is instant.** Pull permission in your Plurality dashboard and the agent loses access on its next request.

Tokens (both OAuth and PAT) are cached locally by the client. Plurality never receives, stores, or sees the credentials of the AI tools you connect.

### Next Steps

Check out guides for individual tools and the different MCP setups in the next section.&#x20;


# Connect Your Agents via MCP

### Overview

Plurality uses the [Model Context Protocol (MCP)](https://modelcontextprotocol.io) — an open standard supported by Claude, ChatGPT, Cursor, and most modern AI tools — to connect your memory buckets to the agents you already use. Pick your tool below.

Each guide takes about five minutes. Most use OAuth, so there are no API keys to manage. Once connected, your agent gets read and write access to the memory buckets you permission, with no manual syncing.

#### Pick your tool

| Tool                                                                                             | Setup time | Auth         |
| ------------------------------------------------------------------------------------------------ | ---------- | ------------ |
| [ChatGPT](/the-plurality-mcp-server/connect-your-agents-via-mcp/chatgpt)                         | 2 min      | OAuth        |
| [Claude Desktop / Web](/the-plurality-mcp-server/connect-your-agents-via-mcp/claude-desktop-web) | 2–5 min    | OAuth        |
| [Claude Code](/the-plurality-mcp-server/connect-your-agents-via-mcp/claude-code)                 | 1 min      | OAuth        |
| [Cursor](/the-plurality-mcp-server/connect-your-agents-via-mcp/cursor)                           | 2 min      | OAuth        |
| [Windsurf](/the-plurality-mcp-server/connect-your-agents-via-mcp/windsurf)                       | 2 min      | PAT          |
| [GitHub Copilot (VS Code)](/the-plurality-mcp-server/connect-your-agents-via-mcp/github-copilot) | 2 min      | OAuth        |
| [LM Studio](/the-plurality-mcp-server/connect-your-agents-via-mcp/lm-studio)                     | 3 min      | PAT          |
| [Lovable](/the-plurality-mcp-server/connect-your-agents-via-mcp/lovable)                         | 2 min      | OAuth or PAT |
| [TypingMind](/the-plurality-mcp-server/connect-your-agents-via-mcp/typingmind)                   | 2 min      | PAT          |
| [OpenClaw](/the-plurality-mcp-server/connect-your-agents-via-mcp/openclaw)                       | 5 min      | PAT          |
| [Other MCP clients](/the-plurality-mcp-server/connect-your-agents-via-mcp/other-mcp-clients)     | varies     | OAuth or PAT |

> Want to know what's happening under the hood? See The [Plurality MCP Server.](/the-plurality-mcp-server)


# ChatGPT

Last updated: April, 2026

> **TL;DR** Add `https://app.plurality.network/mcp` as a custom connector in ChatGPT settings. OAuth handles the rest.

#### Prerequisites

* A paid ChatGPT plan (Plus, Pro, Team, Enterprise, or Edu)
* To add MCP servers, a workspace admin must enable **Developer Mode** under \
  **Settings → Admin → Developer Mode**

#### Setup

1. Open **Settings → Apps → Create app**.
2. Enter a name (e.g. *Plurality Memory*) and paste the server URL: `https://app.plurality.network/mcp`
3. Save the connector. ChatGPT discovers the OAuth metadata automatically.
4. Start a new chat. On first use, ChatGPT opens a browser window for OAuth login.
5. Sign in with your Plurality account. Once authenticated, your memory buckets are available in conversation.

<figure><img src="/files/5FrlOWFBEcGzfVTwf33A" alt=""><figcaption></figcaption></figure>

#### Verify

In a new chat, ask: *"What memory buckets do I have in Plurality?"*

If ChatGPT calls the `get_user_memory_buckets` tool and returns your buckets, you're connected.

#### Troubleshoot

**"Add app" doesn't appear in settings.** You're probably on a Free plan, or Developer Mode hasn't been enabled by your workspace admin (Team/Enterprise).

**OAuth login window won't open.** Disable any browser pop-up blockers and try again.

**Connector shows "Disconnected" after authentication.** Sign out of the connector and re-add it. Confirm the URL is exactly `https://app.plurality.network/mcp` with no trailing slash.


# Claude Desktop/Web

Last updated: April, 2026

> **TL;DR** Paid plans connect via the Connectors UI in Settings. Free plans on Desktop connect via the `mcp-remote` config bridge.

Claude supports MCP on both free and paid plans, but the setup paths are different. Use the section that matches your plan.

#### Prerequisites

* **Paid plan path:** A Claude paid plan (Pro, Max, Team, or Enterprise). Works on both Desktop and Web.
* **Free plan path:** Claude Desktop installed (Mac or Windows). Node.js installed. Free plan only works on Desktop, not Web.

#### Setup — paid plans (Pro, Max, Team, Enterprise)

1. Open **Settings → Connectors**.
2. Click **Add** **Custom Connector**  and paste: `https://app.plurality.network/mcp`
3. Claude opens a browser window for OAuth login. Sign in with your Plurality account.
4. Once authenticated, the Plurality tools appear in the chat input.

#### Setup — free plan (Desktop only)

Free-plan users can connect the Desktop app via the [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) bridge.

1. Open the Claude Desktop config file:
   * **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
   * **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
2. Add the `mcpServers` block:

```json
{
  "mcpServers": {
    "plurality-memory": {
      "command": "npx",
      "args": ["mcp-remote", "https://app.plurality.network/mcp"]
    }
  }
}
```

> **Windows note:** if you see "Connection closed" errors, wrap the command with `cmd /c`:
>
> ```json
> {
>   "command": "cmd",
>   "args": ["/c", "npx", "mcp-remote", "https://app.plurality.network/mcp"]
> }
> ```

3. **Fully restart Claude Desktop** — quit and reopen, not just close the window.
4. On first use, `mcp-remote` opens your browser for OAuth login. After authenticating, tokens are cached locally.

#### Verify

Look for the connectors icon in Claude's chat input. The Plurality memory connector should appear in the list.

In a new chat, ask: *"What's in my Plurality memory?"*

If it calls the `get_user_memory_buckets` tool and returns your buckets, you're connected.

#### Troubleshoot

**Tools don't appear after adding the connector.** Fully quit Claude (don't just close the window) and reopen.

**Free plan: `mcp-remote` errors with "Connection closed."** On Windows, use the `cmd /c` wrapper shown above.

**Free plan: `npx` not found.** Install [Node.js](https://nodejs.org). The `mcp-remote` bridge requires it.

**OAuth completes but tools still missing.** Check the URL in your config — no trailing slash, no extra characters should be there.


# Claude Code

Last updated: April, 2026

> **TL;DR** One CLI command, one OAuth flow.

#### Prerequisites

* Claude Code installed and logged in

#### Setup

In your terminal:

```
claude mcp add --transport http plurality-memory https://app.plurality.network/mcp
```

Then authenticate inside Claude Code:

```
> /mcp
```

This opens an OAuth browser window. Sign in with your Plurality account. Tokens are cached locally.

#### Verify

In a Claude Code session, ask: *"List my memory buckets."*

If Claude calls `get_user_memory_buckets` and returns results, you're connected.

#### Troubleshoot

**`claude: command not found`.** Make sure Claude Code is installed and on your `$PATH`.

**`/mcp` shows the server but no tools.** OAuth may not have completed. Run `/mcp` again and follow the browser prompt.

**Need to disconnect.** Run `claude mcp remove plurality-memory`.


# Cursor

Last updated: April, 2026

> **TL;DR** Edit one JSON file, restart Cursor, OAuth on first use.

#### Prerequisites

* Cursor installed

#### Setup

Cursor supports global config (all projects) or project-level config.

**Global setup.** Edit `~/.cursor/mcp.json` (create the file if it doesn't exist):

```json
{
  "mcpServers": {
    "plurality-memory": {
      "url": "https://app.plurality.network/mcp"
    }
  }
}
```

**Project-level setup.** Create `.cursor/mcp.json` in your project root with the same content.

After saving the config, **fully restart Cursor** (quit and reopen, not just close the window).

#### Verify

Navigate to **Settings → MCP**. The `plurality-memory` server should show a green active status.

On first use, Cursor opens your browser to complete OAuth. After authentication, the tools are available in your chat input.

#### Troubleshoot

**Server shows red / inactive in Settings → MCP.** Check the JSON — most issues are typos or missing commas. Confirm the URL is exactly `https://app.plurality.network/mcp`.

**OAuth never opens.** Try sending a chat message — Cursor triggers OAuth lazily on first tool call.

**Tools work in one project but not another.** You added project-level config in one and not the other. Move the config to `~/.cursor/mcp.json` for global access.


# Windsurf

Last updated: April, 2026

> **TL;DR** Edit one JSON file, restart Windsurf, OAuth on first use.

#### Prerequisites

* Windsurf installed
* Personal Access Token created on the Memory Studio

#### Setup

For remote http mcp connections, windsurf only allows with Personal Access Tokens (PATs).&#x20;

Read more [here](/the-plurality-mcp-server#personal-access-token-api-key) on how to create one from Memory Studio.

1. Edit (or create) the raw mcp config file<br>
   * macOS: `~/.codeium/windsurf/mcp_config.json`
   * Windows: `%USERPROFILE%\.codeium\windsurf\mcp_config.json`

```json
{
  "mcpServers": {
    "plurality-memory": {
      "disabled": false,
      "headers": {
        "Authorization": "Bearer plur_pat_xxx"
      },
      "serverUrl": "https://app.plurality.network/mcp"
    }
  }
}
```

2. Restart Windsurf.
3. Open the Cascade panel (agent sidebar). The Plurality tools become available to the AI agent.
4. On first use, Windsurf opens your browser for OAuth login.

#### Verify

In Cascade, ask: *"List my Plurality memory buckets."*

If the agent calls `get_user_memory_buckets` and returns results, you're connected.

#### Troubleshoot

**Tools missing in Cascade.** Confirm the JSON key is `serverUrl` (not `url`) — Windsurf is picky about this.

**OAuth completes but no response.** Restart Windsurf fully and try again.

**Personal Access Token was correct.** Make sure the header name is exactly *Authorization* and the value is *Bearer \<your access token starting with plur\_pat\_>*


# GitHub Copilot

Last updated: April, 2026

### GitHub Copilot (VS Code)

> **TL;DR** dd the Plurality MCP Server through VS Code's native MCP configuration with a Plurality PAT, then use it from Copilot Chat in Agent mode.

#### Prerequisites

* VS Code **1.99 or later**
* A paid GitHub Copilot subscription
* GitHub Copilot extension installed in VS Code

**Setup**

1. Open VS Code and press `Cmd+Shift+P` (macOS) or `Ctrl+Shift+P` (Windows/Linux).
2. Run **MCP: Add Server**.
3. Select **HTTP (HTTP or Server-Sent Events)**.
4. Enter the server URL: `https://app.plurality.network/mcp`
5. Name the server: `plurality-memory`
6. Choose **User settings** (all projects) or **Workspace settings** (this project only).
7. It will then ask to authenticate from your account and open the app.plurality.network webpage. After authentication you return back to vscode.
8. If you want you can also edit the created mcp.json to authenticate via PAT.&#x20;

**Verify**

In Copilot Chat (Agent mode), ask: *"Search my Plurality memory for anything about \[topic]."* If Copilot calls `search_memory` and returns results, you're connected.

**Troubleshoot**

* *`MCP: Add Server` command not found.* Update VS Code to 1.99 or later.
* *Tools missing in Copilot Chat.* Make sure you're in Agent mode, not Ask or Edit mode.
* *401 Unauthorized from the server.* Your PAT is invalid, expired, or missing required scopes — regenerate it in Plurality, then run **MCP: List Servers**, pick the server, and reset stored inputs to re-enter it.
* *Tools fail to load after entering the PAT.* Reload the VS Code window (`Cmd/Ctrl+Shift+P → Developer: Reload Window`).


# LM Studio

Last updated: April, 2026

> **TL;DR** LM Studio 0.3.5+ supports MCP, so locally-running models can call Plurality tools.

#### Prerequisites

* LM Studio **0.3.5 or later**
* A loaded model with tool calling capability (Mistral, Llama 3.1+, Qwen 2.5, or similar)
* Plurality access token from memory studio. Read [here](/the-plurality-mcp-server#personal-access-token-api-key) how to create it.

#### Setup

1. Open LM Studio and navigate to the **Developer** tab.
   * If you don't see it, enable Developer Mode in **Settings → Advanced**.
2. Click on mcp.json and add the following json

<figure><img src="/files/TUfxIdYati7IOlneJd0M" alt=""><figcaption></figcaption></figure>

```json
{
  "mcpServers": {
    "plurality-memory": {
      "url": "https://app.plurality.network/mcp",
      "headers": {
        "Authorization": "Bearer <plur_pat_your-acces-token"
      }
    }
  }
}
```

3. Make sure require authentication is turned on in server settings.\
   ![](/files/T7OM4oO02FKwA5ub1XUk)
4. Open a new chat and load a model with tool calling capability. Then on the right side in the program tab, make sure you turn plurality mcp on.&#x20;

<figure><img src="/files/h7aGu7rzpOY2S14Gyx4c" alt=""><figcaption></figcaption></figure>

5. Now chat to the model and it will call the plurality mcp tools where necessary.

#### Verify

Ask the model: *"Search my Plurality memory for \[something]."*

If the model invokes `search_memory` and returns results, you're connected.

#### Troubleshoot

**Model doesn't call tools even when enabled.** This is a model capability issue, not a connection issue. Some smaller models don't reliably call tools. Try Mistral, Llama 3.1+, or Qwen 2.5.

**Tools fail with timeout.** Local models can be slow on tool calls. Increase the request timeout in LM Studio's developer settings.


# Lovable

Last updated: April, 2026

> **TL;DR** Lovable's paid plans support MCP directly in the builder. Connect once and your memory becomes a live data source for whatever you build.

#### Prerequisites

* A paid Lovable plan
* A Lovable project open

#### Setup

1. Login to the Lovable website.
2. Open **Connectors** and go to **Chat connectors**.
3. Click **New MCP server**.
4. **Server name**: Enter a clear name for your server (for example, *AI Context Flow or Plurality MCP*).
5. **Server URL**: Enter the address where Lovable can reach your MCP server (<https://app.plurality.network/mcp>)
   1. **Authentication:**
      * **OAuth (default):** Lovable uses OAuth by default. After you click **Add & authorize**, you’ll be prompted to authorize.
      * **Bearer token or API key:** If you want, you can also authenticate using a bearer token (PAT, read more [here](/the-plurality-mcp-server#personal-access-token-api-key)).
   2. **Add server**. The AI Context Flow MCP server now appears in your list of chat connectors and can provide contextual data for builds.

#### Use it

Once connected, reference your Plurality memory directly in Lovable prompts. For example:

> *"Build a dashboard using all the requiremtents in my X project bucket"*

Your memory buckets, documents, and notes act as live data for the apps you generate.

#### Verify

In a Lovable prompt, ask the builder to read from Plurality. If it returns content from your buckets, the connection is working.

#### Troubleshoot

**MCP option missing in Connectors.** You're on a Free plan. MCP requires a paid plan.

**OAuth completes but Lovable doesn't see the tools.** Refresh the project page after authentication.


# TypingMind

Last updated: April, 2026

> **TL;DR** TypingMind doesn't use OAuth based MCP connections, therefore, the only way to authenticate is with Personal Access Tokens&#x20;

#### Prerequisites

* Personal Access Token from Memory Studio. Read [here](/the-plurality-mcp-server#personal-access-token-api-key) how to create one.

#### Setup

1. Login to the TypingMind website.
2. On the left pane, go to **Plugins -> MCP Connectors -> Add Connector**.
3. Enter the **Server Url:** <https://app.plurality.network/mcp>
4. Enter the **Connection Name:** for e.g. plurality or ai context flow
5. Click on **Advanced Settings**&#x20;
6. Turn on the Custom HTTP Headers
   1. Header Name: Authorization
   2. Header Value: Bearer *plur\_pat-access-token*
7. Click **Create Connection**.

#### Use it

Once connected, reference your Plurality memory directly in chats. For example:

> *"List down all project requirements from bucket xxx"*

Your memory buckets, documents, and notes act as live data for the apps you generate.

#### Verify

In the chats when you reference something that needs information from your buckets and if it returns content from your buckets, the connection is working.

#### Troubleshoot

**Error in authentication.** Make sure you are using the correct access token

**Can't see the headers while making connection.** Make sure you click on advanced settings so the dropdown gets expanded, and then you turn on the Custom HTTP headers option.


# OpenClaw

Last updated: April, 2026

> **TL;DR** Add the Plurality MCP Server to your `openclaw.json`, restart OpenClaw, and authenticate. Your OpenClaw agent gets read and write access to your memory buckets.

#### Prerequisites

* A Plurality account
* OpenClaw installed and running (see [OpenClaw's docs](https://docs.openclaw.ai))
* Edit access to your `openclaw.json` config file
* An access token from the Memory Studio

#### Why connect OpenClaw to Plurality

OpenClaw runs continuously and executes tasks autonomously — cron jobs, event listeners, background workflows. By default, every task starts from a blank slate. Connecting it to the Plurality MCP Server lets every OpenClaw run draw on your accumulated context: project history, past decisions, preferences, ongoing notes.

In practice: an OpenClaw agent that reviews your inbox each morning, drafts replies in your usual voice, and stores its summaries back into your memory bucket. The agent stays consistent across runs because the context is yours, not the agent's session.

#### Setup

**Find your config file**

OpenClaw stores its config at `~/.openclaw/openclaw.json` by default:

| OS      | Path                                               |
| ------- | -------------------------------------------------- |
| macOS   | `~/.openclaw/openclaw.json`                        |
| Linux   | `~/.openclaw/openclaw.json`                        |
| Windows | `C:\Users\<your-username>\.openclaw\openclaw.json` |

If you've set the `OPENCLAW_CONFIG_PATH` environment variable to a custom location, edit that file instead.&#x20;

**Add the Plurality MCP Server with a Personal Access Token (headless setups)**

For servers, CI pipelines, or any environment where opening a browser isn't practical, use a Personal Access Token instead. Read more [here](/the-plurality-mcp-server#personal-access-token-api-key) how to create PATs on the Memory Studio.

Open the config file and add the Plurality MCP Server to the `mcp` section. Create one if its not there

```json
...
"mcp": {
    "servers": {
      "plurality": {
        "url": "https://app.plurality.network/mcp",
        "transport": "streamable-http",
        "headers": {
          "Authorization": "Bearer plur_pat_your-access-token"
        }
      }
    }
  }
...
```

(optional) Set the token as an environment variable rather than hard-coding it:

```
export PLURALITY_PAT=plk_<your_token>
```

Restart OpenClaw to pick up the new config (`openclaw gateway restart`), or wait for hot reload.

> The Gateway also watches the config file and applies most changes automatically. If hot reload picks up the change, you don't need to restart manually.

#### Verify

To verify, you can run the command `openclaw mcp list` , it should show the added mcp server.&#x20;

To check further, open the openclaw UI and open chat. Inside the chat, write

```
List every tool you have access to, 
including the MCP server each one comes from. Don't skip any.
```

This should return all the tools of the mcp server.

#### Use it

Once connected, the Plurality tools are available to your OpenClaw agent in the same way as any other MCP tool. A few practical patterns:

* **Read context into a task.** *"Look up what I know about Project X in Plurality before drafting this email."*
* **Save context from a task.** *"After summarizing today's meetings, save the summary to my Work bucket."*
* **Cross-tool continuity.** Anything OpenClaw saves is immediately available in Claude, ChatGPT, Cursor — and vice versa.

#### Troubleshoot

**OpenClaw doesn't see the Plurality tools after restart.** Confirm the JSON is valid (a missing comma will silently disable the entry). Check the URL is exactly `https://app.plurality.network/mcp` with no trailing slash.

**`401 Unauthorized` on every call.** Either the PAT expired or the PAT is invalid.Regenerate the token in your memory studio and update the environment variable.

**Tools call slowly or time out.** Semantic search on large buckets can exceed default timeouts. Increase the timeout settings in `openclaw.json`.


# Other MCP Clients

Last updated: April, 2026

> **TL;DR** Any MCP client that supports streamable HTTP transport and OAuth 2.1 with Dynamic Client Registration can connect.

#### What you need from the client

The Plurality MCP Server uses standard MCP. Your client needs to support:

* **Streamable HTTP transport** (not just stdio-only clients)
* **OAuth 2.1 with Dynamic Client Registration (DCR)** for the recommended auth path
* *Or* support for custom Authorization headers, if you'd rather use a Personal Access Token

#### Setup

Point your client at:

```
https://app.plurality.network/mcp
```

**With OAuth (recommended).** Most modern MCP clients handle OAuth automatically: configure the URL, and on first use the client opens a browser window for authentication. Tokens are cached locally by the client.

**With a Personal Access Token.** For headless environments — CI pipelines, scripts, server-side agents — generate a PAT in your Plurality dashboard and pass it as an Authorization header:

```
Authorization: Bearer <your_token>
```

See Authentication on the MCP Server page for the full PAT setup.

#### What the server exposes

Once connected, the client has access to seven tools: `get_user_memory_buckets`, `list_items_in_memory_bucket`, `search_memory`, `read_context`, `save_memory`, `save_conversation`, `create_memory_bucket`. See The Plurality MCP Server for details.

#### Verify

Call the `get_user_memory_buckets` tool. If it returns your buckets, you're connected.

#### Troubleshoot

**Client doesn't support OAuth DCR.** Use a Personal Access Token instead.

**Connection fails before authentication.** Confirm the URL is `https://app.plurality.network/mcp` exactly — no trailing slash, no extra characters.

**Tools list is empty after connection.** Authentication likely didn't complete. Check the client's logs for OAuth errors, or fall back to PAT auth.

**Need to test the connection without a client?** Use [`mcp-cli`](https://www.npmjs.com/package/mcp-cli) or any MCP debugger to hit the endpoint directly.


# Smart Profiles

> 📜 **Smart Profiles are a previous product iteration of Plurality Network.**
>
> Smart Profiles are decentralized, user-owned data containers — the original primitive Plurality built to put context under user control. The active primitive used by AI Context Flow today is the **memory bucket**, but memory buckets are an architectural offspring of the Smart Profile model. Smart Profiles formed the conceptual and architectural basis for everything Plurality builds today.

Smart Profiles are user-owned, decentralized, composable containers of context — preferences, history, identity, behavior, intent — that can be used across AI agents and applications to deliver hyper-personalized experiences.

Instead of siloed data spread across platforms, Smart Profiles unify and enrich a user's digital footprint, making it portable, programmable, and private by default.

In an AI-first world, where intelligence is distributed across apps, agents, and platforms, Smart Profiles act as the bridge that carries your context wherever you go — from shopping assistants to content feeds, financial apps to educational agents.

#### Core benefits

**Contextual portability.** Carry digital context between apps and agents without re-entering data or retraining systems.

**Hyper-personalization.** Apps and AI agents can tailor experiences to a user's goals, interests, and history — with consent.

**Context aggregation.** Combine inputs from existing wallets, Web2 profiles, and app usage into a unified AI-ready profile.

**Plural identities.** Create multiple Smart Profiles (e.g. work, play, creator) tied to one root identity but optimized for different contexts.

**Programmable privacy.** Decide what context is shared, with whom, and under what conditions, powered by decentralized access control.

**AI-ready.** Enable context-aware AI agents that understand preferences, adapt over time, and act on the user's behalf.

#### Ownership and control

Users control Smart Profiles using DIDs (decentralized identifiers) created from their wallets. These wallets and DIDs can be controlled from an authentication method of the user's choice — email, Google, a Web3 wallet, or others.

Users retain 100% ownership of their data. No platform owns, controls, or can manipulate it — not even Plurality Network. The same ownership model applies to memory buckets in AI Context Flow today.

#### Integration into Apps

Smart Profiles are a decentralized login mechanism that can be integrated into any app. We cover the developer guides for its integration in the next sections.


# Developer Guides

Smart Profiles is the embedded profiles wallet that any app can integrate to allow sign in with profile functionality for their users.

Apps can register with Plurality and configure which profile do they want their users to login with (examples: Social, Metaverse, Gaming)

When users login to this App, they will be shown a specific profile to login with. By connecting their profile, they allow to share some insights about their interests and preferences (in a privacy-preserving way).

Apps can use these information to tailor experiences according to this user, thereby providing users with a better onboarding and overall experience on the dApp.

### Embedded Login

You can use embedded login for contextual (smart) profiles to integrate login + context injection in your applications.&#x20;

With just 10 minutes of setup, you get out-of-the-box support for:&#x20;

<details>

<summary>Easy login for your users</summary>

A variety of login methods, including email, gmail and metamask. (More coming soon)

</details>

<details>

<summary>Self-custodial embedded profiles</summary>

The profiles onboarding solution embeds into your UI without feeling clunky

</details>

<details>

<summary>Custom user profiles made to fit your application needs</summary>

Connect different platforms into the onboarding workflow, add your own custom data into user profile, create unique scoring mechanisms - anything that your dapp needs, without the hassle of maintaining your own CRM or database

</details>

<details>

<summary>Customizable UI as per your application needs</summary>

Customize the UI according to your app

</details>

## Technical Guides

Follow the guides below to get step-by-step flows of how to integrate embedded smart profiles into your apps.&#x20;

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><p><strong>Wallet Integration</strong></p><p><br>Integrate Smart Profiles Wallet into your application</p></td><td></td><td></td><td><a href="/pages/BxRF35gS7F2cDa8hMNW1">/pages/BxRF35gS7F2cDa8hMNW1</a></td></tr><tr><td><p><strong>Wallet</strong> <strong>functions</strong></p><p><br>Use wallet SDK to use standard web3 functions from your wallet</p></td><td></td><td></td><td><a href="/pages/yW0hYl6VCUnwGMv5JUrV">/pages/yW0hYl6VCUnwGMv5JUrV</a></td></tr><tr><td><p><strong>Smart</strong> <strong>Profiles</strong></p><p></p><p>Use profiles SDK to get/set user data from profiles necessary for personalization</p></td><td></td><td></td><td><a href="/pages/7RRNQ8uENish5ZcXuhwl">/pages/7RRNQ8uENish5ZcXuhwl</a></td></tr></tbody></table>


# Wallet Integration

> This guide shows you how to integrate the smart profiles wallet into your application.

Plurality provides an embedded profiles widget that can be integrated into your application to be used as the wallet login solution that supports creation of profiles as well.&#x20;

The wallet is created through a network of MPC-TSS in the background and the profile is created on decentralized storage, encrypted with the secrets created through the wallet.&#x20;

The widget allows users to have an easy login while ensuring that they maintain full custody over their wallet and data.  \
\
Adding the widget is very simple. Let’s take a look at the steps below:&#x20;

### Prerequisites

* Node.js and npm installed
* React v18
* Typescript

> Need to quickly get started? [Clone our boilerplate](https://github.com/Web3-Plurality/plurality-developer-guides) to have a basic application with embedded widget and all the wallet functions already in there.

### Create or Clone a React Application

Create a react, vite or next application.&#x20;

{% hint style="info" %}
The recent react 19 has some breaking changes. If you face these, try downgrading the version of react and react-dom to ^18.0.0 in the package.json
{% endhint %}

### Install Required NPM Packages

Install the following packages

```cmake
npm install @plurality-network/smart-profile-wallet 
```

### Add the Widget to the required page

On the page where you want to create the login/onboarding process, add the following code. You can also simply put it in App.tsx

```typescript
// import the packages at the top of the page
import { PluralitySocialConnect } from '@plurality-network/smart-profile-wallet'


// in the ts part of the page add the following
const options = { clientId: '', theme: 'light', text: 'Customizable Text' };


// in the tsx/jsx part of the page add the following tag
<PluralitySocialConnect
    options={options}
    onDataReturned={handleDataReturned}
/>
```

The PluralitySocialConnect tag adds a "Connect Profile" button on your page. When the user clicks on the button it opens the embedded widget which walks the user through the onboarding flow.<br>

{% hint style="info" %}
Most app developers prefer to create a header component and put the PluralitySocialConnect tag in there. This makes the button consistent across all pages in the website. Once the login process is complete, the button automatically changes to a circular profile icon with the user's avatar.
{% endhint %}

### Create ClientId from Developer Dashboard

Every application that uses Plurality's Social Connect widget needs to provide a clientId created specifically for this application. To get the id, follow the steps:

1. Go to [developer dashboard](https://developer.plurality.network/)
2. Register or Login with your email
3. Fill out the details of your project and create a new application from the dashboard once you are logged in
4. Provide all the details of the application you are building including logo, urls for testing and prod, profile name and description etc.&#x20;
5. Once you press submit, your app will be created and you will be shown three parameters: Client App Id, Client App Secret, and Profile stream Id
6. Copy the client app id and use in the options to embed the plurality social connect in your application.

Explaining the parameters we get from the dashboard a bit more here:

**Client App Id** is the specific public id created for your application which you need to pass in the options for plurality social connect widget. It is a public parameter that needs to be added in your frontend code.

**Client App Secret** is the secret parameter you can use to create server side sessions. More details about it can be read [here](/smart-profiles/developer-guides/server-side-sessions).

**Profile Stream Id** is the stream id created for your app-specific profile created on decentralized storage. You can use that stream to view your published profile on [explorer](https://cerscan.com/mainnet/project/plurality)

{% hint style="info" %}
If your client app secret is compromised, you can rotate it and create a new one from the dashboard. The client app id and profile stream id however are public variables and are fixed.
{% endhint %}

Other than the clientId, you can also pass in theme (which can be either light or dark) and text (which changes the text of the login button).

The code would look like this after adding all parameters of options:

```typescript
import { PluralitySocialConnect } from '@plurality-network/smart-profile-wallet'

const options = { clientId: '6ea8bf02-ea37-403f-b74c-f117fd3bc0a1', theme: 'light', text: 'Customizable Text' };

<PluralitySocialConnect
    options={options}
    onDataReturned={handleDataReturned}
/>
```

### Change Appearance of the Connect Profile Button

If you want to change the appearance of the "Connect Profile" button, you can pass in some UI customization parameters to match the appearance of your platform. Like the following:&#x20;

```typescript
<PluralitySocialConnect
    options={options}
    customization={{
        backgroundColor: 'cyan',
        color: 'black'
    }} 
/>
```

The customization is optional and if you don't want it you can skip it. The following customization options are available though:

<details>

<summary>Button UI Customization Options</summary>

```typescript
customization?: {
    minWidth?: string
    height?: string
    borderRadius?: string
    backgroundColor?: string
    color?: string
    hoverBackgroundColor?: string
    hoverTextColor?: string
    marginTop?: string,
    fontSize?: string,
    fontFamily?: string
};
```

</details>

{% hint style="info" %}
The Smart Profiles Wallet supports all EVM compatible chains but for now, the widget is in beta and by default will use Sepolia Testnet so you can test out the functions in a developer mode.
{% endhint %}

{% hint style="info" %}
Need support for a certain blockchain? Contact us on our [discord](https://discord.com/invite/Mb6ZDgGjcP)&#x20;
{% endhint %}


# Wallet SDK

> This guide shows how to use standard web3 wallet functions&#x20;

Every wallet needs to interact with the blockchain for carrying out various functions. Once the widget is embedded and the user connects their profile through their preferred auth method, a session is created for this user after which the standard wallet functions can be utilized.

### AuthMethod

To create a wallet, user first needs to choose how do they want to create the wallet i.e. select their AuthMethod. Currently we support 3 auth methods (with support for more auth methods coming soon)   i.e. gmail, email and metamask.

Once the user selects a certain auth method, a wallet is created in the network that makes sure that this wallet is accessible only with a valid login jwt of the selected auth method.&#x20;

{% hint style="info" %}
If the user uses an email for creation of a wallet and then later on selects gmail for that same email address, we **do not** create two separate wallets rather tag both authmethods to the same user. Currently no other embedded wallet products offer this feature, resulting in users regularly forgetting what they used to sign up to an application. We reduce this cognitive load for end users.
{% endhint %}

### ProfileSession

After successful login of profile, a session is created that allows user to access the SDK functions. The session expires after a certain time or when the user logs out. Without valid session signatures, the MPC network will not allow for signature signing.&#x20;

{% hint style="info" %}
As soon as the login process is complete, the connect profile button will automatically change to a circular profile icon with the user's avatar in it and a dropdown with basic profile functions.&#x20;
{% endhint %}

## Wallet SDK

To access the wallet functions, the following import should be done on the page/component where the functions need to be called.&#x20;

```typescript
import { PluralitySocialConnect } from '@plurality-network/smart-profile-wallet';
import { 
            AllAccountsDataType, 
            ConnectedAccountDataType, 
            SignMessageDataType, 
            VerifySignedMessageDataType,
            GetBalanceDataType, 
            GetBlockNumberDataType, 
            GetTransactionCountDataType, 
            ReadFromContractDataType, 
            SendTransactionDataType, 
            WriteToContractDataType 
        } from '@plurality-network/smart-profile-wallet';
```

You can add/remove the types based on the functions you actually use on the page.&#x20;

> [Clone our boilerplate](https://github.com/Web3-Plurality/plurality-developer-guides) to have a basic application with embedded widget and all the wallet functions already in there.

Once the application has access to a valid session i.e. the user has successfully logged in, the following wallet functions become accessible.&#x20;

### Get All Connected Accounts

Returns all connected accounts/addresses e.g. \[0x123…, 0x456…].&#x20;

```typescript
const response = (await PluralitySocialConnect.getAllAccounts()) as AllAccountsDataType;

if (response) {
    const allAccounts = response.data;
    return allAccounts[0]?.address;
}
```

### Get Current Connected Account

Get current account connected

```typescript
const response = (await PluralitySocialConnect.getConnectedAccount()) as ConnectedAccountDataType;

if (response) {
    const connectedAccount = response.data;
    return connectedAccount?.address;
}
```

### Get Signature

Gets the message signed using the connected account and returns the signature.

```typescript
const response = (await PluralitySocialConnect.getMessageSignature(message)) as SignMessageDataType;
if (response) {
    const signMessage = response.data;
    return signMessage;
}
```

### Verify Message Signature

Verify if the signature matches the message using the current connected account and returns boolean true or false.

```typescript
const response = (await PluralitySocialConnect.verifyMessageSignature(message, key)) as VerifySignedMessageDataType;
if (response) {
    const verifyMessage = response.data;
    return verifyMessage;
}
```

### Get Balance

Returns balance of the current account in wei. You need to convert it to the required denomination yourself.&#x20;

{% hint style="info" %}
Please note that since Plurality profiles are chain agnostic, you need to provide the RPC and the chainId to ensure that balance is being read from the current read. You can find the RPC and the chainId of your preferred chain through this [link](https://chainlist.org/). We currently support only EVM-compatible chains.&#x20;
{% endhint %}

```typescript
const response = (await PluralitySocialConnect.getBalance(rpc, chainId)) as GetBalanceDataType;
if (response) {
    const getBalance = response.data;
    return getBalance;
}
```

### Send Transaction

Send a certain amount (in ethers) to a certain address. Returns the transaction object.

{% hint style="info" %}
Please note that since Plurality profiles are chain agnostic, you need to provide the RPC and the chainId to ensure that balance is being read from the current read. You can find the RPC and the chainId of your preferred chain through this [link](https://chainlist.org/). We currently only support EVM-compatible chains.
{% endhint %}

```typescript
const response = (await PluralitySocialConnect.sendTransaction(rawTx, rpc, chainId)) as SendTransactionDataType;
if (response) {
    const sendTransactionData = response.data;
    return sendTransactionData;
}
```

### Get Block Number

Returns the latest block number.

```typescript
const response = (await PluralitySocialConnect.getBlockNumber(rpc, chainId)) as GetBlockNumberDataType;
if (response) {
    const blockNumber = response.data;
    return blockNumber;
}
```

### Get Transaction Count

Returns the transaction count of the given address

```typescript
const response = (await PluralitySocialConnect.getTransactionCount(address, rpc, chainId)) as GetTransactionCountDataType;
if (response) {
    const transactionCount = response.data;
    return transactionCount;
}
```

### Read from contract

Returns the response of executing the given get method of the contract with the given parameters

```typescript
const response = (await PluralitySocialConnect.readFromContract(address, abiVal, action, params, rpc, chainId)) as ReadFromContractDataType;
if (response) {
    const readContract = response.data;
    return readContract;
}
```

### Write to contract

Returns the transaction response of executing the given write method of the contract with the given parameters

```typescript
const response = (await PluralitySocialConnect.writeToContract(address, abiVal, action, params, rpc, chainId, options)) as WriteToContractDataType;
if (response) {
    const writeContract = response.data;
    return writeContract;
}
```

{% hint style="info" %}
Didn't find what you were looking for? Contact us on discord [here](https://discord.com/invite/Mb6ZDgGjcP).
{% endhint %}


# Smart Profiles SDK

> This guide shows how to use the user profile associated with each wallet

**Our embedded widget is more than just a wallet. It is a comprehensive profile solution.** \
\
Each wallet has n different profiles attached to it, one of which is tagged to your application based on the customizations that you did when setting up the widget.&#x20;

{% hint style="info" %}
Ideally each application should setup a profile that is closest to their use case. For e.g. if you are a social application, use the pre-built social profile or if you are a gaming platform, use the gaming profile.&#x20;

This will allow users that have utilized similar platforms to have a one-click onboarding to your platform, making it extremely easy for users to check out your application.&#x20;
{% endhint %}

Each profile contains basic user information like name, bio, avatar and description. Moreover, it also has the user's interests & reputation which are analyzed from the social accounts connected to that profile. Lastly, it also supports scores, some of which are calculated by the protocol, others you can setup for your specific application.&#x20;

{% hint style="info" %}
Support for custom scoring is not yet shipped but will soon. The protocol level scoring however is available which increases the score when more platforms are connected to the profile by the user.
{% endhint %}

## Smart Profiles Schema

The Smart Profiles Schema can be viewed [here](broken://pages/Xetd6bvAWzHuUzL6BzzA).

## Using the Profiles SDK

As an application developer, you can get profile data from the connected wallet. This will allow you to customize your interface according to your user. Also, it will allow you to cater to your user’s interests and tailor experience accordingly.&#x20;

For example, you can offer product recommendations, or curate user’s feed or show them relevant content.&#x20;

You can also gate access to certain content or area of your application based on the profile’s information.

Every time the user does a successful login, you will get a response in the data handler that’s attached to the embedded widget

```typescript
const handleDataReturned = (data) => {
        const receivedData = JSON.parse(JSON.stringify(data))
        console.log(receivedData);
    };


<PluralitySocialConnect
        options={options}
        onDataReturned={handleDataReturned}
/>
```

If login has been successful and there is now a valid session, the handleDataReturned function will get a valid jwt token showing that there is now an active session.&#x20;

{% hint style="info" %}
To view the profiles data, you can visit the [explorer](https://cerscan.com/mainnet/project/plurality)
{% endhint %}

### Get Smart Profile Data

To fetch the smart profile data, you can use the following function.

```typescript
const response = (await PluralitySocialConnect.getSmartProfileData()) as ConnectedAccountDataType;
if (response) {
    const smartProfileData = response.data;
    return smartProfileData;
}
```

### Fetch Login Information

At any point in your application, if you want to fetch the login information of the connected account i.e. the status of the connected and session token (JWT), then you can use the following function.

```typescript
const response = (await PluralitySocialConnect.getLoginInfo()) as ConnectedAccountDataType;
if (response) {
    const loginInfoData = response.data;
    console.log("Connected Account Info (Inisde dApp)::", loginInfoData);
    return loginInfoData;
}
```

### Update User Consent

When the user logs in to the platform the first time, they are asked whether they want to share their data with this platform or not. If the user decides not to share data, then the application only gets basic user information including name, avatar, bio. However, if the user decides to share their information then the application gets all the required data e.g. interests, reputation, scores, etc. \
\
However, user can change their decision anytime throughout the application flow. If at any point throughout the application flow, you want to ask users to reconsider their consent, then the update consent function can be used.&#x20;

```typescript
const response = (await PluralitySocialConnect.updateConsentOption()) as ConnectedAccountDataType;
if (response) {
    const smartProfileData = response.data;
    return smartProfileData;
}
```

## Set Smart Profile Data

As a decentralized application developer, you might also need to store user’s information in a verifiable, decentralized, but gasless and privacy-preserving way. If you want to store any information about the user derived from their actions on your platform, you can set that information in your user’s profile. Next time when the user logs in to you application again, your application will have access to this data again through the SDK functions. \
\
This provides an out-of-the-box profile solution for your application without you having to worry about setting up a database or taking any liability for user data. With Plurality’s SDK, managing user profiles is as simple as calling get and set functions.

#### Visibility and permissions of the stored data

Since user profiles are shared amongst different apps and platforms, if you want to ensure that the data you put in your user’s profile cannot be seen by any other application, then your application needs to set it in a private way.&#x20;

The application has two options:

* **Store data publicly:** Suitable for any data that is not sensitive for the application. It will be available to all other applications as well if they want to read it.
* **Store data privately:** Suitable for sensitive data. It will only be readable for the application that stored it initially. No other application will be able to read it even if they use the same profile schema.&#x20;

### Set Public Data

Applications can store data for handling any business logic on the application publicly.&#x20;

```typescript
const response = (await PluralitySocialConnect.setPublicData("key", "value")) as ConnectedAccountDataType;
if (response) {
    return response.data
}
```

### Get Public Data

To get previously stored data, the application can get it using the following function

```typescript
const response = (await PluralitySocialConnect.getPublicData("key")) as ConnectedAccountDataType;
if (response) {
    console.log("response", response.data)
}
```

### Set Private Data

Applications can store data for handling any business logic on the application privately.&#x20;

```typescript
const response = (await PluralitySocialConnect.setPrivateData("key", "value")) as ConnectedAccountDataType;
if (response) {
    console.log("response", response.data)
}
```

### Get Private Data

To get previously stored data, the application can get it using the following function

```typescript
const response = (await PluralitySocialConnect.getPrivateData("key")) as ConnectedAccountDataType;
if (response) {
    console.log("response", response.data)
}
```


# Server Side Sessions

Explore how you can create server side sessions in your application using Plurality's SDK

## What are Sessions?

Sessions are used to uniquely identify users, determine access privileges, and maintain their login state within an application.

When a user signs in through Plurality's social connect widget, a session is created for them on frontend which is used to relieve authenticated users from having to repeatedly login again and again, ensuring a seamless and personalized user experience.

However, what if the application wants to do some authenticated operations for this user using their backend? For e.g. calling some API endpoints or do some access control only for logged in users?

This is where server-side sessions come into play.

> Server-side sessions are a method of storing session data on the server rather than in the client's browser. When a user interacts with a web application, a session is created to maintain state across multiple requests (e.g., logging in, tracking a shopping cart, etc.).

Even though Plurality's widget is primarily a client-side component, however, we offer a comprehensive suite for building dynamic and secure applications and therefore support server-side sessions as well.

## How to create Server Side Sessions with Plurality?

1. Create your app on[ developer dashboard](https://developer.plurality.network/) and extract **Client Id** and **Client Secret** from the dashboard. Your backend should have access to both the Client Id and Client Secret&#x20;

{% hint style="danger" %}
Important: never keep the client secret on the frontend since this is a private secret
{% endhint %}

2. From the frontend, extract the **pluralityToken** by calling the following Plurality SDK function

```typescript
const response = (await PluralitySocialConnect.getLoginInfo()) as ConnectedAccountDataType;
```

This will return the token of the connected user.\
\
3\. Now, to create a session for this user on the backend, send this token from frontend to your backend. In the backend, validate this token by calling the following API. You have to pass in the token in the data, and the clientId and clientSecret in the authorization.

{% hint style="success" %}
You can also use the [swagger](https://app.plurality.network/api/docs-client/#/) here. \
\
1\. Authorize the user by adding `username = clientId` and `password=clientSecret.` 2. Call the /user/validate function giving the `"token": "xxx-token-from-getLoginInfo"` in body.
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

```javascript
curl --location --request GET 'https://app.plurality.network/api/user/validate' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic $(echo -n 'Your-Client-Id:Your-Client-Secret' | base64)' \
--data '{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNkODY4MjFlLTRiMDMtNGU3ZS04ZDg5LTRiNzZmZjNmZmU0OSIsInVuaXF1ZVNlc3Npb25JZCI6ImU5M2I0ZDQ1LTg0ZDAtNDRhOS05YzU1LTgyZTgxNjkxZDk3MSIsImlhdCI6MTczOTYyMzU0NCwiZXhwIjoxNzM5NzA5OTQ0fQ.HhMdOI-8vNVGmClrHJuMasfcOdJFaQ-VgxsH4zlgDug"}'
```

{% endtab %}

{% tab title="NodeJS" %}

```typescript
const axios = require('axios');
let data = JSON.stringify({
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNkODY4MjFlLTRiMDMtNGU3ZS04ZDg5LTRiNzZmZjNmZmU0OSIsInVuaXF1ZVNlc3Npb25JZCI6ImU5M2I0ZDQ1LTg0ZDAtNDRhOS05YzU1LTgyZTgxNjkxZDk3MSIsImlhdCI6MTczOTYyMzU0NCwiZXhwIjoxNzM5NzA5OTQ0fQ.HhMdOI-8vNVGmClrHJuMasfcOdJFaQ-VgxsH4zlgDug"
});

const clientId = 'your_client_id';
const clientSecret = 'your_client_secret';

const auth = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://app.plurality.network/api/user/validate',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': `Basic ${auth}`
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
```

{% endtab %}
{% endtabs %}

If the API returns a valid response, this means that the token is not yet expired and is valid. Based on this response, the application developer can setup a session management scheme on their backend that fits their needs.

{% hint style="info" %}
Have more questions? Get in touch with the team through our [discord](https://discord.com/invite/Mb6ZDgGjcP) to clarify your concerns.
{% endhint %}


