Skip to content

Commit cab2190

Browse files
committed
mcp(feat[foundation]): Add MCP server foundation with FastMCP
why: AI agents need programmatic tmux control via MCP protocol. what: - Add fastmcp optional dependency in pyproject.toml - Add libtmux-mcp entry point script - Create _utils.py with server caching, object resolvers, serializers, and @handle_tool_errors decorator - Create server.py with FastMCP instance and registration - Add __init__.py and __main__.py entry points
1 parent 78b96c0 commit cab2190

6 files changed

Lines changed: 1471 additions & 1 deletion

File tree

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ lint = [
112112
"mypy",
113113
]
114114

115+
[project.optional-dependencies]
116+
mcp = [
117+
"fastmcp>=2.3.0; python_version >= '3.10'",
118+
]
119+
120+
[project.scripts]
121+
libtmux-mcp = "libtmux.mcp:main"
122+
115123
[project.entry-points.pytest11]
116124
libtmux = "libtmux.pytest_plugin"
117125

src/libtmux/mcp/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""libtmux MCP server - programmatic tmux control for AI agents."""
2+
3+
from __future__ import annotations
4+
5+
6+
def main() -> None:
7+
"""Entry point for the libtmux MCP server."""
8+
from libtmux.mcp.server import run_server
9+
10+
run_server()

src/libtmux/mcp/__main__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""Support ``python -m libtmux.mcp``."""
2+
3+
from __future__ import annotations
4+
5+
from libtmux.mcp import main
6+
7+
main()

0 commit comments

Comments
 (0)