org-mcp 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
org_mcp/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """A python-based MCP server for your local org mode files."""
2
+
3
+ __version__ = "0.1.0"
org_mcp/cli.py ADDED
@@ -0,0 +1,32 @@
1
+ """Command-line interface for org-mcp."""
2
+
3
+ import argparse
4
+ import os
5
+ import sys
6
+
7
+ from org_mcp.server import mcp
8
+
9
+
10
+ def main():
11
+ """Run the org-mcp MCP server."""
12
+ parser = argparse.ArgumentParser(description="org-mcp - MCP server for org mode files")
13
+ parser.add_argument(
14
+ "--org-dir",
15
+ help="Directory containing org files (default: $ORG_DIR or ~/org)"
16
+ )
17
+
18
+ args = parser.parse_args()
19
+
20
+ if args.org_dir:
21
+ os.environ["ORG_DIR"] = args.org_dir
22
+
23
+ try:
24
+ mcp.run()
25
+ return 0
26
+ except Exception as e:
27
+ print(f"Error: {e}", file=sys.stderr)
28
+ return 1
29
+
30
+
31
+ if __name__ == "__main__":
32
+ sys.exit(main())
org_mcp/server.py ADDED
@@ -0,0 +1,84 @@
1
+ """MCP server for org-mode files."""
2
+
3
+ import os
4
+ import pathlib
5
+ from typing import List, Dict, Any
6
+
7
+ from mcp.server.fastmcp import FastMCP, Context
8
+
9
+ # Create an MCP server
10
+ mcp = FastMCP("org-mcp")
11
+
12
+
13
+ def get_org_dir() -> str:
14
+ """Get the org directory from environment variable or default to ~/org."""
15
+ org_dir = os.environ.get("ORG_DIR", os.path.expanduser("~/org"))
16
+ return org_dir
17
+
18
+
19
+ @mcp.resource("org://files")
20
+ def list_org_files() -> str:
21
+ """List all org files in the configured directory."""
22
+ org_dir = get_org_dir()
23
+ path = pathlib.Path(org_dir)
24
+
25
+ try:
26
+ org_files = list(path.glob("**/*.org"))
27
+ if not org_files:
28
+ return f"No .org files found in {org_dir}"
29
+
30
+ files_info = [f"- {file.relative_to(path)}" for file in org_files]
31
+ return f"Org files in {org_dir}:\n\n" + "\n".join(files_info)
32
+ except Exception as e:
33
+ return f"Error accessing org files: {str(e)}"
34
+
35
+
36
+ @mcp.tool()
37
+ def list_org_files_tool() -> List[Dict[str, str]]:
38
+ """Get a list of all org files."""
39
+ org_dir = get_org_dir()
40
+ path = pathlib.Path(org_dir)
41
+
42
+ try:
43
+ org_files = list(path.glob("**/*.org"))
44
+ return [
45
+ {"path": str(file.relative_to(path)), "full_path": str(file)}
46
+ for file in org_files
47
+ ]
48
+ except Exception as e:
49
+ return [{"error": str(e)}]
50
+
51
+
52
+ @mcp.tool()
53
+ def read_org_file(file_path: str) -> str:
54
+ """Read the content of an org file.
55
+
56
+ Args:
57
+ file_path: Relative path to the org file
58
+ """
59
+ org_dir = get_org_dir()
60
+ full_path = os.path.join(org_dir, file_path)
61
+
62
+ try:
63
+ with open(full_path, "r", encoding="utf-8") as f:
64
+ content = f.read()
65
+ return content
66
+ except Exception as e:
67
+ return f"Error reading file: {str(e)}"
68
+
69
+
70
+ @mcp.prompt()
71
+ def org_help() -> str:
72
+ """Help prompt for org-mode interactions."""
73
+ return """
74
+ I can help you access and work with your org-mode files. Here are some things you can ask me:
75
+
76
+ - List all your org files
77
+ - Read a specific org file
78
+ - Search for content in your org files
79
+ - Summarize your TODOs and agenda
80
+ """
81
+
82
+
83
+ if __name__ == "__main__":
84
+ mcp.run()
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: org-mcp
3
+ Version: 0.1.0
4
+ Summary: A python-based MCP server for your local org mode files
5
+ Author-email: Andy Reagan <andy@andyreagan.com>
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: mcp[cli]>=1.6.0
9
+ Requires-Dist: pytest>=8.3.5
10
+
11
+ # org-mcp
12
+
13
+ A python-based MCP server for your local org mode files.
14
+ Allows access to your org notes, agenda, and TODOs.
15
+
16
+ <a href="https://github.com/andyreagan/org-mcp/actions/workflows/python-test-publish.yml"><img src="https://github.com/andyreagan/org-mcp/actions/workflows/python-test-publish.yml/badge.svg" alt="Tests"></a> <a href="https://badge.fury.io/py/org-mcp"><img src="https://badge.fury.io/py/org-mcp.svg" alt="PyPI version"></a>
17
+
18
+ ## Tools
19
+
20
+ - List org files
21
+ - Read file headings
22
+ - Read specific heading in file
23
+ - Read whole file
24
+ - Search for documents matching a specified text query across all files in the
25
+ vault (including the ID link), returns matching files/headings
26
+ - Add new file
27
+ - Add new heading to existing file
28
+ - Read agenda and TODOs from org's =M-x org-agenda n=
29
+ - Modify heading
30
+
31
+ ## Example prompt
32
+
33
+ - What does my day look like today?
34
+ - What are the most important things for me to work on right now?
35
+ - Based on my long term career and personal goals, what suggestions would a
36
+ coach give me? E.g., reprioritizing open TODOs, specific actions to take.
37
+
38
+ ## Adding to Claude Desktop
39
+
40
+ In general, follow the instructions from Anthropic.
41
+
42
+ For development:
43
+
44
+ ```
45
+ {
46
+ "mcpServers": {
47
+ "org-mcp": {
48
+ "command": "uv",
49
+ "args": [
50
+ "--directory",
51
+ "<dir_to>/org-mcp",
52
+ "run",
53
+ "org-mcp"
54
+ ]
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ To use the published version
61
+
62
+ ```
63
+ {
64
+ "mcpServers": {
65
+ "org-mcp": {
66
+ "command": "uvx",
67
+ "args": [
68
+ "org-mcp"
69
+ ],
70
+ "env": {
71
+ "ORG_DIR" : "<YOUR_ORG_DIR>"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ ```
@@ -0,0 +1,8 @@
1
+ org_mcp/__init__.py,sha256=hJwbg4B4YOsFsrotnmAiCRP6oStSwQxXtKFrvbNwQ_U,86
2
+ org_mcp/cli.py,sha256=8vdwgCcMa26gOsXtP4XBhS0LVS5E2XQ5E_em1I2raKU,679
3
+ org_mcp/server.py,sha256=4UngMaSg3ktfCeo79deICgPvE_2FSRG6SWtDBVh9BEk,2192
4
+ org_mcp-0.1.0.dist-info/METADATA,sha256=EMw9xHnS2DsZEk329stwCukUGiEolyCVpGtkXpcCS7w,1877
5
+ org_mcp-0.1.0.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
6
+ org_mcp-0.1.0.dist-info/entry_points.txt,sha256=v7zA0R6vmgQiKb6fkt63fOBbqmgPWbVkfF_TfbyYHDk,45
7
+ org_mcp-0.1.0.dist-info/top_level.txt,sha256=uccaWaM4Oa0erIinKHaT6OPQYUT5UGH7BVs7jdOUnL4,8
8
+ org_mcp-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ org-mcp = org_mcp.cli:main
@@ -0,0 +1 @@
1
+ org_mcp