MCP cover image
See in Github
2025-03-24

🔒Atomic Writer MCP服务器:一种安全的文件操作服务,可通过原子交易来防止数据丢失。为AI集成,协作编辑和关键数据管理而建。

1

Github Watches

0

Github Forks

1

Github Stars

Atomic Writer MCP Server

A secure and atomic file operation service implemented as an MCP (Model Context Protocol) server. This server provides safe, transactional file operations through the MCP protocol.

Motivation

Have you ever experienced an LLM (Large Language Model) accidentally deleting your content while trying to help? It's a common and frustrating experience - the AI confidently makes changes to your files, only to realize afterwards that it just deleted important content.

I built this system after a particularly painful experience with my Obsidian notes. While working on an integration that allowed AI to help manage my notes, I discovered that sometimes it would inadvertently wipe out half of a note's content without realizing the impact of its actions.

This led me to develop the Atomic Writer - a safety-first file operation system that prevents destructive operations by design:

  • New content can only be appended, never overwritten
  • Files can only be created if they don't exist and are empty
  • All operations are tracked and can be rolled back
  • File integrity is constantly monitored and verified

While originally built to protect against unintended AI modifications, the Atomic Writer can be used in any scenario where file safety is paramount. It's perfect for:

  • AI integrations that need to modify files
  • Collaborative editing systems
  • Critical data management
  • Any application where preventing accidental data loss is essential

Features

Core File Operations

  • Create and write files with content verification
  • Read files with integrity checks
  • Move files to new locations atomically
  • Safe file deletion with trash directory
  • Append and prepend content to files

Text Manipulation

  • Replace first or all occurrences of text
  • Insert content at specific line numbers
  • Delete specific lines
  • Read specific lines or context around search terms

Safety Features

  • All operations are atomic and journaled
  • File integrity verification
  • Automatic backup before modifications
  • Trash directory for deleted files
  • Lock management to prevent conflicts
  • Operation rollback capability
  • Automatic external file integration:
    • Detects files created outside the system
    • Initializes integrity tracking on first access
    • Seamless integration with existing operations

System Operations

  • System status monitoring
  • File operation history
  • Lock management
  • File recovery from journal
  • Integrity verification with external file support
  • Automatic tracking initialization for untracked files

Installation

  1. Clone the repository
  2. Install dependencies: npm install
  3. Build the project: npm run build
  4. Configure the server in your MCP host's configuration

MCP Server Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "atomic-writer": {
      "command": "node",
      "args": [
        "/absolute/path/to/atomic-writer/build/index.js",
        "/absolute/path/to/base/directory"
      ]
    }
  }
}

Important: The second argument ("/absolute/path/to/base/directory") is required and specifies where the Atomic Writer will store and manage files. This directory will contain the .atomic-writer subdirectory with all the system files (journal, locks, etc.).

Alternatively, you can set the BASE_DIR environment variable instead of providing the second argument.

Location of config file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Available Tools

The server provides these MCP tools:

File Operations

  • write-file: Create new file or write to empty file
  • read-file: Read file with integrity verification
  • delete-file: Move file to trash directory
  • move-file: Atomically move/rename file
  • append-content: Append content to file
  • prepend-content: Prepend content to file

Text Operations

  • replace-content: Replace first occurrence of text
  • replace-all-content: Replace all occurrences of text
  • insert-content-at-line: Insert content at line number
  • delete-line: Delete specific line
  • read-lines: Read specific line numbers
  • read-around: Read lines around search term

System Tools

  • verify-integrity: Check file integrity and initialize tracking for external files
  • get-status: Get system status
  • recover-file: Recover from journal
  • get-file-history: View operation history
  • get-lock-status: Check file locks
  • force-release-lock: Release stuck locks
  • rollback-operation: Rollback changes

Error Codes

Operations return standardized error codes:

  • FILE_NOT_FOUND: File does not exist
  • INVALID_PATH: Path is invalid
  • EMPTY_CONTENT: Content is empty
  • LINE_OUT_OF_BOUNDS: Invalid line number
  • FILE_LOCKED: File is locked
  • INTEGRITY_ERROR: Checksum verification failed

Directory Structure

base/
  ├── files/    # Managed files
  ├── journal/  # Operation journal
  ├── locks/    # File locks
  ├── trash/    # Deleted files
  └── temp/     # Temporary files

Development

  • npm run build: Build the TypeScript code
  • npm run test: Run the test suite
  • npm run lint: Run the linter

Security

  • All operations are atomic and journaled
  • Files are protected with locks during operations
  • Content integrity is verified with checksums
  • Deleted files are moved to trash instead of permanent deletion
  • Operations can be rolled back if needed
  • External files automatically brought under integrity protection

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • modelcontextprotocol
  • 模型上下文协议服务器

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

    Reviews

    4 (1)
    Avatar
    user_8V9EFGTD
    2025-04-15

    The Gemini Context MCP Server by ogoldberg is a game-changer for MCP applications. Its seamless integration and robust performance make it indispensable for any serious MCP user. The server's reliability and user-friendly interface ensure a smooth experience. Highly recommend checking it out!