Skip to main content
Glama

Anytype MCP Server

License: MIT Node.js Version TypeScript Vite pnpm

A comprehensive Model Context Protocol (MCP) server for seamless integration with the Anytype knowledge management platform. This server provides a complete set of tools for managing spaces, objects, properties, types, tags, and templates through the Anytype API.

šŸš€ Features

  • Complete API Coverage: Full support for all Anytype API endpoints

  • Space Management: Create, update, and manage Anytype spaces

  • Object Operations: CRUD operations for objects with advanced search capabilities

  • Property Management: Dynamic property creation and management

  • Type System: Custom object types with full lifecycle management

  • Tag Management: Organize content with tags and multi-select properties

  • Template Support: Access and utilize Anytype templates

  • Collection & List Operations: Manage collections and lists with proper view handling

  • Modern Development: Built with Vite for fast development and optimized builds

  • Package Management: Uses pnpm for efficient dependency management

  • TypeScript Support: Fully typed for enhanced developer experience

  • Modular Architecture: Clean, maintainable code structure

Related MCP server: Anytype MCP Server

šŸ“‹ Prerequisites

  • Node.js 18.0.0 or higher

  • pnpm 8.0.0 or higher (recommended) or npm

  • Anytype application running locally

  • Valid Anytype API key

šŸ› ļø Installation

  1. Install pnpm globally (if not already installed)

    npm install -g pnpm
  2. Clone the repository

    git clone <repository-url>
    cd my-mcp-anytype
  3. Install dependencies

    pnpm install
  4. Configure environment variables

    # Copy the example file
    cp .env.example .env
    
    # Edit .env with your actual values
    # ANYTYPE_API_KEY=your-actual-api-key
    # ANYTYPE_BASE_URL=http://localhost:31009
  5. Build the project

    pnpm build
  6. Start the server

    pnpm start

Option 2: Local Installation (npm)

  1. Clone the repository

    git clone <repository-url>
    cd my-mcp-anytype
  2. Install dependencies

    npm install
  3. Configure environment variables

    # Copy the example file
    cp .env.example .env
    
    # Edit .env with your actual values
    # ANYTYPE_API_KEY=your-actual-api-key
    # ANYTYPE_BASE_URL=http://localhost:31009
  4. Build the project

    npm run build
  5. Start the server

    npm start

Option 3: Docker Installation

  1. Clone the repository

    git clone <repository-url>
    cd my-mcp-anytype
  2. Configure environment variables

    # Copy and edit the environment file
    cp .env.example .env
    # Edit .env with your actual Anytype API key
  3. Run with Docker Compose

    # Build and start the container
    docker-compose up -d
    
    # View logs
    docker-compose logs -f
    
    # Stop the container
    docker-compose down
  4. Or run with Docker directly

    # Build the image
    docker build -t anytype-mcp .
    
    # Run the container
    docker run -d \
      --name anytype-mcp-server \
      --network host \
      --env-file .env \
      anytype-mcp

āš™ļø Configuration

Environment Variables

Variable

Description

Default

Required

ANYTYPE_API_KEY

Your Anytype API key

-

āœ…

ANYTYPE_BASE_URL

Anytype API base URL

http://localhost:31009

āŒ

MCP_PORT

Port for MCP server

3000

āŒ

LOG_LEVEL

Logging level

info

āŒ

REQUEST_TIMEOUT

API request timeout (ms)

30000

āŒ

Getting Your API Key

  1. Open Anytype application

  2. Navigate to Settings → Developer

  3. Generate or copy your API key

  4. Add it to your .env file

šŸ”§ Vite & Modern Development Tools

This project uses modern development tools for optimal developer experience:

Vite Benefits

  • ⚔ Lightning Fast: Instant server start and HMR

  • šŸ“¦ Optimized Builds: Efficient bundling with Rollup

  • šŸ”§ Zero Config: Works out of the box with sensible defaults

  • šŸŽÆ TypeScript Native: First-class TypeScript support

Available Scripts

# Development
pnpm dev          # Start development server with hot reload
pnpm build        # Build for production using Vite
pnpm preview      # Preview production build locally
pnpm start        # Start the built MCP server

# Utilities
pnpm clean        # Clean build artifacts
pnpm type-check   # Run TypeScript type checking
pnpm prepare      # Pre-publish preparation

# Docker
docker-compose up --build  # Build and run with Docker

pnpm Advantages

  • šŸ’¾ Disk Efficient: Saves up to 50% disk space

  • ⚔ Faster Installs: Up to 2x faster than npm

  • šŸ”’ Strict: Better dependency resolution

  • 🌐 Monorepo Ready: Built-in workspace support

šŸ·ļø Tags Management

Enhanced Tag Support

The MCP now includes enhanced tag management with automatic validation and processing:

  • āœ… Automatic Tag Validation: Tags are validated when creating/updating objects

  • āœ… Improved Error Handling: Clear error messages for invalid tag assignments

  • āœ… Better Documentation: Comprehensive examples and usage patterns

  • āœ… Consistent API: Standardized property_id usage across all tag operations

Quick Tag Workflow

  1. Create tags for a multi_select property:

    anytype_create_tag --space_id="space123" --name="Urgent" --color="red" --property_id="prop456"
  2. Create object with tags:

    anytype_create_object \
      --space_id="space123" \
      --name="My Task" \
      --properties='[{"key":"labels","multi_select":["tag_id_1","tag_id_2"]}]'
  3. Update object with new tags:

    anytype_update_object \
      --space_id="space123" \
      --object_id="obj789" \
      --properties='[{"key":"status","select":"completed_tag_id"}]'

For complete tag usage examples, see TAGS_USAGE.md.

šŸ”„ Special Object Update Method

Important: Object Recreation Pattern

Due to Anytype API behavior, updating object content requires a special approach:

The Challenge

When updating objects in Anytype, simply patching properties may not reflect changes immediately in the UI due to caching and synchronization mechanisms.

The Solution: Recreation Pattern

// Instead of simple update:
// PATCH /v1/spaces/{spaceId}/objects/{objectId}

// Use this pattern:
1. Get current object data
2. Delete the existing object
3. Create new object with updated content
4. Return new object ID

Implementation Example

async function updateObjectContent(spaceId: string, objectId: string, updates: any) {
  // 1. Get current object
  const currentObject = await getObject(spaceId, objectId);
  
  // 2. Merge updates with current data
  const updatedData = {
    ...currentObject,
    ...updates,
    // Preserve important metadata
    type: currentObject.type,
    createdDate: currentObject.createdDate
  };
  
  // 3. Delete current object
  await deleteObject(spaceId, objectId);
  
  // 4. Create new object with updated content
  const newObject = await createObject(spaceId, updatedData);
  
  return newObject;
}

When to Use This Pattern

  • āœ… Content Updates: When changing object text, descriptions, or main content

  • āœ… Property Changes: When modifying custom properties

  • āœ… Type Changes: When changing object type

  • āŒ Simple Metadata: For basic metadata updates, regular PATCH may suffice

Important Considerations

  • ID Changes: The object will get a new ID after recreation

  • References: Update any references to the old object ID

  • Permissions: Ensure proper permissions for delete/create operations

  • Backup: Consider backing up important objects before updates

Space Management

Tool

Description

anytype_list_spaces

List all available spaces

anytype_get_space

Get specific space details

anytype_create_space

Create a new space

anytype_update_space

Update existing space

anytype_list_members

List space members

anytype_get_member

Get specific member details

Object Operations

Tool

Description

anytype_search_objects

Search objects with advanced filters

anytype_list_objects

List objects in a space

anytype_get_object

Get specific object details

anytype_create_object

Create new object

anytype_update_object

Update existing object

anytype_delete_object

Delete (archive) object

Property Management

Tool

Description

anytype_list_properties

List all properties in a space

anytype_get_property

Get specific property details

anytype_create_property

Create new property

anytype_update_property

Update existing property

anytype_delete_property

Delete property

Type Management

Tool

Description

anytype_list_types

List all object types

anytype_get_type

Get specific type details

anytype_create_type

Create new object type

anytype_update_type

Update existing type

anytype_delete_type

Delete object type

Tag Management

Tool

Description

anytype_list_tags

List tags for a property

anytype_get_tag

Get specific tag details

anytype_create_tag

Create new tag

anytype_update_tag

Update existing tag

anytype_delete_tag

Delete tag

Template Operations

Tool

Description

anytype_list_templates

List templates for a type

anytype_get_template

Get specific template details

Collection & List Operations

Tool

Description

anytype_add_to_collection

Add object to collection

anytype_remove_from_collection

Remove object from collection

anytype_get_list_views

Get available views for a list

anytype_get_list_objects

Get objects from a list view

šŸ—ļø Project Structure

src/
ā”œā”€ā”€ index.ts                 # Main server entry point
ā”œā”€ā”€ startup-info.ts          # Server startup information
ā”œā”€ā”€ utils.ts                 # Utility functions and API helpers
ā”œā”€ā”€ handlers/                # Request handlers
│   ā”œā”€ā”€ spaces.ts           # Space and member operations
│   ā”œā”€ā”€ objects.ts          # Object CRUD operations
│   ā”œā”€ā”€ properties.ts       # Property management
│   └── types-tags.ts       # Types, tags, and templates
└── tools/                   # MCP tool definitions
    ā”œā”€ā”€ spaces.ts           # Space tool schemas
    ā”œā”€ā”€ objects.ts          # Object tool schemas
    ā”œā”€ā”€ properties.ts       # Property tool schemas
    ā”œā”€ā”€ types.ts            # Type tool schemas
    ā”œā”€ā”€ tags.ts             # Tag tool schemas
    ā”œā”€ā”€ templates.ts        # Template tool schemas
    ā”œā”€ā”€ lists.ts            # List tool schemas
    └── schemas.ts          # Common schemas

šŸ”Œ API Endpoints

This MCP server interfaces with the following Anytype API endpoints:

Spaces

  • GET /v1/spaces - List spaces

  • GET /v1/spaces/{id} - Get space

  • POST /v1/spaces - Create space

  • PATCH /v1/spaces/{id} - Update space

  • GET /v1/spaces/{id}/members - List members

Objects

  • POST /v1/search - Global search

  • POST /v1/spaces/{id}/search - Space search

  • GET /v1/spaces/{id}/objects - List objects

  • GET /v1/spaces/{id}/objects/{objectId} - Get object

  • POST /v1/spaces/{id}/objects - Create object

  • PATCH /v1/spaces/{id}/objects/{objectId} - Update object

  • DELETE /v1/spaces/{id}/objects/{objectId} - Delete object

Properties

  • GET /v1/spaces/{id}/properties - List properties

  • POST /v1/spaces/{id}/properties - Create property

  • PATCH /v1/spaces/{id}/properties/{propertyId} - Update property

  • DELETE /v1/spaces/{id}/properties/{propertyId} - Delete property

Types

  • GET /v1/spaces/{id}/types - List types

  • POST /v1/spaces/{id}/types - Create type

  • PATCH /v1/spaces/{id}/types/{typeId} - Update type

  • DELETE /v1/spaces/{id}/types/{typeId} - Delete type

Templates

  • GET /v1/spaces/{id}/types/{typeId}/templates - List templates

  • GET /v1/spaces/{id}/types/{typeId}/templates/{templateId} - Get template

🐳 Docker Support

Why Docker?

  • Consistent Environment: Ensures the same runtime across different systems

  • Easy Deployment: Simple containerized deployment

  • Isolation: Runs in an isolated environment

  • Scalability: Easy to scale and manage

Docker Configuration

The project includes:

  • Dockerfile: Multi-stage build with security best practices

  • docker-compose.yml: Complete orchestration setup

  • .dockerignore: Optimized build context

  • Health checks and resource limits

Network Considerations

Host Network Mode (Recommended):

network_mode: host

This allows the container to access Anytype running on the host machine.

Bridge Network Mode (Alternative): If Anytype is also containerized, use a custom network:

networks:
  - anytype-network

Environment Variables in Docker

The container uses the same environment variables as the local installation:

  • ANYTYPE_API_KEY: Your API key

  • ANYTYPE_BASE_URL: Defaults to http://host.docker.internal:31009 in Docker

šŸš€ Development

Available Scripts

npm run build    # Compile TypeScript to JavaScript
npm start        # Start the MCP server
npm run dev      # Development mode with tsx
npm run prepare  # Pre-publish build step

Docker Development

# Development with Docker
docker-compose -f docker-compose.yml up --build

# View logs in real-time
docker-compose logs -f anytype-mcp

# Execute commands in container
docker-compose exec anytype-mcp sh

Adding New Features

  1. Define tool schema in the appropriate tools/*.ts file

  2. Implement handler in the corresponding handlers/*.ts file

  3. Register tool in src/index.ts

  4. Update documentation as needed

Code Style

  • TypeScript with strict type checking

  • Modular architecture with separation of concerns

  • Consistent error handling with MCP error types

  • Comprehensive input validation

šŸ¤ Contributing

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

šŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

šŸ†˜ Support

If you encounter any issues or have questions:

  1. Check the Issues page for existing solutions

  2. Create a new issue with detailed information

  3. Include your environment details and error messages

šŸ™ Acknowledgments

  • Anytype for the amazing knowledge management platform

  • Model Context Protocol for the integration framework

  • The open-source community for continuous inspiration


Made with ā¤ļø for the Anytype community

Available Tools

33 tools
anytype_add_to_collectionC

Adds an object to a collection

Inputs: space_id (required), collection_id (required), object_id (required).

anytype_create_objectC

Crea un nuevo objeto en un espacio

Inputs: space_id (required), name (required), type_key, body, +4 more.

anytype_create_propertyC

Crea una nueva propiedad

Inputs: space_id (required), name (required), type (required), key, +4 more.

anytype_create_spaceC

Crea un nuevo espacio

Inputs: name (required), description, icon.

anytype_create_tagC

Creates a new tag

Inputs: space_id (required), name (required), property_id (required), color.

anytype_create_typeC

Crea un nuevo tipo de objeto

Inputs: space_id (required), name (required), key, plural_name, +4 more.

anytype_delete_objectC

Elimina (archiva) un objeto

Inputs: space_id (required), object_id (required).

anytype_delete_propertyC

Elimina una propiedad

Inputs: space_id (required), property_id (required).

anytype_delete_tagC

Deletes a tag

Inputs: space_id (required), tag_id (required).

anytype_delete_typeC

Elimina un tipo de objeto

Inputs: space_id (required), type_id (required).

anytype_get_list_objectsC

Obtiene objetos de una lista usando una vista especĆ­fica

Inputs: space_id (required), list_id (required), view_id (required), limit, +1 more.

anytype_get_list_viewsB

Obtiene las vistas disponibles para una lista

Inputs: space_id (required), list_id (required).

anytype_get_memberC

Obtiene un miembro especĆ­fico

Inputs: space_id (required), member_id (required).

anytype_get_objectC

Obtiene un objeto especĆ­fico por su ID

Inputs: space_id (required), object_id (required).

anytype_get_propertyC

Obtiene una propiedad especĆ­fica

Inputs: space_id (required), property_id (required).

anytype_get_spaceB

Obtiene un espacio especĆ­fico por su ID

Inputs: space_id (required).

anytype_get_tagC

Gets a specific tag

Inputs: space_id (required), tag_id (required).

anytype_get_templateC

Gets a specific template

Inputs: space_id (required), type_id (required), template_id (required).

anytype_get_typeC

Obtiene un tipo especĆ­fico

Inputs: space_id (required), type_id (required).

anytype_list_membersC

Lista todos los miembros de un espacio

Inputs: space_id (required), limit, offset.

anytype_list_objectsC

Lista objetos en un espacio especĆ­fico

Inputs: space_id (required), limit, offset.

anytype_list_propertiesC

Lista todas las propiedades de un espacio

Inputs: space_id (required), limit, offset.

anytype_list_spacesB

Lista todos los espacios disponibles

Inputs: no named parameters.

anytype_list_tagsB

Lists all tags for a property

Inputs: space_id (required), property_key (required), limit, offset.

anytype_list_templatesC

Lists all available templates for a specific type

Inputs: space_id (required), type_id (required), limit, offset.

anytype_list_typesC

Lista todos los tipos de objetos

Inputs: space_id (required).

anytype_remove_from_collectionC

Removes an object from a collection

Inputs: space_id (required), collection_id (required), object_id (required).

anytype_search_objectsB

Busca objetos en todos los espacios o en un espacio especĆ­fico

Inputs: query, space_id, types, limit.

anytype_update_objectA

Actualiza un objeto existente. IMPORTANTE: Para actualizaciones de contenido (body/markdown), utiliza una estrategia de reemplazo que crea un nuevo objeto con el contenido actualizado y elimina el original, ya que la API de Anytype no actualiza correctamente el contenido markdown con el mƩtodo tradicional.

Inputs: space_id (required), object_id (required), name, body, +3 more.

anytype_update_propertyD

Actualiza una propiedad existente

Inputs: space_id (required), property_id (required), name, description, +3 more.

anytype_update_spaceC

Actualiza un espacio existente

Inputs: space_id (required), name, description, icon.

anytype_update_tagC

Updates an existing tag

Inputs: space_id (required), tag_id (required), name, color.

anytype_update_typeC

Actualiza un tipo existente

Inputs: space_id (required), type_id (required), name, description, +3 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 33 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose targeting specific resources (objects, spaces, properties, tags, types, collections, members, templates) and actions (create, get, list, update, delete, add/remove, search). No ambiguity exists between tools like anytype_get_object vs anytype_list_objects or anytype_create_property vs anytype_update_property. The descriptions reinforce distinct operations.

    Naming Consistency5/5

    All 33 tools follow a perfect verb_noun pattern with the prefix 'anytype_' and snake_case throughout. The pattern is consistent: anytype_[action]_[resource] (e.g., anytype_create_object, anytype_get_space, anytype_list_tags). No deviations in style or convention exist across the toolset.

    Tool Count4/5

    With 33 tools, the count is slightly high but reasonable for a comprehensive content management system covering spaces, objects, properties, types, tags, templates, members, and collections. Each tool appears to serve a specific purpose in the domain, though some consolidation might be possible (e.g., add/remove from collection could be one tool).

    Completeness5/5

    The toolset provides complete CRUD/lifecycle coverage for all core domain entities: spaces, objects, properties, types, tags, templates, and members. It includes create, get, list, update, and delete operations for each, plus search, collection management, and view handling. No obvious gaps exist; agents can perform full workflows without dead ends.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP clients that support remote servers, such as ChatGPT, to securely search, fetch, list, and optionally create or update objects in a self-hosted Anytype space over HTTPS.
      MIT