huntkil/mcp_python
If you are the rightful owner of mcp_python and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Markdown MCP Server is designed to efficiently manage Markdown documents within the Cursor AI IDE, providing CRUD operations and advanced features.
Markdown MCP Server
Cursor AI IDE์์ ์ฌ์ฉํ ์ ์๋ Markdown ๋ฌธ์ ๊ด๋ฆฌ MCP (Model Context Protocol) ์๋ฒ์ ๋๋ค.
๊ฐ์
์ด ํ๋ก์ ํธ๋ Cursor AI IDE์์ Markdown ๋ฌธ์์ CRUD ์์ ์ ํจ์จ์ ์ผ๋ก ์ํํ ์ ์๋๋ก ํ๋ MCP ์๋ฒ๋ฅผ ์ ๊ณตํฉ๋๋ค. ๋ฌธ์ ์์ฑ, ์ฝ๊ธฐ, ์์ , ์ญ์ ๋ฟ๋ง ์๋๋ผ ๊ฒ์, ๋ฉํ๋ฐ์ดํฐ ๊ด๋ฆฌ ๋ฑ ๊ณ ๊ธ ๊ธฐ๋ฅ์ ์ง์ํฉ๋๋ค.
์ฃผ์ ๊ธฐ๋ฅ
๊ธฐ๋ณธ CRUD ์์
- ๋ฌธ์ ์์ฑ: ์๋ก์ด Markdown ํ์ผ ์์ฑ
- ๋ฌธ์ ์ฝ๊ธฐ: ๊ธฐ์กด Markdown ํ์ผ ๋ด์ฉ ์ฝ๊ธฐ
- ๋ฌธ์ ์์ : ๊ธฐ์กด ํ์ผ ๋ด์ฉ ์์ ๋๋ ์ถ๊ฐ
- ๋ฌธ์ ์ญ์ : Markdown ํ์ผ ์ญ์
๊ณ ๊ธ ๊ธฐ๋ฅ
- ๋ฌธ์ ๋ชฉ๋ก ์กฐํ: ๋๋ ํ ๋ฆฌ ๋ด Markdown ํ์ผ ๋ชฉ๋ก ์กฐํ
- ๋ด์ฉ ๊ฒ์: ํ์ผ ๋ด์ฉ์์ ํค์๋ ๊ฒ์
- ๋ฉํ๋ฐ์ดํฐ ๊ด๋ฆฌ: YAML frontmatter ๊ด๋ฆฌ (์ถ๊ฐ, ์์ , ์ญ์ )
๊ธฐ์ ์คํ
- ์ธ์ด: Python 3.9+
- ํ๋ ์์ํฌ: MCP Python SDK
- ๋ฌธ์ ํ์: Markdown (.md, .markdown)
- ์์กด์ฑ:
mcp
,pyyaml
,pathlib2
,typing-extensions
์ค์น
1. ์ ์ฅ์ ํด๋ก
git clone <repository-url>
cd markdown-mcp-server
2. ์์กด์ฑ ์ค์น
pip install -r requirements.txt
3. ๊ฐ๋ฐ ๋ชจ๋ ์ค์น (์ ํ์ฌํญ)
pip install -e .
์ฌ์ฉ๋ฒ
Cursor AI IDE ์ค์
Cursor AI IDE์ ์ค์ ํ์ผ์ MCP ์๋ฒ๋ฅผ ์ถ๊ฐํ์ธ์:
{
"mcp": {
"servers": {
"markdown-manager": {
"command": "python",
"args": ["-m", "src.server"],
"cwd": "/path/to/markdown-mcp-server"
}
}
}
}
ํ๊ฒฝ ๋ณ์
MARKDOWN_MCP_BASE_PATH
: ํ์ผ ์์ ์ ๊ธฐ๋ณธ ๋๋ ํ ๋ฆฌ (๊ธฐ๋ณธ๊ฐ: ํ์ฌ ๋๋ ํ ๋ฆฌ)
API ์ฐธ์กฐ
1. read_markdown
Markdown ํ์ผ์ ์ฝ์ด์ ๋ด์ฉ์ ๋ฐํํฉ๋๋ค.
๋งค๊ฐ๋ณ์:
file_path
(string): ์ฝ์ ํ์ผ์ ๊ฒฝ๋กencoding
(optional, string): ํ์ผ ์ธ์ฝ๋ฉ (๊ธฐ๋ณธ๊ฐ: "utf-8")
๋ฐํ๊ฐ:
{
"success": true,
"content": "ํ์ผ ๋ด์ฉ",
"content_without_frontmatter": "frontmatter ์ ์ธํ ๋ด์ฉ",
"frontmatter": {"title": "์ ๋ชฉ", "author": "์์ฑ์"},
"file_info": {"name": "ํ์ผ๋ช
", "size": 1024, ...},
"encoding": "utf-8"
}
2. create_markdown
์๋ก์ด Markdown ํ์ผ์ ์์ฑํฉ๋๋ค.
๋งค๊ฐ๋ณ์:
file_path
(string): ์์ฑํ ํ์ผ์ ๊ฒฝ๋กcontent
(string): ํ์ผ ๋ด์ฉoverwrite
(optional, boolean): ๊ธฐ์กด ํ์ผ ๋ฎ์ด์ฐ๊ธฐ ์ฌ๋ถ (๊ธฐ๋ณธ๊ฐ: false)
๋ฐํ๊ฐ:
{
"success": true,
"message": "File created successfully: file.md",
"file_path": "/full/path/to/file.md",
"file_info": {"name": "file.md", "size": 1024, ...}
}
3. update_markdown
๊ธฐ์กด Markdown ํ์ผ์ ๋ด์ฉ์ ์์ ํฉ๋๋ค.
๋งค๊ฐ๋ณ์:
file_path
(string): ์์ ํ ํ์ผ์ ๊ฒฝ๋กcontent
(string): ์๋ก์ด ๋ด์ฉappend
(optional, boolean): ๋ด์ฉ ์ถ๊ฐ ์ฌ๋ถ (๊ธฐ๋ณธ๊ฐ: false)
๋ฐํ๊ฐ:
{
"success": true,
"message": "File updated successfully: file.md",
"file_path": "/full/path/to/file.md",
"file_info": {"name": "file.md", "size": 1024, ...}
}
4. delete_markdown
์ง์ ๋ Markdown ํ์ผ์ ์ญ์ ํฉ๋๋ค.
๋งค๊ฐ๋ณ์:
file_path
(string): ์ญ์ ํ ํ์ผ์ ๊ฒฝ๋กconfirm
(optional, boolean): ์ญ์ ํ์ธ (๊ธฐ๋ณธ๊ฐ: false)
๋ฐํ๊ฐ:
{
"success": true,
"message": "File deleted successfully: file.md"
}
5. list_markdown_files
์ง์ ๋ ๋๋ ํ ๋ฆฌ์ Markdown ํ์ผ ๋ชฉ๋ก์ ๋ฐํํฉ๋๋ค.
๋งค๊ฐ๋ณ์:
directory
(optional, string): ๊ฒ์ํ ๋๋ ํ ๋ฆฌ ๊ฒฝ๋ก (๊ธฐ๋ณธ๊ฐ: ".")recursive
(optional, boolean): ํ์ ๋๋ ํ ๋ฆฌ ํฌํจ ์ฌ๋ถ (๊ธฐ๋ณธ๊ฐ: false)pattern
(optional, string): ํ์ผ ํจํด (๊ธฐ๋ณธ๊ฐ: "*.md")
๋ฐํ๊ฐ:
{
"success": true,
"files": [
{
"name": "file1.md",
"size": 1024,
"modified": 1234567890,
"relative_path": "file1.md"
}
],
"count": 1,
"directory": "."
}
6. search_markdown
Markdown ํ์ผ ๋ด์ฉ์์ ํค์๋๋ฅผ ๊ฒ์ํฉ๋๋ค.
๋งค๊ฐ๋ณ์:
directory
(string): ๊ฒ์ํ ๋๋ ํ ๋ฆฌquery
(string): ๊ฒ์ ํค์๋case_sensitive
(optional, boolean): ๋์๋ฌธ์ ๊ตฌ๋ถ ์ฌ๋ถ (๊ธฐ๋ณธ๊ฐ: false)
๋ฐํ๊ฐ:
{
"success": true,
"results": [
{
"file_path": "file1.md",
"matches": [
{"line_number": 5, "line_content": "This line contains the keyword"}
],
"match_count": 1
}
],
"total_files_searched": 10,
"files_with_matches": 1,
"query": "keyword",
"case_sensitive": false
}
7. manage_frontmatter
Markdown ํ์ผ์ YAML frontmatter๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
๋งค๊ฐ๋ณ์:
file_path
(string): ๋์ ํ์ผ ๊ฒฝ๋กaction
(string): ์์ ์ ํ ("get", "set", "update", "remove")metadata
(optional, object): ๋ฉํ๋ฐ์ดํฐ ์ ๋ณด (set/update ์์ ์ ํ์)
๋ฐํ๊ฐ (get ์์ ):
{
"success": true,
"frontmatter": {"title": "์ ๋ชฉ", "author": "์์ฑ์"},
"has_frontmatter": true
}
๋ฐํ๊ฐ (๊ธฐํ ์์ ):
{
"success": true,
"message": "Frontmatter set completed successfully",
"file_path": "/full/path/to/file.md",
"action": "set"
}
์ฌ์ฉ ์์
Cursor AI IDE์์ ์ฌ์ฉ
-
์๋ก์ด ํ๋ก์ ํธ ๋ฌธ์ ์์ฑ
"์๋ก์ด ํ๋ก์ ํธ ๋ฌธ์๋ฅผ ์์ฑํด์ฃผ์ธ์. ํ์ผ๋ช : project-overview.md"
-
ํค์๋๋ก ๋ฌธ์ ๊ฒ์
"'API ๋ฌธ์' ํค์๋๊ฐ ํฌํจ๋ ๋ชจ๋ ๋งํฌ๋ค์ด ํ์ผ์ ์ฐพ์์ฃผ์ธ์"
-
๊ธฐ์กด ๋ฌธ์์ ๋ด์ฉ ์ถ๊ฐ
"README.md ํ์ผ์ ์ค์น ๊ฐ์ด๋ ์น์ ์ ์ถ๊ฐํด์ฃผ์ธ์"
-
๋ฉํ๋ฐ์ดํฐ ๊ด๋ฆฌ
"project.md ํ์ผ์ frontmatter์ ๋ฒ์ ์ ๋ณด๋ฅผ ์ถ๊ฐํด์ฃผ์ธ์"
๊ฐ๋ฐ
ํ๋ก์ ํธ ๊ตฌ์กฐ
markdown-mcp-server/
โโโ src/
โ โโโ __init__.py
โ โโโ server.py # MCP ์๋ฒ ๋ฉ์ธ ๋ก์ง
โ โโโ markdown_manager.py # Markdown ๋ฌธ์ ๊ด๋ฆฌ ํด๋์ค
โ โโโ utils.py # ์ ํธ๋ฆฌํฐ ํจ์
โโโ tests/
โ โโโ __init__.py
โ โโโ test_server.py
โ โโโ test_markdown_manager.py
โโโ requirements.txt
โโโ setup.py
โโโ README.md
ํ ์คํธ ์คํ
# ๋จ์ ํ
์คํธ ์คํ
python -m unittest tests.test_markdown_manager
# ํตํฉ ํ
์คํธ ์คํ
python -m unittest tests.test_server
# ๋ชจ๋ ํ
์คํธ ์คํ
python -m unittest discover tests
์๋ฒ ์คํ
# ์ง์ ์คํ
python -m src.server
# ํ๊ฒฝ ๋ณ์์ ํจ๊ป ์คํ
MARKDOWN_MCP_BASE_PATH=/path/to/docs python -m src.server
๋ณด์ ๊ณ ๋ ค์ฌํญ
- ๊ฒฝ๋ก ๊ฒ์ฆ: ๋ชจ๋ ํ์ผ ๊ฒฝ๋ก๋ path traversal ๊ณต๊ฒฉ์ ๋ฐฉ์งํ๊ธฐ ์ํด ๊ฒ์ฆ๋ฉ๋๋ค.
- ๊ถํ ํ์ธ: ํ์ผ ์์คํ ์ ๊ทผ ๊ถํ์ ํ์ธํฉ๋๋ค.
- ์ ๋ ฅ ๊ฒ์ฆ: ๋ชจ๋ ์ฌ์ฉ์ ์ ๋ ฅ์ ๊ฒ์ฆ๋ฉ๋๋ค.
- ์์ ํ ํ์ผ ์ฒ๋ฆฌ: ํ์ผ ํฌ๊ธฐ ์ ํ ๋ฐ ์ธ์ฝ๋ฉ ๋ฌธ์ ๋ฅผ ์ฒ๋ฆฌํฉ๋๋ค.
์๋ฌ ์ฒ๋ฆฌ
๋ชจ๋ API ํธ์ถ์ ์ผ๊ด๋ ์๋ฌ ์๋ต ํ์์ ๋ฐํํฉ๋๋ค:
{
"error": "์๋ฌ ๋ฉ์์ง ์ค๋ช
"
}
์ผ๋ฐ์ ์ธ ์๋ฌ ์ํฉ:
- ํ์ผ์ด ์กด์ฌํ์ง ์๋ ๊ฒฝ์ฐ
- ๊ถํ์ด ์๋ ๊ฒฝ์ฐ
- ์๋ชป๋ ํ์ผ ๊ฒฝ๋ก
- ์ธ์ฝ๋ฉ ์ค๋ฅ
- ๋๋ ํ ๋ฆฌ๊ฐ ์กด์ฌํ์ง ์๋ ๊ฒฝ์ฐ
๋ก๊น
์๋ฒ๋ ๊ตฌ์กฐํ๋ ๋ก๊น ์ ์ ๊ณตํฉ๋๋ค:
- INFO: ์ผ๋ฐ์ ์ธ ์์ ๋ก๊ทธ
- WARNING: ๊ฒฝ๊ณ ์ํฉ
- ERROR: ์ค๋ฅ ์ํฉ
๋ก๊ทธ ๋ ๋ฒจ์ ํ๊ฒฝ ๋ณ์ LOG_LEVEL
๋ก ์ค์ ํ ์ ์์ต๋๋ค.
๊ธฐ์ฌํ๊ธฐ
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
๋ผ์ด์ ์ค
์ด ํ๋ก์ ํธ๋ MIT ๋ผ์ด์ ์ค ํ์ ๋ฐฐํฌ๋ฉ๋๋ค. ์์ธํ ๋ด์ฉ์ LICENSE
ํ์ผ์ ์ฐธ์กฐํ์ธ์.
์ง์
๋ฌธ์ ๊ฐ ๋ฐ์ํ๊ฑฐ๋ ์ง๋ฌธ์ด ์์ผ์๋ฉด GitHub Issues๋ฅผ ํตํด ๋ฌธ์ํด ์ฃผ์ธ์.
๋ณ๊ฒฝ ์ด๋ ฅ
v0.1.0
- ์ด๊ธฐ ๋ฒ์ ๋ฆด๋ฆฌ์ค
- ๊ธฐ๋ณธ CRUD ๊ธฐ๋ฅ ๊ตฌํ
- ๊ฒ์ ๋ฐ ๋ฉํ๋ฐ์ดํฐ ๊ด๋ฆฌ ๊ธฐ๋ฅ ์ถ๊ฐ
- MCP ์๋ฒ ํตํฉ
- ํ ์คํธ ์ฝ๋ ์์ฑ