taut-mcp 0.7.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.
@@ -0,0 +1,25 @@
1
+ .DS_Store
2
+ .ruff_cache/
3
+ .mypy_cache/
4
+ .pytest_cache/
5
+ .hypothesis/
6
+ .coverage
7
+ .coverage.*
8
+ coverage.xml
9
+ htmlcov/
10
+ dist/
11
+ build/
12
+ *.egg-info/
13
+ __pycache__/
14
+ *.py[cod]
15
+ .venv/
16
+ .taut.db
17
+ .taut.db.lock
18
+ .taut.lock
19
+ .taut.db-wal
20
+ .taut.db-shm
21
+ .envrc
22
+ .taut.toml
23
+ .weft
24
+ .broker*
25
+ extensions/taut_pg/uv.lock
taut_mcp-0.7.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Van Lindberg
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.4
2
+ Name: taut-mcp
3
+ Version: 0.7.0
4
+ Summary: MCP extension for attaching agent sessions to Taut workspaces
5
+ Author-email: Van Lindberg <van.lindberg@gmail.com>
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.11
9
+ Requires-Dist: mcp<2,>=1.28.1
10
+ Requires-Dist: taut>=0.7.0
11
+ Provides-Extra: dev
12
+ Requires-Dist: build>=1.2; extra == 'dev'
13
+ Requires-Dist: mypy>=1.0; extra == 'dev'
14
+ Requires-Dist: pytest-timeout>=2.4.0; extra == 'dev'
15
+ Requires-Dist: pytest-xdist>=3.0; extra == 'dev'
16
+ Requires-Dist: pytest>=7.0; extra == 'dev'
17
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
18
+ Requires-Dist: taut-pg>=0.7.0; extra == 'dev'
19
+ Requires-Dist: types-jsonschema>=4.0; extra == 'dev'
20
+ Description-Content-Type: text/markdown
21
+
22
+ # Taut MCP
23
+
24
+ `taut-mcp` is the optional, connection-scoped MCP adapter for Taut. A client
25
+ launches one protocol-clean stdio process and explicitly attaches up to eight
26
+ existing Taut workspaces with their existing continuity tokens. The process is
27
+ not a daemon and retains no attachment state after disconnect.
28
+
29
+ The version-1 surface is specified in `docs/specs/05-taut-mcp.md`. It exposes
30
+ 15 explicit tools plus the read-only `taut://notifications/current` resource.
31
+ The resource reports notification pointers, not every unread chat message, and
32
+ does not claim notifications or advance read cursors.
33
+
34
+ The repository has a GitHub-only release path for this package, but configuring
35
+ that path does not publish a release. After the matching core tag and MCP wheel
36
+ exist, install both into one environment:
37
+
38
+ ```bash
39
+ pipx install "git+https://github.com/VanL/taut.git@v0.7.0"
40
+ pipx inject --include-apps taut ./taut_mcp-0.7.0-py3-none-any.whl
41
+ taut-mcp
42
+ ```
43
+
44
+ From this checkout, use its package-local environment:
45
+
46
+ ```bash
47
+ uv sync --directory extensions/taut_mcp --extra dev
48
+ uv run --directory extensions/taut_mcp taut-mcp
49
+ ```
50
+
51
+ Workspace attachment tokens are sensitive MCP tool inputs. Supply a token only
52
+ to `attach_workspace`; do not repeat it in chat, logs, or ordinary tool calls.
53
+ The opt-in `--claude-channel` flag advertises Claude's experimental channel
54
+ capability and sends only a fixed cue to reread the notification resource when
55
+ its content changes. Channel hints are best-effort and host-specific. Standard
56
+ tools, manual resource reads, and resource update subscriptions remain the
57
+ portable interface and the source of truth.
@@ -0,0 +1,36 @@
1
+ # Taut MCP
2
+
3
+ `taut-mcp` is the optional, connection-scoped MCP adapter for Taut. A client
4
+ launches one protocol-clean stdio process and explicitly attaches up to eight
5
+ existing Taut workspaces with their existing continuity tokens. The process is
6
+ not a daemon and retains no attachment state after disconnect.
7
+
8
+ The version-1 surface is specified in `docs/specs/05-taut-mcp.md`. It exposes
9
+ 15 explicit tools plus the read-only `taut://notifications/current` resource.
10
+ The resource reports notification pointers, not every unread chat message, and
11
+ does not claim notifications or advance read cursors.
12
+
13
+ The repository has a GitHub-only release path for this package, but configuring
14
+ that path does not publish a release. After the matching core tag and MCP wheel
15
+ exist, install both into one environment:
16
+
17
+ ```bash
18
+ pipx install "git+https://github.com/VanL/taut.git@v0.7.0"
19
+ pipx inject --include-apps taut ./taut_mcp-0.7.0-py3-none-any.whl
20
+ taut-mcp
21
+ ```
22
+
23
+ From this checkout, use its package-local environment:
24
+
25
+ ```bash
26
+ uv sync --directory extensions/taut_mcp --extra dev
27
+ uv run --directory extensions/taut_mcp taut-mcp
28
+ ```
29
+
30
+ Workspace attachment tokens are sensitive MCP tool inputs. Supply a token only
31
+ to `attach_workspace`; do not repeat it in chat, logs, or ordinary tool calls.
32
+ The opt-in `--claude-channel` flag advertises Claude's experimental channel
33
+ capability and sends only a fixed cue to reread the notification resource when
34
+ its content changes. Channel hints are best-effort and host-specific. Standard
35
+ tools, manual resource reads, and resource update subscriptions remain the
36
+ portable interface and the source of truth.
@@ -0,0 +1,79 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "taut-mcp"
7
+ version = "0.7.0"
8
+ description = "MCP extension for attaching agent sessions to Taut workspaces"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {text = "MIT"}
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ {name = "Van Lindberg", email = "van.lindberg@gmail.com"},
15
+ ]
16
+ dependencies = [
17
+ "mcp>=1.28.1,<2",
18
+ "taut>=0.7.0",
19
+ ]
20
+
21
+ [project.scripts]
22
+ taut-mcp = "taut_mcp.cli:main"
23
+
24
+ [project.optional-dependencies]
25
+ dev = [
26
+ "build>=1.2",
27
+ "mypy>=1.0",
28
+ "pytest>=7.0",
29
+ "pytest-timeout>=2.4.0",
30
+ "pytest-xdist>=3.0",
31
+ "ruff>=0.1.0",
32
+ "taut-pg>=0.7.0",
33
+ "types-jsonschema>=4.0",
34
+ ]
35
+
36
+ [tool.uv.sources]
37
+ taut = { path = "../..", editable = true }
38
+ taut-pg = { path = "../taut_pg", editable = true }
39
+
40
+ [tool.hatch.build]
41
+ include = [
42
+ "/taut_mcp/**/*.py",
43
+ "/taut_mcp/py.typed",
44
+ "/README.md",
45
+ "/LICENSE",
46
+ ]
47
+
48
+ [tool.pytest.ini_options]
49
+ minversion = "7.0"
50
+ testpaths = ["tests"]
51
+ addopts = "-ra -q --strict-markers -n auto --dist loadgroup"
52
+ markers = [
53
+ "installed_wheel: tests that build and run isolated installed artifacts",
54
+ "pg_only: tests that validate the Postgres extension package",
55
+ "sqlite_only: tests that validate built-in SQLite/path behavior",
56
+ ]
57
+
58
+ [tool.mypy]
59
+ python_version = "3.11"
60
+ no_namespace_packages = true
61
+ warn_return_any = true
62
+ warn_unused_configs = true
63
+ disallow_untyped_defs = true
64
+ disallow_incomplete_defs = true
65
+ check_untyped_defs = true
66
+ no_implicit_optional = true
67
+ warn_redundant_casts = true
68
+ warn_unused_ignores = true
69
+
70
+ [tool.ruff]
71
+ target-version = "py311"
72
+ line-length = 88
73
+
74
+ [tool.ruff.lint]
75
+ select = ["E", "W", "F", "I", "B", "C4", "UP"]
76
+ ignore = ["E501", "B008"]
77
+
78
+ [tool.ruff.lint.isort]
79
+ known-first-party = ["taut", "taut_mcp"]
@@ -0,0 +1,5 @@
1
+ """Public Taut MCP extension package."""
2
+
3
+ from __future__ import annotations
4
+
5
+ __all__: list[str] = []
@@ -0,0 +1,7 @@
1
+ """Run ``python -m taut_mcp``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .cli import main
6
+
7
+ main()
@@ -0,0 +1,40 @@
1
+ """Isolated research-preview Claude channel notification adapter."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Literal, cast
6
+
7
+ from mcp import types
8
+ from mcp.server.session import ServerSession
9
+
10
+ CLAUDE_CHANNEL_METHOD: Literal["notifications/claude/channel"] = (
11
+ "notifications/claude/channel"
12
+ )
13
+ CLAUDE_CHANNEL_CUE = "Taut notifications changed; read taut://notifications/current."
14
+
15
+
16
+ class ClaudeChannelParams(types.NotificationParams):
17
+ """The fixed, metadata-free channel payload."""
18
+
19
+ content: str
20
+
21
+
22
+ class ClaudeChannelNotification(
23
+ types.Notification[
24
+ ClaudeChannelParams,
25
+ Literal["notifications/claude/channel"],
26
+ ]
27
+ ):
28
+ """Experimental notification shape understood by capable Claude hosts."""
29
+
30
+ method: Literal["notifications/claude/channel"] = CLAUDE_CHANNEL_METHOD
31
+ params: ClaudeChannelParams
32
+
33
+
34
+ async def send_claude_channel(session: ServerSession) -> None:
35
+ """Send one fixed best-effort wake through the public SDK session API."""
36
+
37
+ notification = ClaudeChannelNotification(
38
+ params=ClaudeChannelParams(content=CLAUDE_CHANNEL_CUE)
39
+ )
40
+ await session.send_notification(cast(types.ServerNotification, notification))
@@ -0,0 +1,177 @@
1
+ """Explicit public-API dispatch for the twelve CLI-shaped MCP tools."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+ from typing import TypeAlias
7
+
8
+ from taut import Member, Message, Notification, TautClient, Thread
9
+
10
+ CommandScalar: TypeAlias = str | int | bool | None
11
+ CommandArguments: TypeAlias = tuple[tuple[str, CommandScalar], ...]
12
+ CommandRecord: TypeAlias = Message | Notification | Member | Thread
13
+
14
+ RECORD_TYPE_BY_TOOL = {
15
+ "join": "message",
16
+ "leave": "message",
17
+ "set_name": "member",
18
+ "say": "message",
19
+ "reply": "message",
20
+ "read": "message",
21
+ "inbox": "notification",
22
+ "log": "message",
23
+ "list": "thread",
24
+ "rename": "thread",
25
+ "who": "member",
26
+ "whoami": "member",
27
+ }
28
+
29
+
30
+ @dataclass(frozen=True, slots=True)
31
+ class CommandRecords:
32
+ record_type: str
33
+ records: tuple[CommandRecord, ...]
34
+
35
+
36
+ def _required_string(arguments: dict[str, CommandScalar], name: str) -> str:
37
+ value = arguments.get(name)
38
+ if not isinstance(value, str):
39
+ raise TypeError(f"{name} must be a string")
40
+ return value
41
+
42
+
43
+ def _optional_string(arguments: dict[str, CommandScalar], name: str) -> str | None:
44
+ value = arguments.get(name)
45
+ if value is not None and not isinstance(value, str):
46
+ raise TypeError(f"{name} must be a string or null")
47
+ return value
48
+
49
+
50
+ def _integer(arguments: dict[str, CommandScalar], name: str, default: int) -> int:
51
+ value = arguments.get(name, default)
52
+ if isinstance(value, bool) or not isinstance(value, int):
53
+ raise TypeError(f"{name} must be an integer")
54
+ return value
55
+
56
+
57
+ def execute_command(
58
+ client: TautClient,
59
+ name: str,
60
+ frozen_arguments: CommandArguments,
61
+ ) -> CommandRecords:
62
+ """Run exactly one allowlisted public client operation."""
63
+
64
+ arguments = dict(frozen_arguments)
65
+ if name == "join":
66
+ record = client.join(
67
+ _required_string(arguments, "thread"),
68
+ persona=_optional_string(arguments, "persona"),
69
+ new=False,
70
+ )
71
+ records: tuple[CommandRecord, ...] = (record,)
72
+ elif name == "leave":
73
+ records = (client.leave(_required_string(arguments, "thread")),)
74
+ elif name == "set_name":
75
+ records = (client.set_name(_required_string(arguments, "name")),)
76
+ elif name == "say":
77
+ records = (
78
+ client.say(
79
+ _required_string(arguments, "target"),
80
+ _required_string(arguments, "text"),
81
+ ),
82
+ )
83
+ elif name == "reply":
84
+ records = (
85
+ client.reply(
86
+ _required_string(arguments, "thread"),
87
+ _required_string(arguments, "msg_id"),
88
+ _required_string(arguments, "text"),
89
+ ),
90
+ )
91
+ elif name == "read":
92
+ records = tuple(
93
+ client.read(
94
+ _optional_string(arguments, "thread"),
95
+ limit=_integer(arguments, "limit", 100),
96
+ )
97
+ )
98
+ elif name == "inbox":
99
+ records = tuple(client.inbox(limit=_integer(arguments, "limit", 1000)))
100
+ elif name == "log":
101
+ since = arguments.get("since")
102
+ if since is not None and (
103
+ isinstance(since, bool) or not isinstance(since, (str, int))
104
+ ):
105
+ raise TypeError("since must be a string, integer, or null")
106
+ records = tuple(
107
+ client.log(
108
+ _required_string(arguments, "thread"),
109
+ since=since,
110
+ limit=_integer(arguments, "limit", 100),
111
+ )
112
+ )
113
+ elif name == "list":
114
+ all_threads = arguments.get("all", False)
115
+ if not isinstance(all_threads, bool):
116
+ raise TypeError("all must be a boolean")
117
+ records = tuple(client.list_threads(all_threads=all_threads))
118
+ elif name == "rename":
119
+ records = (
120
+ client.rename_channel(
121
+ _required_string(arguments, "old_name"),
122
+ _required_string(arguments, "new_name"),
123
+ ),
124
+ )
125
+ elif name == "who":
126
+ records = tuple(client.who(_optional_string(arguments, "thread")))
127
+ elif name == "whoami":
128
+ records = (client.whoami(explain=False),)
129
+ else:
130
+ raise AssertionError(f"unregistered child command: {name}")
131
+ return CommandRecords(RECORD_TYPE_BY_TOOL[name], records)
132
+
133
+
134
+ def record_object(record: CommandRecord) -> dict[str, object]:
135
+ """Encode one public value object without importing CLI rendering."""
136
+
137
+ if isinstance(record, Message):
138
+ return {
139
+ "from": record.from_name,
140
+ "from_id": record.from_id,
141
+ "kind": record.kind,
142
+ "text": record.text,
143
+ "thread": record.thread,
144
+ "ts": record.ts,
145
+ }
146
+ if isinstance(record, Notification):
147
+ notification: dict[str, object] = {
148
+ "actor_id": record.actor_id,
149
+ "actor_name": record.actor_name,
150
+ "message_ts": record.message_ts,
151
+ "thread": record.thread,
152
+ "to_id": record.to_id,
153
+ "type": record.type,
154
+ }
155
+ if record.matched is not None:
156
+ notification["matched"] = record.matched
157
+ return notification
158
+ if isinstance(record, Member):
159
+ return {
160
+ "aliases": list(record.aliases),
161
+ "kind": record.kind,
162
+ "last_active_ts": record.last_active_ts,
163
+ "member_id": record.member_id,
164
+ "name": record.name,
165
+ "persona": record.persona,
166
+ "presence": record.presence,
167
+ }
168
+ thread: dict[str, object] = {
169
+ "kind": record.kind,
170
+ "last_ts": record.last_ts,
171
+ "parent": record.parent,
172
+ "thread": record.name,
173
+ "unread": record.unread,
174
+ }
175
+ if record.kind == "dm":
176
+ thread["members"] = list(record.members)
177
+ return thread