org-mcp 0.1.0__tar.gz

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-0.1.0/PKG-INFO ADDED
@@ -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,66 @@
1
+ # org-mcp
2
+
3
+ A python-based MCP server for your local org mode files.
4
+ Allows access to your org notes, agenda, and TODOs.
5
+
6
+ <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>
7
+
8
+ ## Tools
9
+
10
+ - List org files
11
+ - Read file headings
12
+ - Read specific heading in file
13
+ - Read whole file
14
+ - Search for documents matching a specified text query across all files in the
15
+ vault (including the ID link), returns matching files/headings
16
+ - Add new file
17
+ - Add new heading to existing file
18
+ - Read agenda and TODOs from org's =M-x org-agenda n=
19
+ - Modify heading
20
+
21
+ ## Example prompt
22
+
23
+ - What does my day look like today?
24
+ - What are the most important things for me to work on right now?
25
+ - Based on my long term career and personal goals, what suggestions would a
26
+ coach give me? E.g., reprioritizing open TODOs, specific actions to take.
27
+
28
+ ## Adding to Claude Desktop
29
+
30
+ In general, follow the instructions from Anthropic.
31
+
32
+ For development:
33
+
34
+ ```
35
+ {
36
+ "mcpServers": {
37
+ "org-mcp": {
38
+ "command": "uv",
39
+ "args": [
40
+ "--directory",
41
+ "<dir_to>/org-mcp",
42
+ "run",
43
+ "org-mcp"
44
+ ]
45
+ }
46
+ }
47
+ }
48
+ ```
49
+
50
+ To use the published version
51
+
52
+ ```
53
+ {
54
+ "mcpServers": {
55
+ "org-mcp": {
56
+ "command": "uvx",
57
+ "args": [
58
+ "org-mcp"
59
+ ],
60
+ "env": {
61
+ "ORG_DIR" : "<YOUR_ORG_DIR>"
62
+ }
63
+ }
64
+ }
65
+ }
66
+ ```
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "org-mcp"
7
+ version = "0.1.0"
8
+ description = "A python-based MCP server for your local org mode files"
9
+ readme = {file = "README.md", content-type = "text/markdown"}
10
+ requires-python = ">=3.11"
11
+ authors = [
12
+ {name = "Andy Reagan", email = "andy@andyreagan.com"}
13
+ ]
14
+ dependencies = [
15
+ "mcp[cli]>=1.6.0",
16
+ "pytest>=8.3.5",
17
+ ]
18
+
19
+ [project.scripts]
20
+ org-mcp = "org_mcp.cli:main"
21
+
22
+ [tool.setuptools]
23
+ package-dir = {"" = "src"}
24
+
25
+ [tool.setuptools.packages.find]
26
+ where = ["src"]
27
+ exclude = ["references*"]
28
+
29
+ [tool.pytest.ini_options]
30
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """A python-based MCP server for your local org mode files."""
2
+
3
+ __version__ = "0.1.0"
@@ -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())
@@ -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,12 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/org_mcp/__init__.py
4
+ src/org_mcp/cli.py
5
+ src/org_mcp/server.py
6
+ src/org_mcp.egg-info/PKG-INFO
7
+ src/org_mcp.egg-info/SOURCES.txt
8
+ src/org_mcp.egg-info/dependency_links.txt
9
+ src/org_mcp.egg-info/entry_points.txt
10
+ src/org_mcp.egg-info/requires.txt
11
+ src/org_mcp.egg-info/top_level.txt
12
+ tests/test_server.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ org-mcp = org_mcp.cli:main
@@ -0,0 +1,2 @@
1
+ mcp[cli]>=1.6.0
2
+ pytest>=8.3.5
@@ -0,0 +1 @@
1
+ org_mcp
@@ -0,0 +1,66 @@
1
+ """Tests for the org-mcp server."""
2
+
3
+ import os
4
+ import pathlib
5
+ import tempfile
6
+ from unittest import mock
7
+
8
+ import pytest
9
+
10
+ from org_mcp.server import list_org_files, list_org_files_tool, read_org_file, get_org_dir
11
+
12
+
13
+ def test_get_org_dir_with_env():
14
+ """Test get_org_dir with environment variable."""
15
+ with mock.patch.dict(os.environ, {"ORG_DIR": "/test/org"}):
16
+ assert get_org_dir() == "/test/org"
17
+
18
+
19
+ def test_get_org_dir_default():
20
+ """Test get_org_dir default."""
21
+ with mock.patch.dict(os.environ, clear=True):
22
+ with mock.patch("os.path.expanduser") as mock_expanduser:
23
+ mock_expanduser.return_value = "/home/user/org"
24
+ assert get_org_dir() == "/home/user/org"
25
+
26
+
27
+ def test_list_org_files():
28
+ """Test list_org_files function."""
29
+ with tempfile.TemporaryDirectory() as temp_dir:
30
+ # Create some test org files
31
+ (pathlib.Path(temp_dir) / "test1.org").touch()
32
+ (pathlib.Path(temp_dir) / "test2.org").touch()
33
+ os.makedirs(os.path.join(temp_dir, "subdir"))
34
+ (pathlib.Path(temp_dir) / "subdir" / "test3.org").touch()
35
+
36
+ with mock.patch("org_mcp.server.get_org_dir", return_value=temp_dir):
37
+ result = list_org_files()
38
+ assert "test1.org" in result
39
+ assert "test2.org" in result
40
+ assert "subdir/test3.org" in result
41
+
42
+
43
+ def test_list_org_files_tool():
44
+ """Test list_org_files_tool function."""
45
+ with tempfile.TemporaryDirectory() as temp_dir:
46
+ # Create some test org files
47
+ (pathlib.Path(temp_dir) / "test1.org").touch()
48
+
49
+ with mock.patch("org_mcp.server.get_org_dir", return_value=temp_dir):
50
+ result = list_org_files_tool()
51
+ assert len(result) == 1
52
+ assert result[0]["path"] == "test1.org"
53
+ assert result[0]["full_path"] == str(pathlib.Path(temp_dir) / "test1.org")
54
+
55
+
56
+ def test_read_org_file():
57
+ """Test read_org_file function."""
58
+ with tempfile.TemporaryDirectory() as temp_dir:
59
+ # Create a test org file with content
60
+ test_file = pathlib.Path(temp_dir) / "test.org"
61
+ test_file.write_text("* Test Heading\nTest content")
62
+
63
+ with mock.patch("org_mcp.server.get_org_dir", return_value=temp_dir):
64
+ result = read_org_file("test.org")
65
+ assert "* Test Heading" in result
66
+ assert "Test content" in result