Skip to main content
Glama
sirius-cc-wu

Markdown Notes MCP Server

by sirius-cc-wu
main.py1.12 kB
import os from fastmcp import FastMCP mcp = FastMCP(name="MarkdownNotes") def get_base_path(): """Retrieves the base path from an environment variable or defaults to current directory.""" return os.getenv("MD_NOTES_PATH", ".") @mcp.tool def list_notes(path: str = "") -> list[str]: """ Lists notes in a given directory relative to the base path. The base path can be set using the 'MD_NOTES_PATH' environment variable, otherwise it defaults to the current working directory. """ base_path = get_base_path() target_path = os.path.join(base_path, path) return os.listdir(target_path) @mcp.tool def read_note(file_path: str) -> str: """ Reads the content of a note file relative to the base path. The base path can be set using the 'MD_NOTES_PATH' environment variable, otherwise it defaults to the current working directory. """ base_path = get_base_path() target_file_path = os.path.join(base_path, file_path) with open(target_file_path, "r") as f: return f.read() if __name__ == "__main__": mcp.run(transport="http", port=8080)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sirius-cc-wu/mcp-md-notes'

If you have feedback or need assistance with the MCP directory API, please join our Discord server