agentleFS
anyprotoanyproto/anytype-mcp/CLAUDE.md

anytype-mcp

CLAUDE.md526 starsChanged 4 months agoMITView on GitHub

This project uses Bun as its package manager and script runner (lockfile: bun.lock). The published artifact still targets Node.js. This is an MCP (Model Context Protocol) server that bridges Anytype's API with AI assistants. The architecture follows a proxy pattern where OpenAPI specifications are dynamically converted to MCP tools. MCP Proxy Layer (src/mcp/proxy.ts) - Central orchestrator that implements the MCP server protocol - Converts OpenAPI operations to MCP tools dynamically at runtime - Handles tool listing and execution through the…

The file

We split this CLAUDE.md into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run a specific test file: bunx vitest run src/openapi/__tests__/parser.test.ts

    line 17

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Common Commands

This project uses Bun as its package manager and script runner (lockfile: bun.lock). The published artifact still targets Node.js.

Development

  • bun install - Install all dependencies including devDependencies
  • bun run dev - Start the development server with file watching (uses tsx watch)
  • bun run build - Build the TypeScript project and generate CLI binary (bin/cli.mjs)

Testing

  • bun run test - Run all tests once with Vitest
  • bun run test:dev - Run tests in watch mode
  • Run a specific test file: bunx vitest run src/openapi/__tests__/parser.test.ts

Code Quality

  • bun run lint - Check code formatting with ESLint
  • bun run lint:fix - Auto-fix formatting issues with ESLint
  • bun run format - Auto-fix formatting issues with Prettier
  • bun run typecheck - Run TypeScript type checking without emitting files

Utility Scripts

  • bun run parse-openapi - Parse OpenAPI specification

Architecture Overview

This is an MCP (Model Context Protocol) server that bridges Anytype's API with AI assistants. The architecture follows a proxy pattern where OpenAPI specifications are dynamically converted to MCP tools.

Core Components

MCP Proxy Layer (src/mcp/proxy.ts)

  • Central orchestrator that implements the MCP server protocol
  • Converts OpenAPI operations to MCP tools dynamically at runtime
  • Handles tool listing and execution through the MCP protocol
  • Maintains a lookup table mapping MCP tool names to OpenAPI operations

OpenAPI Parser (src/openapi/parser.ts)

  • Converts OpenAPI schemas to JSON Schema format for MCP compatibility
  • Handles $ref resolution with cycle detection
  • Supports multipart/form-data for file uploads
  • Generates MCP tool definitions from OpenAPI paths and operations

HTTP Client (src/client/http-client.ts)

  • Built on openapi-client-axios for OpenAPI-aware HTTP requests
  • Handles authentication headers from environment variables
  • Supports file uploads via FormData
  • Executes OpenAPI operations with proper parameter mapping

Server Initialization (src/init-server.ts)

  • Loads OpenAPI spec from URL (default: local Anytype API) or file
  • Initializes the MCP proxy with the spec
  • Connects to stdio transport for communication

Key Design Patterns

  1. Dynamic Tool Generation: Tools are not hardcoded but generated from the OpenAPI spec at runtime, making the server adaptable to API changes.
  2. Header Injection: Authentication and version headers are parsed from OPENAPI_MCP_HEADERS environment variable and injected into all requests.
  3. Operation Mapping: Each OpenAPI operation becomes an MCP tool with a naming convention: {tag}-{operationId}.
  4. Schema Caching: The parser maintains a cache of resolved schemas to handle circular references and improve performance.

Testing Strategy

Tests use Vitest and are colocated with source files in __tests__ directories. Key test areas:

  • OpenAPI to MCP conversion logic
  • HTTP client behavior including file uploads
  • MCP proxy tool execution
  • Multipart form data handling

Code Style

  • Prettier with 120 character line width
  • Double quotes for strings
  • Automatic import organization via prettier-plugin-organize-imports
  • TypeScript strict mode enabled

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.