stashly

MCP server (for AI assistants)

Stashly can act as a Model Context Protocol server, so an AI assistant (Claude Code, Codex, opencode, VS Code, Cursor, Gemini CLI, Windsurf, Zed, Cline, Antigravity and other MCP clients) can use it as a place to keep notes: create a stash for a topic, push notes into it, edit, tag and retitle them, check when things expire, and read them back later.

How access works

Three things decide what an assistant can do, and all three are checked by the server:

  1. A token that belongs to a person. Every signed-in user makes their own tokens under User Settings > MCP (or signs an app in, see below). The assistant acts as that person: it sees what they see (stashes they own or were shared, private ones included) and nothing more.
  2. A switch on each stash. A stash is off for assistants until its owner turns it on: open the stash, Stash Settings > Access > AI assistants and tick Let AI assistants use this stash. A stash that is off is answered exactly like one that does not exist.
  3. What to keep from them. Under that switch, Keep secret and burn-after-reading notes from them is on by default: those notes are not listed and cannot be read, updated or counted. Untick it and they are listed (without their text), and a secret note can be read; a burn-after-reading note is never opened, because reading would destroy it.

A stash an assistant creates is its person’s own and is switched on for assistants, with secret and burn notes kept from them.

Switching stashes on. In a stash’s settings, as above, or from My stashes: the menu of a stash you own has Let AI assistants use this (or Stop AI assistants using this), and a stash that assistants may use wears an AI tag. To switch on every stash you make from now on, tick Let AI assistants use the stashes I make from now on in User Settings > MCP (shown when the server runs MCP). New stashes then start switched on with secret and burn-after-reading notes kept from assistants; older stashes keep their own choice, and you can change any stash afterwards.

Turn it on

  1. Sign in as the admin and open Admin > Server Settings > MCP. Tick Enable the MCP server and Save changes (or start the server with MCP_ENABLED=true).
  2. Restart Stashly. The endpoint only starts with the server. It needs ADMIN_PASSWORD, because accounts need the admin area.
  3. Each person who wants to connect an assistant opens User Settings > MCP, types a name for the token (say Claude Code on my laptop, so you know where it is used) and presses Make a token. The token is shown once, with ready-made commands for each client. Afterwards the list shows each token’s name, its last four characters (to match it to the one in a client’s settings), when it was made and when it was last used. Revoke ends one at once. Up to 10 tokens per person. The admin sees every token under User Settings > MCP and can revoke any.

Connect ChatGPT, Claude on the web and other apps that sign in (OAuth)

Some assistants cannot be given a token to paste. They run in the vendor’s cloud and ask the server to let you sign in instead. Stashly supports that sign-in (OAuth 2.1 with PKCE, the way the MCP specification describes), so you add Stashly to them as a custom connector with only its address:

  1. The server has to be reachable from the internet over HTTPS, because the vendor’s servers call it (an address on your own computer or LAN does not work for these). Set Address of this server (PUBLIC_URL) to that address, for example https://stash.example.com, so the sign-in describes itself correctly. Behind a reverse proxy, pass /mcp, /oauth/ and /.well-known/ through.
  2. In the assistant, add a custom connector (ChatGPT: Settings > Connectors, with developer mode on; Claude: Settings > Connectors > Add custom connector) and give it https://<your stashly>/mcp. Choose OAuth if it asks, and leave any client ID and secret empty: the app registers itself.
  3. The app sends you to a Stashly page. Sign in if you are not, read what it asks for, and press Allow. It is then connected as you.

What the app gets is an access token like the ones you make by hand: it acts as you, reaches only the stashes switched on for assistants, and shows in User Settings > MCP as a signed in app with the app’s name. Revoke signs it out at once. Its access token lasts an hour, and a refresh token the app keeps (used once, valid 90 days if not used) gets it a new one without asking you again; an app that is not used for 90 days has to be approved again. Approving the same app again replaces its earlier sign-in. The tokens count towards your 10.

The endpoints, for anyone writing a client: /.well-known/oauth-protected-resource, /.well-known/oauth-authorization-server, POST /oauth/register (dynamic client registration; public clients only, redirect addresses are https, plain http on this computer, or the app’s own scheme), /oauth/authorize (a page), and POST /oauth/token (authorization_code with code_verifier, and refresh_token). Only S256 PKCE is accepted.

Connect a client

The address is https://<your stashly>/mcp and every request carries Authorization: Bearer <token>. Replace the address and token below.

Claude Code

claude mcp add --transport http stashly https://stash.example.com/mcp --header "Authorization: Bearer stm_..."

Codex (the token goes in an environment variable; or put [mcp_servers.stashly] with url and bearer_token_env_var = "STASHLY_TOKEN" in ~/.codex/config.toml)

export STASHLY_TOKEN=stm_...
codex mcp add stashly --url https://stash.example.com/mcp --bearer-token-env-var STASHLY_TOKEN

opencode (opencode.json; oauth: false because the token is the credential)

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "stashly": {
      "type": "remote",
      "url": "https://stash.example.com/mcp",
      "oauth": false,
      "headers": { "Authorization": "Bearer {env:STASHLY_TOKEN}" }
    }
  }
}

VS Code (.vscode/mcp.json, or your user mcp.json)

{
  "servers": {
    "stashly": {
      "type": "http",
      "url": "https://stash.example.com/mcp",
      "headers": { "Authorization": "Bearer stm_..." }
    }
  }
}

Antigravity (mcp_config.json: MCP servers > Manage MCP servers > View raw config)

{
  "mcpServers": {
    "stashly": {
      "serverUrl": "https://stash.example.com/mcp",
      "headers": { "Authorization": "Bearer stm_..." }
    }
  }
}

Cursor (~/.cursor/mcp.json, or .cursor/mcp.json in a project; set STASHLY_TOKEN in the environment Cursor starts from)

{
  "mcpServers": {
    "stashly": {
      "url": "https://stash.example.com/mcp",
      "headers": { "Authorization": "Bearer ${env:STASHLY_TOKEN}" }
    }
  }
}

Gemini CLI (saves to the current project; add -s user after add for ~/.gemini/settings.json)

gemini mcp add --transport http --header "Authorization: Bearer stm_..." stashly https://stash.example.com/mcp

Windsurf (~/.codeium/windsurf/mcp_config.json: Cascade > MCP servers > View raw config)

{
  "mcpServers": {
    "stashly": {
      "serverUrl": "https://stash.example.com/mcp",
      "headers": { "Authorization": "Bearer stm_..." }
    }
  }
}

Zed (settings.json)

{
  "context_servers": {
    "stashly": {
      "url": "https://stash.example.com/mcp",
      "headers": { "Authorization": "Bearer stm_..." }
    }
  }
}

Cline (cline_mcp_settings.json: MCP Servers > Configure)

{
  "mcpServers": {
    "stashly": {
      "type": "streamableHttp",
      "url": "https://stash.example.com/mcp",
      "headers": { "Authorization": "Bearer stm_..." }
    }
  }
}

Claude Desktop, or any client that starts a program (needs Node 22 and the file bin/stashly-mcp.js from Stashly; replace the path). With a token the program only passes the client’s messages on to the server’s /mcp endpoint, so the server decides what the token may do:

{
  "mcpServers": {
    "stashly": {
      "command": "node",
      "args": ["/path/to/stashly/bin/stashly-mcp.js"],
      "env": { "STASHLY_URL": "https://stash.example.com", "STASHLY_TOKEN": "stm_..." }
    }
  }
}

After npm link (or npm install -g .) the command is also available as stashly-mcp, with no path. For Claude Code: claude mcp add stashly --env STASHLY_URL=... --env STASHLY_TOKEN=... -- node /path/to/stashly/bin/stashly-mcp.js.

The client commands above were written from each client’s documentation; if one has changed its syntax, the address, the Authorization: Bearer header and the token are all it needs.

Tools

Tool What it does
create_stash topic (required), visibility, password, ttl. Makes a stash for a topic, owned by the token’s person and returns its name and link. It is private by default: only that person, signed in, can open it (assistants acting for them still can), and it is switched on for assistants with secret and burn notes hidden. An assistant makes an open stash only when told to: visibility: "link" (anyone with the link) or a password (anyone who knows it); the person can change it any time in Stash Settings > Access. A stash that is not private has a name that is the topic plus a random tail (q3-launch-plan-x7k2pq) when it has no password, because then the name is the only lock. Run without a token (the program on its own), there is no person to keep the stash private for, so it is open as before.
add_note stash (name or link), text, title, tags (up to 8), password, create_if_missing. Adds a note and tags it. With create_if_missing a stash that does not exist is made first, private like create_stash makes it.
list_stashes search, limit (1-100, default 50). The stashes this person can use through assistants: their own and the ones shared with them that are switched on for AI, with name, link and access. Needs an access token (the stdio program without one cannot list).
list_notes stash, search, tag, limit (1-100, default 20), password. Lists items newest first with id, date, title, tags, whether pinned, when each expires, and the start of each note, plus the tags in use.
read_note stash, id, password. Reads one note in full, with its tags, created and edited times and when it expires.
get_stash stash, password. The stash’s details: created, when it expires (or never, and how long is left), whether it has a password, what it holds, how full it is, the newest-N limit, the tags in use, and what the person may do in it.
update_note stash, id, text, title, tags, password. Edits a note: its text (the whole new text replaces the old), title and/or tags (a file takes only a title and tags). Tags replace the old ones (an empty list clears them); an empty title goes back to the first words of the note; changing only the text keeps the title. The edit is refused if someone changed the note after the assistant read it, so a newer edit is never overwritten, and a note cannot be made empty.

A typical use: “Research X and keep what you find in a stash for it”. The assistant calls create_stash once, then add_note for each finding, tags and refines them as it learns more with update_note, and gives you the link.

What it will not do

Notes on safety

The stdio program without a token

bin/stashly-mcp.js without STASHLY_TOKEN works as any visitor of the server does, through its API: whoever has a stash’s name (or password) can use it, and a stash’s AI assistants switch does not apply. It is for a server you run for yourself; for anything shared, give it a token. It takes STASHLY_URL (default http://localhost:3000) and STASHLY_PASSWORD (a password to try for password-protected stashes; a tool call can give its own).