Markdown文档LLM访问协议

一个为LLM提供加密Markdown文档访问和管理的MCP服务器,可将Markdown文件转化为LLM可访问的知识库。

  • by bndkts
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 bndkts/molt-md-mcp

使用说明

molt mcp

提供LLM访问的模型上下文协议(MCP)服务器 molt md,一种加密的markdown文档托管服务。 将您的markdown文件转化为LLM可访问的知识库 通过将它们上传到molt-md并通过此MCP服务器访问它们。您的AI助手可以读取、更新和管理工作区中组织的加密标记文档。

特性

  • 标记语言→ MCP服务器 -将您的markdown文件组织到带工作区的LLM可访问存储中(在测试版期间免费)
  • API全面覆盖 -每个molt-md端点都作为MCP工具公开
  • 加密存储 -使用AES-256-GCM进行端到端加密
  • 读/写密钥支持 -通过API的双密钥模型执行权限
  • 工作空间管理 -捆绑和组织多个文档
  • 部分胎儿 -高效的文档预览,限行阅读
  • 版本控制 -支持ETag的乐观并发控制

安装

使用以下命令直接从GitHub安装 uvx:

uvx --from git+https://github.com/bndkts/molt-md-mcp molt-mcp

或者从源代码安装以进行开发:

git clone https://github.com/bndkts/molt-md-mcp.git
cd molt-md-mcp
uv pip install -e .

配置

克劳德桌面

添加到您的Claude Desktop配置文件中:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
视窗: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "molt-md": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/bndkts/molt-md-mcp", "molt-mcp"],
      "env": {
        "MOLT_API_KEY": "your-api-key-here",
        "MOLT_WORKSPACE_ID": "your-workspace-id-here"
      }
    }
  }
}

环境变量

  • MOLT_API_KEY (必填)-您的molt md写入密钥或读取密钥(通过创建文档获得)
  • MOLT_WORKSPACE_ID (可选)-通过特定工作区访问文档
  • MOLT_BASE_URL (可选)-API基本URL(默认为 https://api.molt-md.com/api/v1;使用 http://localhost:8000/api/v1 地方发展)

权限模型

服务器在每个请求中将您配置的密钥传递给molt-md API:

  • 写密钥 → 所有操作均成功(读取+创建+更新+删除)
  • 读取密钥 → 读取操作成功;写入操作返回 403 Forbidden 来自API

可用工具

只读工具(可用于两种密钥类型)

  • health_check -检查molt-md API是否可用
  • get_metrics -获取数据库统计信息(文档和工作区计数)
  • read_doc -读取文档的解密内容
    • 支持部分提取 lines 参数
    • 返回带有元数据或纯markdown的JSON
  • read_workspace -读取工作区的内容(名称和条目)
    • 支持预览生成 preview_lines 参数

写入工具(需要写入密钥)

文档操作

  • create_doc -创建新的加密文档
    • 返回文档ID、写入密钥和读取密钥
  • update_doc -替换文档的全部内容
    • 支持乐观锁定 if_match (ETag版本)
  • append_doc -将内容附加到文档末尾
    • 支持乐观锁定 if_match
  • delete_doc -永久删除文档

工作区操作

  • create_workspace -创建一个新的工作区来捆绑文档
    • 返回工作区ID、写键和读键
  • update_workspace -替换工作区的内容(名称和条目)
    • 支持乐观锁定 if_match
  • delete_workspace -永久删除工作区
    • 不删除引用的文档

使用示例

基本文档操作

User: Create a new document with the title "Meeting Notes"
Assistant: [Uses create_doc tool] → Returns doc ID and keys

User: Read that document
Assistant: [Uses read_doc tool with the doc ID]

User: Append a new section to the document
Assistant: [Uses append_doc tool]

工作空间管理

User: Create a workspace called "Project Alpha" with these two documents
Assistant: [Uses create_workspace tool with document IDs and keys]

User: Show me a preview of all documents in the workspace
Assistant: [Uses read_workspace with preview_lines=1]

部分取件提高效率

User: Show me just the title of document xyz
Assistant: [Uses read_doc with lines=1 and as_markdown=true]

发展

设置

# Clone the repository
git clone https://github.com/bndkts/molt-md-mcp.git
cd molt-md-mcp

# Install dependencies
uv pip install -e .

# Run the server
molt-mcp

测试

使用本地molt-md API:

# Start the molt-md API server first (in another terminal)
cd /path/to/molt-md
cargo run  # or your preferred method

# Create a test document to get keys
curl -X POST http://localhost:8000/api/v1/docs \
  -H "Content-Type: application/json" \
  -d '{"content": "# Test Document"}'
# Save the write_key and id from the response

# Run the MCP server
export MOLT_BASE_URL="http://localhost:8000/api/v1"
export MOLT_API_KEY="your-write-key-here"
npx @modelcontextprotocol/inspector molt-mcp

使用生产molt-md API:

# Create a test document to get keys
curl -X POST https://api.molt-md.com/api/v1/docs \
  -H "Content-Type: application/json" \
  -d '{"content": "# Test Document"}'
# Save the write_key from the response

# Run the MCP server
export MOLT_API_KEY="your-write-key-here"
npx @modelcontextprotocol/inspector molt-mcp

安全说明

  • 永远不要将API密钥提交到版本控制
  • 按键仅显示一次 在创建文档/工作区期间-安全地保存它们
  • 读取密钥 可以安全地为只读协作者共享
  • 写入密钥 提供完全访问权限-仅与受信任的编辑器共享
  • 丢失的钥匙 无法恢复-内容将永久无法访问

建筑

这是一个围绕molt-md REST API的薄包装:

  1. FastMCP 处理MCP协议和工具注册
  2. httpx 使用连接池发出异步HTTP请求
  3. 环境配置 提供API键和可选的工作区上下文
  4. UUID验证 和 ETag格式化 确保正确使用API

链接

许可证

MIT许可证-有关详细信息,请参阅许可证文件

贡献

欢迎投稿!请在GitHub上打开问题或拉取请求。


内置于❤️ 模型上下文协议生态系统