Skip to content

Blucknote/anytype-api

Repository files navigation

Anytype team finnaly launched their own MCP server

https://github.com/anyproto/anytype-mcp

So this repo does not have any sense now and will be set to public archieve soon


Anytype FastAPI Backend

A FastAPI-based backend service for interacting with Anytype. This is a Python port of the Raycast Anytype Extension, providing RESTful API access to Anytype functionality.

Prerequisites

  • Python 3.8+
  • Anytype installed and running locally

Installation

  1. Clone the repository:
git clone <repository-url>
cd anytype-api
  1. Create a virtual environment and install dependencies:
uv venv  # Creates a virtual environment in .venv directory
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv pip install -e .

Running the Application

Development mode:

uvicorn app.main:app --reload

Production mode:

uvicorn app.main:app --host 0.0.0.0 --port 8000

API Documentation

Once the application is running, you can access the interactive API documentation at:

MCP Server

This project includes an MCP (Model Context Protocol) server implementation that exposes Anytype API operations as MCP tools, enabling integration with MCP-compatible clients.

Configuration

The MCP server uses the following environment variables (should be set in .env file):

  • ANYTYPE_API_URL — Base URL of the Anytype API (e.g., http://localhost:31009)
  • ANYTYPE_API_KEY — API key for authentication

Obtaining API Key

You can obtain an API key using either of these methods:

Method 1: Using the Utility Script (Recommended)

Run the included utility script:

uv run get_api_key.py

This interactive script will guide you through the process of obtaining your API key.

Method 2: Manual Process

  • Open Anytype it should be running in whole process and also should be launched whenever requests is expected
  • run uv run uvicorn app.main:app --port 8081 (or other port)
  • open http://localhost:8081/docs
  • image
  • /auth/challenge will show display code and return challenge_id
  • both of that goes to /auth/api_key which will return api_key
  • image
  • paste "API Key" to .env file

Running the MCP Server

You can run the MCP server directly:

uv run app/anytype_mcp_server.py

or inside Docker (see below).

Docker

You can build and run the application using Docker:

Build the Docker image

docker build -t anytype-api .

Run the Docker container

docker run --rm --env-file .env --network host anytype-api

This will start the API server with environment variables loaded from .env and network mode set to host.

In target MCP client choose SSE type and http://localhost:8000/sse for endpoint

License

MIT License

Credits

Based on the Raycast Anytype Extension.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •