logo
0
0
WeChat Login
docs: 更新 README 支持多工具及写操作说明 (main)

mdoc-skills

Custom skill for querying, browsing, searching, and managing the M-Doc document system via natural language. Works with any AI tool that supports the Skill protocol.

中文文档


Introduction

mdoc-skills adds an mdoc skill to AI tools that support the Skill protocol (such as Claude Code, Gemini CLI, etc.). Once installed, you can paste any mdoc.cc URL—or a short orgSlug/docSlug path—directly into your prompt, and the AI tool will authenticate against the M-Doc OpenAPI, fetch the document manifest or article content, and display it inline.

Triggers when you:

  • Paste an https://mdoc.cc/… URL
  • Type a short path like mliev/mdoc or mliev/mdoc/v1.0.0/32
  • Ask to "list documents", "read article", "fetch manifest", "search articles", "semantic search"
  • Ask to "create article", "update article", "delete article", "publish article", "merge article"
  • Ask to "call mdoc api"

Features

  • Parse mdoc.cc URLs and short org/doc[/version[/articleId]] paths automatically
  • Check MDOC_TOKEN and prompt you to create one if it's missing
  • Fetch a document's manifest (table of contents) when no article ID is given, rendered as a tree with article IDs
  • Fetch a specific article's Markdown content when an article ID is provided
  • Semantic search across document articles
  • Write operations: create, update, delete, publish, and merge articles via natural language
  • Suggest the next URL to query after each response

Supported Tools

ToolInstall Method
Claude Codeclaude install-skill command
Gemini CLIClone into ~/.gemini/skills/
Other compatible toolsRefer to each tool's Skill documentation

Prerequisites

  • An AI tool that supports the Skill protocol (e.g., Claude Code, Gemini CLI)
  • A personal access token (PAT) for M-Doc (MDOC_TOKEN)

Authentication Setup

  1. Open https://mdoc.cc/settings and navigate to Personal Tokens.
  2. Generate a new PAT. It will look like mdoc_pat_xxxxxxxxxxxxxxxx.
  3. Export it in your terminal (add to ~/.zshrc or ~/.bashrc to persist):
export MDOC_TOKEN="mdoc_pat_your_token_here"

If MDOC_TOKEN is not set when the skill runs, it will stop and show you the setup instructions above.

Note: For write operations (create, update, delete, publish, merge), ensure your PAT has write:articles permission.


Installation

Claude Code

claude install-skill https://cnb.cool/mliev/mdoc/mdoc-skills/-/tree/main/mdoc

Gemini CLI

git clone https://cnb.cool/mliev/mdoc/mdoc-skills.git ~/.gemini/skills/mdoc-skills

Manual Installation (Universal)

For other Skill-compatible tools, clone the repository and point your tool to the skill directory:

git clone https://cnb.cool/mliev/mdoc/mdoc-skills.git

The skill definition is located at mdoc/SKILL.md. Configure your tool to use this directory as a skill source.


Usage

Pass any of the following input formats as your prompt argument:

FormatExample
Full URLhttps://mdoc.cc/mliev/mdoc
URL with versionhttps://mdoc.cc/mliev/mdoc/v1.0.0
URL with articlehttps://mdoc.cc/mliev/mdoc/v1.0.0/32
Short pathmliev/mdoc
Short path with versionmliev/mdoc/v1.0.0
Short path with articlemliev/mdoc/v1.0.0/32
Searchsearch mliev/mdoc authentication

Examples

List a document's table of contents:

/mdoc mliev/mdoc

Output (example):

📄 mdoc [version: master] [1] Quick Start [3] Installation [4] Configuration [2] API Reference [5] Authentication [6] Endpoint List

Read a specific article:

/mdoc https://mdoc.cc/mliev/mdoc/v1.0.0/32

Output: The article's raw Markdown content is displayed inline.

Semantic search:

/mdoc search mliev/mdoc authentication

Output: A ranked list of matching articles with similarity scores and content snippets.

Create an article:

Create an article titled "Deployment Best Practices" under mliev/mdoc v1.0.0

Publish an article:

Publish article 32 in mliev/mdoc with commit message "Updated introduction"

How It Works

The skill executes four steps:

  1. Parse arguments — extracts orgSlug, docSlug, version (optional), and articleId (optional) from the input URL or short path.
  2. Check token — verifies MDOC_TOKEN is set; stops and prompts for setup if unset.
  3. Call the API
    • Search query → GET /openapi/organizations/{org}/documents/{doc}/search
    • With articleIdGET /openapi/organizations/{org}/documents/{doc}/articles/{id}/content.md
    • Write operations → POST/PUT/DELETE on /openapi/versions/{id}/articles/…
    • Otherwise → GET /openapi/organizations/{org}/documents/{doc}/manifest
  4. Display & suggest — renders the manifest as a tree or shows raw Markdown, then suggests the next query.

API Reference

Key endpoints used by this skill (all require Authorization: Bearer <token>):

EndpointDescription
GET /openapi/organizations/:orgSlug/documentsList documents in an org
GET /openapi/organizations/:orgSlug/documents/:docSlug/manifestGet document manifest (TOC)
GET /openapi/organizations/:orgSlug/documents/:docSlug/articles/:articleId/content.mdGet article Markdown
GET /openapi/organizations/:orgSlug/documents/:docSlug/searchSemantic search
POST /openapi/versions/:id/articlesCreate article
PUT /openapi/versions/:id/articles/:articleIdUpdate article
DELETE /openapi/versions/:id/articles/:articleIdDelete article
POST /openapi/versions/:id/articles/:articleId/publishPublish article
POST /openapi/versions/:id/articles/mergeMerge article

Full endpoint reference: mdoc/references/endpoints.md


Project Structure

mdoc-skills/ ├── mdoc/ │ ├── SKILL.md # Skill definition and step-by-step logic │ └── references/ │ └── endpoints.md # Full OpenAPI endpoint reference ├── README.md # This file (English) └── README.zh-CN.md # Chinese documentation

About

mdoc-skills 为 Claude Code 添加了 mdoc 技能。安装后,你可以直接将任意 mdoc.cc URL 或 orgSlug/docSlug 短路径粘贴到提示词中,Claude 会自动向 M-Doc OpenAPI 发起认证请求,获取文档目录或文章内容并内联展示。