feat(mcp-server): add HackMD mcp server (#2260)

This commit is contained in:
Whitea
2025-05-22 16:53:01 +08:00
committed by GitHub
parent fa3c5ea0fc
commit 031ae21caa
3 changed files with 311 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
# HackMD MCP Server
The MCP server implementation based on the HackMD API interacts with the HackMD platform through the MCP protocol. HackMD is a real-time, cross-platform collaborative Markdown knowledge base that allows users to co-edit documents with others on desktop, tablet, or mobile devices.
## Features
HackMD MCP Server provides the following features:
- **User Data**: Retrieve user profile information and related configurations.
- `get_me`: Retrieve user data.
- **Note Management**: Create, read, update, and delete personal notes.
- `get_notes`: Retrieve the user's note list.
- `post_notes`: Create a new note.
- `get_notes_noteId`: Retrieve a specific note by its ID.
- `patch_notes_noteId`: Update the content of a note.
- `delete_notes_noteId`: Delete a note.
- **Team Collaboration**: Manage team-related notes.
- `get_teams`: Retrieve the list of teams the user participates in.
- `get_teams_teamPath_notes`: Retrieve the list of notes in a team.
- `patch_teams_teamPath_notes_noteId`: Update the content of a note within a team.
- `delete_teams_teamPath_notes_noteId`: Delete a note from a team.
- **Browsing History**: View the user's browsing history.
- `get_history`: Retrieve the user's browsing history.
## Usage Guide
### Get AccessToken
参考 [HackMD API 文档](https://hackmd.io/@hackmd-api/developer-portal/https%3A%2F%2Fhackmd.io%2F%40hackmd-api%2FrkoVeBXkq) 获取 AccessToken。
### Generate SSE URL
On the MCP Server interface, log in and enter the AccessToken to generate the URL.
### Configure MCP Client
On the user's MCP Client interface, add the generated SSE URL to the MCP Server list.
``` json
"mcpServers": {
"hackmd": {
"url": "https://mcp.higress.ai/mcp-hackmd/{generate_key}",
}
}
```

View File

@@ -0,0 +1,48 @@
# HackMD MCP Server
基于 HackMD API 的 MCP 服务器实现,通过 MCP 协议与 HackMD 平台进行交互。HackMD 是一个实时、多平台的协作 Markdown 知识库,可以让用户在桌面、平板或手机上与他人共同编写文档。
## 功能
HackMD MCP Server 提供了以下功能:
- **用户数据**:获取用户个人信息和相关配置。
- `get_me`:获取用户数据。
- **笔记管理**:创建、读取、更新和删除个人笔记。
- `get_notes`:获取用户的笔记列表。
- `post_notes`:创建新笔记。
- `get_notes_noteId`:通过 ID 获取特定笔记。
- `patch_notes_noteId`:更新笔记内容。
- `delete_notes_noteId`:删除笔记。
- **团队协作**:处理团队笔记相关操作。
- `get_teams`:获取用户参与的团队列表。
- `get_teams_teamPath_notes`:获取团队中的笔记列表。
- `patch_teams_teamPath_notes_noteId`:更新团队中的笔记内容。
- `delete_teams_teamPath_notes_noteId`:从团队中删除笔记。
- **浏览历史**:查看用户的历史记录。
- `get_history`:获取用户的浏览历史。
## 使用教程
### 获取 AccessToken
参考 [HackMD API 文档](https://hackmd.io/@hackmd-api/developer-portal/https%3A%2F%2Fhackmd.io%2F%40hackmd-api%2FrkoVeBXkq) 获取 AccessToken。
### 生成 SSE URL
在 MCP Server 界面,登录后输入 AccessToken生成URL。
### 配置 MCP Client
在用户的 MCP Client 界面,将生成的 SSE URL添加到 MCP Server列表中。
``` json
"mcpServers": {
"hackmd": {
"url": "https://mcp.higress.ai/mcp-hackmd/{generate_key}",
}
}
```

View File

@@ -0,0 +1,215 @@
server:
name: hackmd
tools:
- name: delete_notes_noteId
description: Delete a note
args:
- name: noteId
description: "Unique identifier of the note to be deleted"
type: string
required: true
position: path
requestTemplate:
url: /notes/{noteId}
method: DELETE
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- name: delete_teams_teamPath_notes_noteId
description: Delete a note from a team
args:
- name: noteId
description: "Unique identifier of the note to be deleted from the team"
type: string
required: true
position: path
- name: teamPath
description: "Path identifier of the team containing the note"
type: string
required: true
position: path
requestTemplate:
url: /teams/{teamPath}/notes/{noteId}
method: DELETE
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- name: get_history
description: Get user's browse history
args: []
requestTemplate:
url: /history
method: GET
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- name: get_me
description: Get user data - GET user data
args: []
requestTemplate:
url: /me
method: GET
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- name: get_notes
description: Get user's note list
args: []
requestTemplate:
url: /notes
method: GET
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- name: get_notes_noteId
description: Get a note by noteId
args:
- name: noteId
description: "Unique identifier of the note to retrieve"
type: string
required: true
position: path
requestTemplate:
url: /notes/{noteId}
method: GET
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- name: get_teams
description: GET a list of team user participating in
args: []
requestTemplate:
url: /teams
method: GET
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- name: get_teams_teamPath_notes
description: Get a list of notes in a team
args:
- name: teamPath
description: "Path identifier of the team to retrieve notes from"
type: string
required: true
position: path
requestTemplate:
url: /teams/{teamPath}/notes
method: GET
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- name: patch_notes_noteId
description: Update a note's content
args:
- name: content
description: "New content to update the note with"
type: string
required: true
position: body
- name: noteId
description: "Unique identifier of the note to update"
type: string
required: true
position: path
requestTemplate:
url: /notes/{noteId}
method: PATCH
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- key: Content-Type
value: application/json
- name: patch_teams_teamPath_notes_noteId
description: Update a note's content in a team
args:
- name: content
description: "New content to update the team note with"
type: string
required: true
position: body
- name: noteId
description: "Unique identifier of the note to update"
type: string
required: true
position: path
- name: teamPath
description: "Path identifier of the team containing the note"
type: string
required: true
position: path
requestTemplate:
url: /teams/{teamPath}/notes/{noteId}
method: PATCH
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- key: Content-Type
value: application/json
- name: post_notes
description: Create a new note
args:
- name: commentPermission
description: "Permission level for comments on the note"
type: string
required: true
position: body
- name: content
description: "Markdown content of the new note"
type: string
required: true
position: body
requestTemplate:
url: /notes
method: POST
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- key: Content-Type
value: application/json
- name: post_teams_teamPath_notes
description: Create a note under a team
args:
- name: commentPermission
description: "Permission level for comments on the note"
type: string
required: true
position: body
- name: content
description: "Markdown content of the new team note"
type: string
required: true
position: body
- name: permission
description: "Access permission level for the note"
type: string
required: true
position: body
- name: teamPath
description: "Path identifier of the team to create the note under"
type: string
required: true
position: path
- name: title
description: "Title of the new team note"
type: string
required: true
position: body
requestTemplate:
url: /teams/{teamPath}/notes
method: POST
headers:
- key: Authorization
value: "Bearer {{.config.accessToken}}"
- key: Content-Type
value: application/json