Add MCP/legacy API guide; document multiple inheritance and createPage pitfall#3
Open
ChipNowacek wants to merge 1 commit intokerim:mainfrom
Open
Conversation
…e pitfall
Three additions from live testing against a Logseq DB graph (2026-03-07):
skill/references/catalyst-query-protocol.md (new)
Complete guide for accessing Logseq from external tools. Covers:
- MCP Streamable HTTP transport (protocol 2024-11-05): POST /mcp for tool
calls, session ID in mcp-session-id response header, initialize body is
empty, tool call responses arrive as chunked SSE in the POST response body.
urllib.request blocks on resp.read() for chunked SSE — working raw-socket
Python helpers included.
- Known bug: new MCP sessions return HTTP 200 with empty body for tool calls
(graph must be open and active; reuse the session ID from the session
established when the graph first loaded).
- Legacy HTTP API at /api (port 12315): accepts
{"method": "logseq.Editor.methodName", "args": [...]} synchronously with
Bearer token auth. Right path for mutations Claude Code or other external
clients need to make (createTag, addTagExtends, addTagProperty,
addBlockTag, deletePage, etc.).
skill/references/core-apis.md (updated)
Tag Inheritance section: confirmed :logseq.property.class/extends is
cardinality-many. Calling addTagExtends(child, parentA) then
addTagExtends(child, parentB) stores two separate datoms — both parents
retained, neither overwrites. The standard or-join Datalog pattern handles
multi-parent classes without modification. getTagObjects is hierarchy-aware
and traverses extends.
skill/references/pitfalls-and-solutions.md (updated)
New Pitfall 9: createPage with tags:["ClassName"] does NOT apply the class
tag — the page receives only the default "Page" tag. Workaround: call
addBlockTag(uuid, "ClassName") explicitly after page creation.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three additions from live testing against a Logseq DB graph (2026-03-07):
skill/references/catalyst-query-protocol.md— Guide for accessing Logseq from external tools (MCP transport + legacy HTTP API), including working Python helperscore-apis.md— Confirmed:logseq.property.class/extendsis cardinality-many; documented multiple inheritance behaviorpitfalls-and-solutions.md— New pitfall:createPagewithtags:[]does not apply class tagsDetail
New: External tool access guide (
catalyst-query-protocol.md)Covers two access paths for external clients (scripts, Claude Code, etc.):
MCP Streamable HTTP (protocol version 2024-11-05)
POST /mcpfor tool calls; session ID inmcp-session-idresponse headerinitializeresponse body is intentionally empty — session ID is in the header onlyevent: message\ndata: {...})urllib.request.urlopen().read()blocks forever on chunked SSE — working raw-socket Python helpers includedLegacy HTTP API at
/api(port 12315){"method": "logseq.Editor.methodName", "args": [...]}synchronouslycreateTag,addTagExtends,addTagProperty,addBlockTag,deletePage,getTagObjects, etc.logseq.api.*namespace is not exposed — uselogseq.Editor.*Updated: Multiple inheritance (
core-apis.md)Confirmed
:logseq.property.class/extendsis cardinality-many:addTagExtends(child, parentA)thenaddTagExtends(child, parentB)stores two separate datoms — both parents retained, neither overwrites the otheror-joinDatalog pattern handles multi-parent classes without modificationgetTagObjectsis hierarchy-aware and traversesextendsUpdated:
createPageclass tag pitfall (pitfalls-and-solutions.md)createPage('Name', { tags: ['ClassName'] })does not apply the class tag — the page receives only the defaultPagetag. Workaround: calladdBlockTag(uuid, 'ClassName')explicitly after page creation.Test plan
logseq.Editor.createTagcreatePage+addBlockTagcorrectly applies class tag🤖 Generated with Claude Code