Thortspace API

Your own programs can read and build Thortspace arrangements through the same address AI assistants use:

https://thort.cloud/mcp

It speaks MCP (Model Context Protocol): JSON-RPC 2.0 over HTTPS. Any language that can send an HTTPS request can use it, and so can any MCP client library that supports the Streamable HTTP transport. A program acts as the person whose token it holds, under the same rules: it can see and change only what they could in Thortspace.

New to Thortspace? Each idea is a Thort: one short thought. Thorts sit in groups, on spheres around a centre, and pathsteps join them. An arrangement is one whole layout, private, shared with a few people, or published. Try it at thort.cloud. Accounts are free.

Getting a token

  1. Sign in at thort.cloud.
  2. On your arrangements page, open Connect an AI assistant and choose Make a connection token.
  3. Copy the token. It is shown once, and lasts 90 days.

Send it with every request as Authorization: Bearer <token>. Treat it like a password: anyone who has it can act as you. To cancel a token before it runs out, email support@thortspace.com.

A token is for your own account. A program that other people use should sign each of them in with OAuth instead.

Calling a tool

Each request is a POST of one JSON-RPC message, and the answer comes back as JSON. There is no session to open: every request stands alone, so initialize is answered but not needed.

To list the tools, with their inputs as JSON Schema:

curl https://thort.cloud/mcp \
  -H "Authorization: Bearer $THORTSPACE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

To call one:

curl https://thort.cloud/mcp \
  -H "Authorization: Bearer $THORTSPACE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call",
       "params":{"name":"create_arrangement","arguments":{"name":"Where should we go on holiday?"}}}'

The answer:

{"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"Created \"Where should we go on holiday?\" (id f75c3538-3eef-44f0-8a86-9120e2961e48). Its home group is \"Where should we go on holiday?\" (id a88fa262-cf03-429e-bf14-bceb38840348)."}],"isError":false}}

A whole example in JavaScript

Node 18 or later, with your token in THORTSPACE_TOKEN. It makes an arrangement, adds a group and three Thorts, joins two of them with a pathstep, and reads the result back.

// holiday.mjs: run with  node holiday.mjs
const server = 'https://thort.cloud/mcp';
let requestId = 0;

async function call(name, args = {}) {
  const res = await fetch(server, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + process.env.THORTSPACE_TOKEN },
    body: JSON.stringify({ jsonrpc: '2.0', id: ++requestId, method: 'tools/call', params: { name, arguments: args } }),
  });
  if (!res.ok) throw new Error(res.status + ' ' + await res.text());
  const { result, error } = await res.json();
  if (error) throw new Error(error.message);
  const text = result.content.map(c => c.text).join('\n');
  if (result.isError) throw new Error(text);
  return text;
}

const question = 'Where should we go on holiday?';
const made = await call('create_arrangement', { name: question });
const id = made.match(/\(id ([0-9a-f-]{36})\)/)[1]; // the arrangement's id comes first

await call('add_group', { arrangement_id: id, name: 'Costs' });
await call('add_thort', { arrangement_id: id, group: question, text: 'Somewhere warm in October.' });
await call('add_thort', { arrangement_id: id, group: 'Costs', text: 'Flights are cheaper midweek.' });
await call('add_thort', { arrangement_id: id, group: 'Costs', text: 'Half term doubles the price.' });
await call('link', { arrangement_id: id, from: 'Somewhere warm in October.', to: 'Half term doubles the price.', type: 'Leads to' });
console.log(await call('read_arrangement', { arrangement_id: id }));

The same in Python

Python 3, standard library only. Give your program a name in the User-Agent header: thort.cloud's network (Cloudflare) turns away requests that carry the name Python's urllib gives them.

import itertools, json, os, re, urllib.request

SERVER = "https://thort.cloud/mcp"
request_ids = itertools.count(1)

def call(tool, **args):
    body = {"jsonrpc": "2.0", "id": next(request_ids), "method": "tools/call",
            "params": {"name": tool, "arguments": args}}
    request = urllib.request.Request(SERVER, data=json.dumps(body).encode(), headers={
        "Content-Type": "application/json",
        "Authorization": "Bearer " + os.environ["THORTSPACE_TOKEN"],
        "User-Agent": "holiday-example/1.0"})  # urllib's own name is turned away
    with urllib.request.urlopen(request) as response:
        reply = json.load(response)
    if "error" in reply:
        raise RuntimeError(reply["error"]["message"])
    text = "\n".join(c["text"] for c in reply["result"]["content"])
    if reply["result"]["isError"]:
        raise RuntimeError(text)
    return text

question = "Where should we go on holiday?"
made = call("create_arrangement", name=question)
arrangement = re.search(r"\(id ([0-9a-f-]{36})\)", made).group(1)
call("add_thort", arrangement_id=arrangement, group=question, text="Somewhere warm in October.")
print(call("read_arrangement", arrangement_id=arrangement))

What to expect

Programs that act for other people (OAuth)

Sign each person in with OAuth 2.1: the authorization code flow, with PKCE (S256) and the scope thortspace. The person signs in on Thortspace's own page and allows your program. Your program never sees their password.

When tools change

Thortspace is changing quickly, and tools can be added, changed or removed with it. tools/list always gives the current set, and the list below is made from it. If your program depends on a tool, tell us at support@thortspace.com, so that we know.

The tools

64 tools. Reads changes nothing. Adds only adds. Changes can change or remove what's there.

Arrangements

list_arrangements List arrangements Reads

List the arrangements this person can see: their own, ones they contribute to, and published ones. Archived ones come last, marked: they can be read but not changed until their owner brings them back.

No inputs.

read_arrangement Read an arrangement Reads

Read an arrangement as an outline: each group with its Thorts in order, and the pathsteps between them.

create_arrangement Create an arrangement Adds

Create a new private arrangement. Its name becomes the home group.

copy_arrangement Copy an arrangement Adds

Copy an arrangement this person can see into a new private arrangement of their own (where its owner allows copying).

arrangement_settings Change an arrangement's settings Changes

Change an arrangement's settings (its owner only): its name, whether anyone may join it just by adding to it, and whether others may copy it. Give only what changes.

set_visibility Publish an arrangement, or make it private Changes

Publish an arrangement (anyone signed in can see it) or make it private.

set_surface_colours Choose an arrangement's colours Changes

Choose the colours of an arrangement's sphere surface, which make it recognisable, even from a distance: one colour ("#rrggbb", a plain sphere) or two ("#rrggbb #rrggbb", bands of the two). Empty: back to the colours it had to start with. Only its owner can.

set_atmosphere Choose an arrangement's atmosphere Changes

Choose the colour of the atmosphere round an arrangement's sphere: a glow round it, fading into the space beyond, which helps make it recognisable. One colour ("#rrggbb"), or "none" for no atmosphere. Empty: back to one from the sphere's own colours. Only its owner can.

set_sky Choose the space round an arrangement Changes

Choose the space round an arrangement, which everything in it is seen against: its colour (its ambient) and what is in it: stars, clouds (shaded by the colour, fainter as it is darker) or plain. Either or both. An empty colour: back to the dark one; an empty kind: stars on a dark colour, clouds on a light one. Only its owner can.

archive_arrangement Archive an arrangement, or bring it back Changes

Archive one of this person's arrangements (it stays readable, nobody can change it, and it no longer counts towards the free plan's 3 active arrangements), or bring an archived one back (archived false; within the plan's limit).

delete_arrangement Delete an arrangement Changes

Delete one of this person's own arrangements.

search_arrangements Search what's published Reads

Search what people have published, as the home page does; with no query, the most popular arrangements and journeys.

whats_new What's new Reads

What has happened lately: in this person's arrangements and ones they're in, and what was recently published (the home page's news).

No inputs.

undo Undo or redo Changes

Undo this person's last change in an arrangement (several made together go together), or redo what was undone.

Thorts and groups

add_thort Add a Thort Adds

Add a Thort (one short thought) to a group.

add_group Add a group Adds

Add a group (a theme) beside an existing group.

edit_thort Change a Thort's text Changes

Change the text of a Thort this person owns.

set_notes Set a Thort's notes Changes

Set a Thort's notes: a longer elaboration of it (several sentences or paragraphs) for anyone who wants more than the Thort says. The Thort stays a concise statement. Only the Thort's owner can. An empty text removes them.

set_picture Give a picture Changes

Give a Thort or group this person owns a picture from Wikimedia Commons; on a group it fills the group's background. Only public-domain or CC0 files are accepted (the server checks the licence on Commons and records the file page, licence and author). Empty file removes the picture.

set_category Give a category Changes

Give a Thort or group one of this person's categories (by name; made with this colour if new).

find_thorts Find Thorts said before Reads

Find Thorts already said, this person's own and published ones, close in meaning to some text. Each comes with its id, so that it can be used again.

thort_places Where a Thort is Reads

List the arrangements a Thort is in (those this person can see).

insert_thort Use a Thort again Adds

Put an existing Thort, by its id, into a group here: the same Thort, shared, not a copy.

move_thort Move a Thort to another group Changes

Move a Thort into another group.

reorder_thort Change a Thort's place in its group Changes

Move a Thort to another place in its group's order (the order an arrangement's outline lists).

make_group Make a Thort a group Changes

Take a Thort out of its group to become a group of its own, beside the group it came from and joined to it.

merge_group Put a group into another Changes

Put a group into another group: its Thorts and embedded arrangements move across, and the group itself becomes a Thort there.

remove_thort Remove a Thort or group Changes

Take a Thort out of an arrangement; a group goes with its Thorts. The Thorts stay their owners' (and stay in other arrangements). The home group can't be removed.

delete_unused_thorts Delete unused Thorts Changes

Delete every Thort this person owns that no remaining arrangement uses (so no one else loses one).

No inputs.

vote Vote Changes

Vote for a Thort, a pathstep or the arrangement itself (+1), or take the vote back.

Pathsteps

set_path_type Give a pathstep its kind Changes

Give the pathstep between two Thorts or groups a kind of relationship (a path type, by name; made with this colour if new). Pathsteps between groups show in their type's colour.

Arrangements inside arrangements

move_embedded_arrangement Move an embedded arrangement Changes

Move an arrangement embedded in a group into another group.

Placing

place_group Place a group by hand Changes

Place a group by hand, in a direction from level 0 (the home group unless given), as seen from where the view starts: above, below, left, right, front (towards the viewer), back, or two or three together ("above left"). The other groups at its level stay where they are. reset: back to where the layout would put it.

turn_group Turn a group Changes

Turn a group about its middle, with everything in it.

size_level Size a level's sphere Changes

Make a level's sphere bigger or smaller, around level 0 (the home group unless given): scale 1.5 is half as big again, 0.8 smaller; 0 puts it back to its automatic size.

Journeys

list_journeys List journeys Reads

List this person's journeys with their steps.

No inputs.

read_journey Read a journey Reads

Read a journey, this person's or a public one: its steps with their ids, arrangements, titles and descriptions.

create_journey Start a journey Adds

Start a new journey (a sequence of views) owned by this person.

rename_journey Rename a journey Changes

Rename one of this person's journeys.

add_journey_step Add a journey step Adds

Add a step to a journey: a view of an arrangement with a title and a description.

edit_journey_step Change a journey step Changes

Change a journey step's title or description (give only what changes).

delete_journey_step Delete a journey step Changes

Delete a step from one of this person's journeys.

order_journey Reorder a journey Changes

Put a journey's steps in a new order: all its step ids, first to last.

delete_journey Delete a journey Changes

Delete one of this person's journeys.

Categories and path types

list_categories List categories Reads

List this person's categories (kinds of thought) with their colours.

No inputs.

edit_category Change a category Changes

Change one of this person's categories: its name, or its background, text or tag colour (#rrggbb). Every Thort in it changes with it.

list_path_types List path types Reads

List this person's path types (kinds of connection) with their colours.

No inputs.

People

list_members List an arrangement's people Reads

List the people in an arrangement: its owner, contributors, and anyone asking to join.

add_member Add someone to an arrangement Adds

Add someone to one of this person's arrangements as a contributor, by the name they have in Thortspace.

admit_member Let someone in Adds

Let in someone who asked to join one of this person's arrangements.

block_member Block someone from an arrangement Changes

Block a contributor from one of this person's arrangements. What they added goes with them into a copy of their own (a fork).

join_arrangement Join an arrangement Adds

Join an arrangement to add to it: at once where joining is open, otherwise asking its owner.

leave_arrangement Leave an arrangement Changes

Leave an arrangement this person has joined.

You

my_account My account Reads

This person's name, plan, active arrangements (and the limit), and AI help used this month.

No inputs.

set_my_name Change my name Changes

Change the name people see beside this person's Thorts and arrangements.

list_notifications List notifications Reads

List this person's notifications: what others did in their arrangements, and Thorts they use that someone changed.

No inputs.

answer_notification Answer a notification Changes

Answer a notification. For a Thort someone changed: keep_original true puts a copy with the old text in its place in this person's arrangement; false takes the new text. Any other is dismissed.

Thortspace version 1

list_v1_spheres List my v1 spheres Reads

List this person's spheres in Thortspace version 1 (the apps), and which have been brought across.

import_v1_sphere Bring a v1 sphere across Adds

Bring one of this person's v1 spheres across as a private arrangement, a faithful copy (beyond the free plan's limit it arrives archived).

Help

Email support@thortspace.com. For connecting Claude, ChatGPT and other assistants, see Connect an AI assistant.