Following up on
Community contributions: HTTP transport, Auto-Launch, and AI-assisted space discovery for the MCP server
The previous post introduced three contributions to the MCP server — HTTP transport, auto-launch, and the discover-spaces tool — all aimed at making the server more capable and self-sufficient. This one adds a smaller but practically useful feature: loading MCP instructions directly from an Anytype page.
The problem with static instructions
The MCP server broadcasts a system prompt to the AI client on every connection, via the instructions field in the initialize response. By default this is the bundled instructions.md — a carefully written document that tells the AI how to use the server correctly: ID resolution rules, mutation tagging, error handling, and so on.
The problem is that instructions.md is a static file in the source tree. Customising it means editing source, rebuilding, and redeploying. For power users who have developed their own workspace conventions — space routing rules, per-space object schemas, naming conventions — there was no good place to put this knowledge where the AI could pick it up automatically. It either lived in the bundled file (requiring source edits) or had to be pasted into every chat session manually.
This creates an awkward split: your workspace knowledge lives in Anytype, but your MCP instructions live outside it.
The solution: anytype:// deep links in MCP_INSTRUCTIONS
MCP_INSTRUCTIONS now accepts an Anytype object deep link:
MCP_INSTRUCTIONS=anytype://object?objectId=<id>&spaceId=<id>
On startup, the server fetches the linked page via the Anytype API, extracts its markdown content, and uses that as the instructions string. The AI client receives it at session start, before any tool call is made.
This means you can maintain your MCP instructions as an ordinary Anytype page — edit it in the app, add internal links to per-space rule pages, use headings and tables. On the next server restart, the updated instructions are live. No source changes, no rebuild.
To get a page’s deep link: open the page → three-dot menu → Advanced → Copy Deeplink.
Claude or OpenCode config example
The following snippet can be used to configure a MCP client, such as Claude desktop application, Cursor, or OpenCode:
{
"mcpServers": {
"anytype-stdio": {
"command": "npx",
"args": ["-y", "@anyproto/anytype-mcp"],
"env": {
"OPENAPI_MCP_HEADERS": "{file:~/.config/anytype/openapi-headers.json}",
"DISCOVERY_TOOL_CONFIG": "{file:~/.config/anytype/discovery.json}",
"MCP_INSTRUCTIONS": "anytype://object?objectId=bafyreibaml32crstcptvhymnfdem4lejlge3hqe7r75b4le2wd532hvlae&spaceId=bafyreihm362wmhfanonpiahgxya32r4o4ddkib3fljjw453czkcy2qzmve.31e0h928360j5"
}
}
},
Key Highlightss:
OPENAPI_MCP_HEADERSreferences an external JSON file with the OpenAPI headers, including auth.DISCOVERY_TOOL_CONFIGreferences a configuration file for the Space Discovery tool.MCP_INSTRUCTIONSreferences the Anytype page with the root MCP instructions, which are broadcasted to each connecting client and seed the LLM context.
How it fits with discover-spaces
The two features are complementary. The instructions page sets the behavioural rules for the session. The discovery map provides the workspace snapshot — IDs, types, tags — needed to act on those rules. Together they give the AI client everything it needs from the first two interactions of a session.
A practical pattern and workflow
- The instructions page contains general rules and links to per-space detail pages.
- The AI reads the root instructions on connect, calls
discover-spacesto orient itself. - The fetched page contains links to other pages with per-space rules.
- The AI determines which specific link to fetch next depending on the space to work in.
Outcome:
- Context stays lean; nothing irrelevant is loaded upfront.
- The user can create any structure of rules in multiple pages, which cover all practical cases.
Fallback behaviour
If the page cannot be fetched — Anytype not running at startup, invalid link, network error — the server falls back to the bundled instructions.md and prepends a visible warning block. The AI client sees the warning immediately and can surface it to the user, rather than silently operating on stale or missing instructions.
Status
PR open as draft in the fork repository until the previous PR is merged. Still, you can clone it and try out today. Happy to answer questions or take feedback here.