Skip to main content
Glama

@sophia-wiki/mcp

MCP server for Sophia, the wiki. It lets your AI (Claude Code, Claude Desktop, Cursor or any MCP client) read, search and write pages, comment and upload files as you, through a personal API token. It can also migrate Confluence into Sophia with the full history of every page.

It runs locally over stdio (npx -y @sophia-wiki/mcp) and calls the Sophia REST API.

1. Create a token

In Sophia, open Conectar con IA in the sidebar (/connect-ai) and create a token (shown once, sph_…). Scopes:

Scope

Allows

pages:read

spaces, tree, pages, versions, search, recent, comments, files, tickets

pages:write

create, save, move, trash, restore pages

comments:write

create, edit, delete comments

attachments:write

upload and remove files

import:write

all import_* tools; the token owner must be a global admin

A token never does more than its owner can do in Sophia, and you can revoke it at any time.

import:write tokens expire in 30 or 90 days, and a password reset of the owner revokes them. To renew, create a new one in Conectar con IA, put it in SOPHIA_TOKEN and restart the client. After many invalid tokens from one IP, Sophia answers 429 to every token request from it for a while: wait and check the token.

Related MCP server: Confluence MCP Server

2. Configure your client

Variable

Value

SOPHIA_API_URL

URL of the Sophia API, e.g. https://sophia.example.com/sophia/api (/api is added if missing)

SOPHIA_TOKEN

Your token, sph_…

SOPHIA_WEB_URL

Optional. Base of the web app for page links (default: the API URL without /api, ending in /sophia)

SOPHIA_MAX_ATTACHMENT_MB

Optional. Largest file upload_attachment / import_attachment accept (default 100)

ATLASSIAN_SITE_URL, ATLASSIAN_EMAIL, ATLASSIAN_API_TOKEN

Optional, all three or none: to download Confluence attachments by URL (read only)

Claude Code

claude mcp add sophia -e SOPHIA_API_URL=https://sophia.example.com/sophia/api -e SOPHIA_TOKEN=sph_... -- npx -y @sophia-wiki/mcp

Add -s user (before --) to have it in every project. On Windows use -- cmd /c npx -y @sophia-wiki/mcp.

Claude Desktop

Settings → Developer → Edit Config (claude_desktop_config.json):

{
  "mcpServers": {
    "sophia": {
      "command": "npx",
      "args": ["-y", "@sophia-wiki/mcp"],
      "env": {
        "SOPHIA_API_URL": "https://sophia.example.com/sophia/api",
        "SOPHIA_TOKEN": "sph_..."
      }
    }
  }
}

Restart Claude Desktop afterwards. Cursor takes the same mcpServers block in ~/.cursor/mcp.json.

Tools

Spaces are identified by key (ENG), pages by uuid.

Tool

What it does

Scope

whoami

The person the token acts as

any

list_spaces

Spaces you can see, your role, members

pages:read

get_page_tree

The page tree of a space (or a subtree)

pages:read

get_page

Markdown body, version, URL; an older version; history; long bodies in slices

pages:read

search_pages

Search titles and text

pages:read

recent_pages

Pages updated last

pages:read

create_page

New page at the root or under a parent

pages:write

update_page

New version; needs the version you read, a 409 explains how to re-read and merge

pages:write

list_comments / add_comment

Threads; comment or reply

pages:read / comments:write

list_attachments

Files of a page, with the token to show each

pages:read

upload_attachment

Local file onto a page; returns ![name](attachment:<uuid>)

attachments:write

import_ids

Deterministic Sophia ids from Confluence ids (no API call)

none

import_find_users / import_ensure_user

Find or create people (no mail, no password)

import:write

import_create_space / import_add_member

Space and members

import:write

import_page

A page with all its versions

import:write

import_page_versions

Append later versions

import:write

import_attachment

A file from a local path or a URL

import:write

import_comment

A comment with its author and dates

import:write

import_lookup

Confluence id → Sophia id

import:write

import_check_page

Referenced files that are not ready

import:write

Read tools are marked readOnlyHint; write tools destructiveHint: false. No tool deletes anything. Answers are short, one line per item, and cut at 20,000 characters (a page body is read in slices of max_chars, and the answer says when it is cut so a partial body is never saved).

Sophia Markdown

Bodies are GitHub-flavoured Markdown. Raw HTML is not rendered. The extras:

  • Files: ![name](attachment:<uuid>). Comments cannot carry files.

  • Mentions: @[Name](user:<uuid>) (Sophia user ids).

  • Panels: a blockquote whose first line is > [!INFO], > [!NOTE], > [!SUCCESS], > [!WARNING] or > [!ERROR].

  • Internal links: [Title](/sophia/spaces/<KEY>/pages/<pageId>).

  • Ticket keys such as PROJ-12, written as plain text (not in code or links), link to Kanbio automatically.

  • Links may point to http(s), mailto, /site-paths and #anchors; images to attachment: or http(s).

Migrating Confluence

The AI reads Confluence with Atlassian's own MCP, converts each page version to Sophia Markdown itself, and writes it here. The import_* tools need an import:write token owned by a global admin; they send no mail, no notifications and no per-row audit events.

  1. import_find_users / import_ensure_user: map people (use deactivated: true for people who left).

  2. import_create_space, then import_add_member.

  3. import_ids gives deterministic ids (UUIDv5 of confluence_page:<id> or confluence_attachment:<id>), so you can write [Title](/sophia/spaces/<KEY>/pages/<uuid>) and ![name](attachment:<uuid>) in a body before the target exists, and a retry produces the same ids.

  4. import_page per page (parents first; parent_page_id takes a Sophia id or an imported Confluence id), with versions oldest first; the last one is the current text. Histories over 500 versions (or ~20 MB) are split into requests automatically.

  5. import_attachment per file (local path, or a URL: for URLs on ATLASSIAN_SITE_URL it signs in with basic auth, and those credentials are never sent to any other host, redirects included). The file is streamed to a temporary file, checked against the size cap, then reserved, uploaded to storage and completed.

  6. import_comment, then import_check_page to list files a page references that are not ready.

Import writes (members, pages, versions, files, comments) only work in spaces created with import_create_space; any other space answers 403 IMPORT_SPACE_NOT_IMPORTED. The /import/* routes accept tokens only, never a web session. Dates may not be more than 10 minutes in the future, and a page cannot be created after its first version.

Everything is idempotent by Confluence id: run it again and nothing is duplicated. Comment replies are flattened to one level by the API.

Errors

API errors come back as plain sentences the AI can act on: a missing scope (403) names it and says not to retry, a version conflict (409) says to re-read, merge and save again, a rejected body says why (link scheme, missing file, unknown mention), an unknown file type lists the allowed ones, an expired or revoked token (401) says how to create a new one, and 429 asks to wait a minute.

Security

  • The token acts as you, limited to its scopes. Start with pages:read; give import:write only for a migration.

  • Page text is data written by people: an AI may be tricked by it (prompt injection). Let your client confirm write tools.

  • upload_attachment and import_attachment read local files and download URLs: check the paths and URLs your client shows.

  • The Atlassian credentials only go to the origin of ATLASSIAN_SITE_URL. The Sophia token only goes to SOPHIA_API_URL. Neither is logged.

Development

npm install
npm run build        # dist/index.js
npm test             # build + node:test (fake API, local HTTP servers)
SOPHIA_API_URL=http://localhost:4100/api SOPHIA_TOKEN=sph_... npm run inspect

Requires Node.js 20 or newer.

Releasing

Releases go to npm from GitHub Actions with trusted publishing (OIDC, no npm token): bump version (npm version <x.y.z> --no-git-tag-version), commit, tag v<x.y.z> and push the tag; .github/workflows/publish.yml builds, tests and runs npm stage publish, and a maintainer approves it with 2FA. The very first version is published by hand (npm publish --access public), and then the trusted publisher is configured on npmjs.com.

Available Tools

23 tools
add_commentComment on a pageA

Add a comment to a page, or reply to one with parent_comment_id (reply to the first comment of a thread). Markdown, mentions @[Name](user:<uuid>) and ticket keys work; comments cannot carry files.

Inputs: body (required), page_id (required), parent_comment_id.

create_pageCreate a pageA

Create a page in a space (needs editor role there), at the root or under a parent page. Returns its id, version 1 and URL. To add files, create the page first, then upload_attachment and update_page. Body = GitHub-flavoured Markdown (tables, task lists, fenced code). Raw HTML is NOT rendered (shown as text), so convert it. Sophia syntax: files ![name](attachment:<uuid>); mentions @[Name](user:<uuid>); panels = blockquote whose first line is > [!INFO], > [!NOTE], > [!SUCCESS], > [!WARNING] or > [!ERROR]; internal links [Title](/sophia/spaces/<KEY>/pages/<pageId>); Kanbio ticket keys written as plain text (e.g. PROJ-12; not inside code or links) link automatically. Links may only point to http(s), mailto, /site-paths or #anchors; images only to attachment: or http(s).

Inputs: title (required), space_key (required), body, parent_page_id.

get_pageGet a pageA
Read-only

Read a page: title, version, URL, breadcrumbs and the body as Sophia Markdown (exact text, to edit and send back with update_page). Long bodies are cut at max_chars: continue with offset, and never save a cut body. With version, reads that older version; with history, lists all versions. Body = GitHub-flavoured Markdown (tables, task lists, fenced code). Raw HTML is NOT rendered (shown as text), so convert it. Sophia syntax: files ![name](attachment:<uuid>); mentions @[Name](user:<uuid>); panels = blockquote whose first line is > [!INFO], > [!NOTE], > [!SUCCESS], > [!WARNING] or > [!ERROR]; internal links [Title](/sophia/spaces/<KEY>/pages/<pageId>); Kanbio ticket keys written as plain text (e.g. PROJ-12; not inside code or links) link automatically. Links may only point to http(s), mailto, /site-paths or #anchors; images only to attachment: or http(s).

Inputs: page_id (required), offset, history, version, +1 more.

get_page_treeGet the page tree of a spaceA
Read-only

The live page tree of a space as an indented list of "title (page id)", in sidebar order. Pass root_page_id to see only one subtree. Use the ids with get_page.

Inputs: space_key (required), root_page_id.

import_add_memberAdd a space member (import)A
Idempotent

Needs a token with the import:write scope whose owner is a global admin. Nothing is emailed or notified, and no per-row audit events are written. Only works in a space created with import_create_space (otherwise 403 IMPORT_SPACE_NOT_IMPORTED). Add a person to a space with a role (viewer < editor < admin). If they are already a member their role is NOT changed (created=false).

Inputs: role (required), user_id (required), space_key (required).

import_attachmentImport a file onto a page (import)A
Idempotent

Needs a token with the import:write scope whose owner is a global admin. Nothing is emailed or notified, and no per-row audit events are written. Only works in a space created with import_create_space (otherwise 403 IMPORT_SPACE_NOT_IMPORTED). Upload a file to an imported page under the uuid you chose (the one written in the body as ![name](attachment:<uuid>); by default derived from source_id, see import_ids). Give exactly one source: path (a local file) or url (downloaded to a temporary file with a size cap; for URLs on ATLASSIAN_SITE_URL it signs in with ATLASSIAN_EMAIL + ATLASSIAN_API_TOKEN, and those credentials are never sent to any other host, redirects included). Idempotent by source_id. Run import_check_page afterwards to find files that are still missing. The server decides the accepted types and says so when it refuses one.

Inputs: page_id (required), source_id (required), created_at (required), uploaded_by_user_id (required), +5 more.

import_check_pageCheck the files of an imported page (import)A
Read-only

Needs a token with the import:write scope whose owner is a global admin. Nothing is emailed or notified, and no per-row audit events are written. Lists the files a page body references that are not ready (never uploaded, or still pending). Run it after importing the attachments of a page: an empty list means every ![](attachment:<uuid>) has its file.

Inputs: page_id (required).

import_commentImport a comment (import)A
Idempotent

Needs a token with the import:write scope whose owner is a global admin. Nothing is emailed or notified, and no per-row audit events are written. Only works in a space created with import_create_space (otherwise 403 IMPORT_SPACE_NOT_IMPORTED). Create a comment on an imported page with its original author and dates. Idempotent by source_id. Replies use parent_comment_id = the Sophia id, or the Confluence id, of a comment you imported before; the API flattens threads to ONE level: a reply to a reply attaches to the first comment of the thread. Comments cannot carry files. Markdown rules are the same as pages (mentions, ticket keys, links); raw HTML is not rendered.

Inputs: body (required), page_id (required), source_id (required), created_at (required), +3 more.

import_create_spaceCreate a space (import)A
Idempotent

Needs a token with the import:write scope whose owner is a global admin. Nothing is emailed or notified, and no per-row audit events are written. Create a space from a Confluence space. Idempotent by source_id: if it was imported before it returns that space (created=false) and changes nothing. The key must be 2–50 characters, uppercase letter first, then uppercase letters or digits (Confluence keys may need adjusting). Add its people afterwards with import_add_member.

Inputs: key (required), name (required), source_id (required), created_by_user_id (required), +2 more.

import_ensure_userCreate or get a Sophia user (import)A
Idempotent

Needs a token with the import:write scope whose owner is a global admin. Nothing is emailed or notified, and no per-row audit events are written. Make sure a person exists, by email. No password and no mail is created: an imported person later signs in with SSO (linked by verified email) or, in local mode, with "forgot password". If the email already exists it returns that person WITHOUT changing them. Use deactivated=true for people who left the company but authored content.

Inputs: email (required), last_name (required), first_name (required), deactivated, +1 more.

import_find_usersFind Sophia users (import)A
Read-only

Needs a token with the import:write scope whose owner is a global admin. Nothing is emailed or notified, and no per-row audit events are written. Search people by name or email, including deactivated ones. Returns "Sophia user id · name · email". Sophia user ids are what the other import tools take as authors and what mentions use: @[Name](user:<uuid>). If nobody matches, create the person with import_ensure_user.

Inputs: limit, search.

import_idsCompute deterministic import idsA
Read-only

Pure computation, no API call. Derives the Sophia ids an import will use (UUIDv5 of "confluence_page:" etc. in a fixed namespace), so you can write internal links [Title](/sophia/spaces/<KEY>/pages/<uuid>) and file tokens ![name](attachment:<uuid>) in a body BEFORE the page or file is imported, and retries get the same ids. import_page and import_attachment use these ids by default. Spaces keep their own key; ids for confluence_space/confluence_comment are given too.

Inputs: source_ids (required), type, file_name, space_key.

import_lookupLook up imported objects (import)A
Read-only

Needs a token with the import:write scope whose owner is a global admin. Nothing is emailed or notified, and no per-row audit events are written. Map Confluence ids to Sophia ids (up to 200 per call). For pages it gives the Sophia page id to build internal links: [Title](/sophia/spaces/<KEY>/pages/<pageId>) (KEY = the key of the space where that page was imported). Source ids that were not imported are listed apart. Also tells whether something was already imported, to resume an interrupted migration.

Inputs: source_ids (required), type.

import_pageImport a page with its history (import)A
Idempotent

Needs a token with the import:write scope whose owner is a global admin. Nothing is emailed or notified, and no per-row audit events are written. Only works in a space created with import_create_space (otherwise 403 IMPORT_SPACE_NOT_IMPORTED). Create a page with its WHOLE history. versions go in chronological order (oldest first): the last one is the current text, the earlier ones become history. Idempotent by source_id (created=false, nothing changes). The page id is deterministic (see import_ids), so you can write internal links to ANY page, imported or not, in one pass: /sophia/spaces/<KEY>/pages/<id from import_ids>. Same for files: write ![name](attachment:<id from import_ids>) and upload later with import_attachment. A 409 IMPORT_ID_TAKEN means the id belongs to something not imported from this source. Parents must exist first (import parents before children). position orders siblings. More than 500 versions (or over ~20 MB of text) are split automatically: the first request creates the page and the rest are appended in order. If a later request fails, the error says how many versions got in: continue with import_page_versions. parent_page_id takes a Sophia id or an already imported Confluence id. Body = GitHub-flavoured Markdown (tables, task lists, fenced code). Raw HTML is NOT rendered (shown as text), so convert it. Sophia syntax: files ![name](attachment:<uuid>); mentions @[Name](user:<uuid>); panels = blockquote whose first line is > [!INFO], > [!NOTE], > [!SUCCESS], > [!WARNING] or > [!ERROR]; internal links [Title](/sophia/spaces/<KEY>/pages/<pageId>); Kanbio ticket keys written as plain text (e.g. PROJ-12; not inside code or links) link automatically. Links may only point to http(s), mailto, /site-paths or #anchors; images only to attachment: or http(s).

Inputs: versions (required), source_id (required), space_key (required), created_at (required), +5 more.

import_page_versionsAdd later versions to an imported page (import)A

Needs a token with the import:write scope whose owner is a global admin. Nothing is emailed or notified, and no per-row audit events are written. Only works in a space created with import_create_space (otherwise 403 IMPORT_SPACE_NOT_IMPORTED). Append versions (oldest first) after the page's current one, for a second pass, a long history sent in batches, or a final version with corrected links. They must be newer than what the page already has. The last one becomes the current text. Batches above 500 versions or ~20 MB are split automatically. Not idempotent: do not resend a batch that succeeded. Body = GitHub-flavoured Markdown (tables, task lists, fenced code). Raw HTML is NOT rendered (shown as text), so convert it. Sophia syntax: files ![name](attachment:<uuid>); mentions @[Name](user:<uuid>); panels = blockquote whose first line is > [!INFO], > [!NOTE], > [!SUCCESS], > [!WARNING] or > [!ERROR]; internal links [Title](/sophia/spaces/<KEY>/pages/<pageId>); Kanbio ticket keys written as plain text (e.g. PROJ-12; not inside code or links) link automatically. Links may only point to http(s), mailto, /site-paths or #anchors; images only to attachment: or http(s).

Inputs: page_id (required), versions (required).

list_attachmentsList files of a pageB
Read-only

The ready files of a page: name · type · size · the token ![name](attachment:<uuid>) that shows the file in a body.

Inputs: page_id (required).

list_commentsList comments of a pageA
Read-only

The comments of a page as threads (oldest first, replies indented). Each line: date, comment id, author and text; deleted ones that still hold replies show as "(deleted comment)".

Inputs: page_id (required).

list_spacesList spacesA
Read-only

List the spaces you can see, with their key (used by the other tools), your role in each (viewer < editor < admin) and member count. Archived spaces are read-only and only listed when asked.

Inputs: search, archived.

recent_pagesRecently updated pagesB
Read-only

The pages updated last, across the spaces you can see: title · space · page id · updated.

Inputs: limit.

search_pagesSearch pagesA
Read-only

Search page titles and text (prefix match) in the spaces you can see, newest first. One line per hit: title · space · page id · updated · plain-text snippet. Use get_page for the whole page.

Inputs: query (required), limit, space_key.

update_pageUpdate a pageA

Save a new version of a page (needs editor role). Always read the page first (get_page) and send the version you read: if someone saved in between, Sophia answers 409 and you must re-read, merge their changes with yours and save again with the new version. Send the COMPLETE new body (it replaces the old one); title and body are each optional, the one you omit stays as it is. Body = GitHub-flavoured Markdown (tables, task lists, fenced code). Raw HTML is NOT rendered (shown as text), so convert it. Sophia syntax: files ![name](attachment:<uuid>); mentions @[Name](user:<uuid>); panels = blockquote whose first line is > [!INFO], > [!NOTE], > [!SUCCESS], > [!WARNING] or > [!ERROR]; internal links [Title](/sophia/spaces/<KEY>/pages/<pageId>); Kanbio ticket keys written as plain text (e.g. PROJ-12; not inside code or links) link automatically. Links may only point to http(s), mailto, /site-paths or #anchors; images only to attachment: or http(s).

Inputs: page_id (required), version (required), body, title.

upload_attachmentUpload a file to a pageA

Upload a local file (absolute path on the machine running this server) to a page you can edit. Returns the token ![name](attachment:<uuid>): paste it where the file should show in the body, then save with update_page. The server decides which file types and sizes it takes and says so when it refuses one.

Inputs: path (required), page_id (required).

whoamiWho am IA
Read-only

Show the person this token acts as (name, email, global role). Use it to check the connection; every write is made as this person and limited by their role.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 23 tools

    Disambiguation4/5

    The surface splits into two clearly labeled clusters: core wiki tools and import_-prefixed Confluence migration tools. Within each cluster tools target distinct resources (pages, comments, attachments, spaces, users), though a few pairs (create_page vs import_page, list_attachments vs import_check_page, import_ids vs import_lookup) require reading the long descriptions to see the boundary.

    Naming Consistency4/5

    Core tools are mostly verb_noun (list_spaces, create_page, update_page, add_comment, upload_attachment), and the import suite is uniformly import_<action>. Minor deviations exist (recent_pages is adjective-first, whoami is verb-only, get_page_tree uses a compound noun), but the pattern remains readable.

    Tool Count3/5

    23 tools is on the heavy side for a wiki server, and the set is effectively two suites glued together. Each cluster (12 core + 11 import) is individually well-scoped, but the combined surface sits at the borderline where an agent must scan a lot of tools.

    Completeness3/5

    Page read/create/update, comments, attachments and search are covered, and the import lifecycle is thorough. However, no delete operations exist anywhere (page, comment, attachment), comments cannot be edited or resolved, and there is no ordinary space-creation path outside the import flow—notable gaps for a wiki surface.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers