talksign-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.
- talksign_mcp-0.1.0/.gitignore +9 -0
- talksign_mcp-0.1.0/CHANGELOG.md +6 -0
- talksign_mcp-0.1.0/LICENSE +191 -0
- talksign_mcp-0.1.0/PKG-INFO +148 -0
- talksign_mcp-0.1.0/README.md +116 -0
- talksign_mcp-0.1.0/pyproject.toml +56 -0
- talksign_mcp-0.1.0/server.json +19 -0
- talksign_mcp-0.1.0/src/talksign_mcp/__init__.py +6 -0
- talksign_mcp-0.1.0/src/talksign_mcp/__main__.py +3 -0
- talksign_mcp-0.1.0/src/talksign_mcp/_version.py +1 -0
- talksign_mcp-0.1.0/src/talksign_mcp/server.py +333 -0
- talksign_mcp-0.1.0/tests/test_server.py +273 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2026 Talksign
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: talksign-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for the Talksign API: let Claude, ChatGPT, Cursor and other AI assistants turn text into sign language video.
|
|
5
|
+
Project-URL: Homepage, https://talksign.co
|
|
6
|
+
Project-URL: Documentation, https://github.com/talksign/talksign-mcp#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/talksign/talksign-mcp
|
|
8
|
+
Project-URL: Issues, https://github.com/talksign/talksign-mcp/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/talksign/talksign-mcp/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Talksign
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: accessibility,asl,claude,cursor,mcp,model context protocol,sign language,talksign
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: mcp<3,>=2.3
|
|
25
|
+
Requires-Dist: talksign<0.3,>=0.2.1
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
29
|
+
Requires-Dist: respx>=0.21; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# Talksign MCP server
|
|
34
|
+
|
|
35
|
+
[](https://pypi.org/project/talksign-mcp/)
|
|
36
|
+
|
|
37
|
+
Give Claude, ChatGPT, Cursor, VS Code and any other [MCP](https://modelcontextprotocol.io) client
|
|
38
|
+
sign language superpowers: turn text into sign language video with a photorealistic signing avatar,
|
|
39
|
+
make a person in a photo sign, or bring a live AI sign language interpreter into a meeting.
|
|
40
|
+
|
|
41
|
+
Built on the [Talksign API](https://developer.talksign.co) and the
|
|
42
|
+
[Talksign Python SDK](https://github.com/talksign/talksign-python).
|
|
43
|
+
|
|
44
|
+
## Tools
|
|
45
|
+
|
|
46
|
+
| Tool | What it does | Price |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `text_to_sign` | Text → playlist of short signed clips (Echo 2.0), fast enough for live use | Speech→Sign rate (a few cents per sentence) |
|
|
49
|
+
| `render_sign_video` | Text → one downloadable MP4 of the avatar signing | ~$1.32 per minute of video |
|
|
50
|
+
| `text_to_gloss` | Text → sign language gloss (signs in signing order) | fractions of a cent |
|
|
51
|
+
| `morph_video` | Make the person in a photo (or a preset avatar) perform a signing video | $0.055/s (480p), $0.11/s (720p), 10 s min |
|
|
52
|
+
| `send_interpreter_to_meeting` | AI interpreter joins Google Meet, Zoom or Teams and signs what is said | ~$0.40 per minute |
|
|
53
|
+
| `get_meeting`, `stop_meeting` | Meeting interpreter status / make it leave | free |
|
|
54
|
+
| `get_job`, `cancel_job` | Status and result of a render; cancel (not charged) | free |
|
|
55
|
+
| `list_avatars` | Avatars you can use | free |
|
|
56
|
+
| `get_balance` | Your prepaid API balance | free |
|
|
57
|
+
|
|
58
|
+
Free tools are marked read-only, so clients can run them without asking. Morph needs `consent=true`
|
|
59
|
+
(you confirm you have the rights to the photo and video and the consent of every person in them) and the
|
|
60
|
+
meeting interpreter needs `disclosure_accepted=true` (participants are told an AI interpreter is present).
|
|
61
|
+
Morph output carries a machine-readable "AI-generated" label.
|
|
62
|
+
|
|
63
|
+
## Get an API key
|
|
64
|
+
|
|
65
|
+
Create a key at **https://developer.talksign.co** and add API credit.
|
|
66
|
+
|
|
67
|
+
## Install
|
|
68
|
+
|
|
69
|
+
You need [uv](https://docs.astral.sh/uv/) (`uvx`) or Python 3.10+.
|
|
70
|
+
|
|
71
|
+
### Claude Desktop
|
|
72
|
+
|
|
73
|
+
Settings → Developer → Edit config, then add:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"mcpServers": {
|
|
78
|
+
"talksign": {
|
|
79
|
+
"command": "uvx",
|
|
80
|
+
"args": ["talksign-mcp"],
|
|
81
|
+
"env": { "TALKSIGN_API_KEY": "ts_live_..." }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Claude Code
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
claude mcp add talksign --env TALKSIGN_API_KEY=ts_live_... -- uvx talksign-mcp
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Cursor
|
|
94
|
+
|
|
95
|
+
`~/.cursor/mcp.json` (or `.cursor/mcp.json` in a project): same block as Claude Desktop.
|
|
96
|
+
|
|
97
|
+
### VS Code
|
|
98
|
+
|
|
99
|
+
`.vscode/mcp.json`:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"servers": {
|
|
104
|
+
"talksign": {
|
|
105
|
+
"command": "uvx",
|
|
106
|
+
"args": ["talksign-mcp"],
|
|
107
|
+
"env": { "TALKSIGN_API_KEY": "ts_live_..." }
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Without uv
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pip install talksign-mcp
|
|
117
|
+
TALKSIGN_API_KEY=ts_live_... talksign-mcp
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Try it
|
|
121
|
+
|
|
122
|
+
> "Show me how to sign 'Nice to meet you' in ASL."
|
|
123
|
+
>
|
|
124
|
+
> "Make an ASL video of this paragraph and give me the link."
|
|
125
|
+
>
|
|
126
|
+
> "Send a sign language interpreter to https://meet.google.com/abc-defg-hij. Everyone knows it's an AI."
|
|
127
|
+
|
|
128
|
+
## Configuration
|
|
129
|
+
|
|
130
|
+
| Variable | Default | |
|
|
131
|
+
|---|---|---|
|
|
132
|
+
| `TALKSIGN_API_KEY` | (required) | Your API key |
|
|
133
|
+
| `TALKSIGN_BASE_URL` | `https://api.talksign.co` | Override the API URL |
|
|
134
|
+
|
|
135
|
+
`talksign-mcp --transport streamable-http` serves over HTTP instead of stdio.
|
|
136
|
+
|
|
137
|
+
## Development
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pip install -e ".[dev]"
|
|
141
|
+
pytest
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Tests run the real MCP protocol against a mocked API: no key, no network, nothing billed.
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
Apache-2.0
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Talksign MCP server
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/talksign-mcp/)
|
|
4
|
+
|
|
5
|
+
Give Claude, ChatGPT, Cursor, VS Code and any other [MCP](https://modelcontextprotocol.io) client
|
|
6
|
+
sign language superpowers: turn text into sign language video with a photorealistic signing avatar,
|
|
7
|
+
make a person in a photo sign, or bring a live AI sign language interpreter into a meeting.
|
|
8
|
+
|
|
9
|
+
Built on the [Talksign API](https://developer.talksign.co) and the
|
|
10
|
+
[Talksign Python SDK](https://github.com/talksign/talksign-python).
|
|
11
|
+
|
|
12
|
+
## Tools
|
|
13
|
+
|
|
14
|
+
| Tool | What it does | Price |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| `text_to_sign` | Text → playlist of short signed clips (Echo 2.0), fast enough for live use | Speech→Sign rate (a few cents per sentence) |
|
|
17
|
+
| `render_sign_video` | Text → one downloadable MP4 of the avatar signing | ~$1.32 per minute of video |
|
|
18
|
+
| `text_to_gloss` | Text → sign language gloss (signs in signing order) | fractions of a cent |
|
|
19
|
+
| `morph_video` | Make the person in a photo (or a preset avatar) perform a signing video | $0.055/s (480p), $0.11/s (720p), 10 s min |
|
|
20
|
+
| `send_interpreter_to_meeting` | AI interpreter joins Google Meet, Zoom or Teams and signs what is said | ~$0.40 per minute |
|
|
21
|
+
| `get_meeting`, `stop_meeting` | Meeting interpreter status / make it leave | free |
|
|
22
|
+
| `get_job`, `cancel_job` | Status and result of a render; cancel (not charged) | free |
|
|
23
|
+
| `list_avatars` | Avatars you can use | free |
|
|
24
|
+
| `get_balance` | Your prepaid API balance | free |
|
|
25
|
+
|
|
26
|
+
Free tools are marked read-only, so clients can run them without asking. Morph needs `consent=true`
|
|
27
|
+
(you confirm you have the rights to the photo and video and the consent of every person in them) and the
|
|
28
|
+
meeting interpreter needs `disclosure_accepted=true` (participants are told an AI interpreter is present).
|
|
29
|
+
Morph output carries a machine-readable "AI-generated" label.
|
|
30
|
+
|
|
31
|
+
## Get an API key
|
|
32
|
+
|
|
33
|
+
Create a key at **https://developer.talksign.co** and add API credit.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
You need [uv](https://docs.astral.sh/uv/) (`uvx`) or Python 3.10+.
|
|
38
|
+
|
|
39
|
+
### Claude Desktop
|
|
40
|
+
|
|
41
|
+
Settings → Developer → Edit config, then add:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"talksign": {
|
|
47
|
+
"command": "uvx",
|
|
48
|
+
"args": ["talksign-mcp"],
|
|
49
|
+
"env": { "TALKSIGN_API_KEY": "ts_live_..." }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Claude Code
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
claude mcp add talksign --env TALKSIGN_API_KEY=ts_live_... -- uvx talksign-mcp
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Cursor
|
|
62
|
+
|
|
63
|
+
`~/.cursor/mcp.json` (or `.cursor/mcp.json` in a project): same block as Claude Desktop.
|
|
64
|
+
|
|
65
|
+
### VS Code
|
|
66
|
+
|
|
67
|
+
`.vscode/mcp.json`:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"servers": {
|
|
72
|
+
"talksign": {
|
|
73
|
+
"command": "uvx",
|
|
74
|
+
"args": ["talksign-mcp"],
|
|
75
|
+
"env": { "TALKSIGN_API_KEY": "ts_live_..." }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Without uv
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install talksign-mcp
|
|
85
|
+
TALKSIGN_API_KEY=ts_live_... talksign-mcp
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Try it
|
|
89
|
+
|
|
90
|
+
> "Show me how to sign 'Nice to meet you' in ASL."
|
|
91
|
+
>
|
|
92
|
+
> "Make an ASL video of this paragraph and give me the link."
|
|
93
|
+
>
|
|
94
|
+
> "Send a sign language interpreter to https://meet.google.com/abc-defg-hij. Everyone knows it's an AI."
|
|
95
|
+
|
|
96
|
+
## Configuration
|
|
97
|
+
|
|
98
|
+
| Variable | Default | |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| `TALKSIGN_API_KEY` | (required) | Your API key |
|
|
101
|
+
| `TALKSIGN_BASE_URL` | `https://api.talksign.co` | Override the API URL |
|
|
102
|
+
|
|
103
|
+
`talksign-mcp --transport streamable-http` serves over HTTP instead of stdio.
|
|
104
|
+
|
|
105
|
+
## Development
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pip install -e ".[dev]"
|
|
109
|
+
pytest
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Tests run the real MCP protocol against a mocked API: no key, no network, nothing billed.
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
Apache-2.0
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.21"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "talksign-mcp"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "MCP server for the Talksign API: let Claude, ChatGPT, Cursor and other AI assistants turn text into sign language video."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
authors = [{ name = "Talksign" }]
|
|
14
|
+
keywords = ["mcp", "model context protocol", "talksign", "sign language", "asl", "accessibility", "claude", "cursor"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: Apache Software License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
]
|
|
26
|
+
dependencies = ["mcp>=2.3,<3", "talksign>=0.2.1,<0.3"]
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
dev = ["pytest>=8", "pytest-asyncio>=0.23", "respx>=0.21", "ruff>=0.6"]
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
talksign-mcp = "talksign_mcp.server:main"
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://talksign.co"
|
|
36
|
+
Documentation = "https://github.com/talksign/talksign-mcp#readme"
|
|
37
|
+
Repository = "https://github.com/talksign/talksign-mcp"
|
|
38
|
+
Issues = "https://github.com/talksign/talksign-mcp/issues"
|
|
39
|
+
Changelog = "https://github.com/talksign/talksign-mcp/blob/main/CHANGELOG.md"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.version]
|
|
42
|
+
path = "src/talksign_mcp/_version.py"
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.wheel]
|
|
45
|
+
packages = ["src/talksign_mcp"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
asyncio_mode = "auto"
|
|
49
|
+
testpaths = ["tests"]
|
|
50
|
+
|
|
51
|
+
[tool.ruff]
|
|
52
|
+
line-length = 120
|
|
53
|
+
target-version = "py310"
|
|
54
|
+
|
|
55
|
+
[tool.ruff.lint]
|
|
56
|
+
select = ["E", "F", "I", "B", "UP"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.talksign/talksign-mcp",
|
|
4
|
+
"title": "Talksign",
|
|
5
|
+
"description": "Sign language video for AI assistants: text to sign, Morph, live meeting interpreter.",
|
|
6
|
+
"repository": { "url": "https://github.com/talksign/talksign-mcp", "source": "github" },
|
|
7
|
+
"version": "0.1.0",
|
|
8
|
+
"packages": [
|
|
9
|
+
{
|
|
10
|
+
"registryType": "pypi",
|
|
11
|
+
"identifier": "talksign-mcp",
|
|
12
|
+
"version": "0.1.0",
|
|
13
|
+
"transport": { "type": "stdio" },
|
|
14
|
+
"environmentVariables": [
|
|
15
|
+
{ "name": "TALKSIGN_API_KEY", "description": "Your Talksign API key (developer.talksign.co)", "isRequired": true, "isSecret": true }
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
"""Talksign MCP server.
|
|
2
|
+
|
|
3
|
+
Gives AI assistants (Claude, ChatGPT, Cursor, VS Code, agent frameworks) tools for the Talksign API:
|
|
4
|
+
text to sign language video (Echo 2.0), sign language gloss, Morph (animate a person with a signing
|
|
5
|
+
video), a live sign language interpreter in video meetings, avatars, jobs and balance.
|
|
6
|
+
|
|
7
|
+
Run: ``TALKSIGN_API_KEY=ts_live_... talksign-mcp`` (stdio). Paid tools say their price in their description;
|
|
8
|
+
the free ones are marked read-only.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import argparse
|
|
14
|
+
import logging
|
|
15
|
+
import os
|
|
16
|
+
from collections.abc import Callable
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from typing import Any, Literal
|
|
19
|
+
|
|
20
|
+
from mcp.server.mcpserver import MCPServer
|
|
21
|
+
from mcp.server.mcpserver.exceptions import ToolError
|
|
22
|
+
from mcp.types import ToolAnnotations
|
|
23
|
+
from talksign import AsyncTalksign, TalksignError
|
|
24
|
+
|
|
25
|
+
from ._version import __version__
|
|
26
|
+
|
|
27
|
+
INSTRUCTIONS = """Talksign turns text into sign language video with a photorealistic signing avatar.
|
|
28
|
+
- To show signing for some text: call text_to_sign (fast, a playlist of short clips) or render_sign_video
|
|
29
|
+
(one MP4 file to download or share). Both cost a few cents; tell the user before large requests.
|
|
30
|
+
- To make a person in a photo sign: call morph_video with a short signing video and the photo. It needs the
|
|
31
|
+
user's explicit confirmation that they have the rights and consent of every person shown.
|
|
32
|
+
- To bring a live sign language interpreter into a Google Meet / Zoom / Teams call: send_interpreter_to_meeting.
|
|
33
|
+
- Long work returns a job id: poll get_job until status is succeeded, failed or canceled.
|
|
34
|
+
- list_avatars, get_balance, get_job and get_meeting are free."""
|
|
35
|
+
|
|
36
|
+
LANGUAGES = "Sign language code, e.g. 'asl' (American), 'bsl' (British). Default: 'asl'."
|
|
37
|
+
AVATAR = "Avatar id from list_avatars, e.g. 'arthur'. Default: the account's default avatar."
|
|
38
|
+
READ_ONLY = ToolAnnotations(readOnlyHint=True, openWorldHint=True)
|
|
39
|
+
PAID = ToolAnnotations(readOnlyHint=False, destructiveHint=False, idempotentHint=False, openWorldHint=True)
|
|
40
|
+
MAX_TEXT = 5000
|
|
41
|
+
|
|
42
|
+
ClientFactory = Callable[[], AsyncTalksign]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _client_factory() -> AsyncTalksign:
|
|
46
|
+
if not os.environ.get("TALKSIGN_API_KEY"):
|
|
47
|
+
raise ToolError(
|
|
48
|
+
"No Talksign API key. Create one at https://developer.talksign.co and set TALKSIGN_API_KEY "
|
|
49
|
+
"in this MCP server's configuration."
|
|
50
|
+
)
|
|
51
|
+
return make_client()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def make_client(**kwargs: Any) -> AsyncTalksign:
|
|
55
|
+
"""Async SDK client that identifies itself as talksign-mcp. Key/URL default to TALKSIGN_API_KEY/_BASE_URL."""
|
|
56
|
+
headers = {"X-Talksign-Client": f"talksign-mcp/{__version__}", **kwargs.pop("default_headers", {})}
|
|
57
|
+
return AsyncTalksign(default_headers=headers, **kwargs)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _fail(e: TalksignError) -> ToolError:
|
|
61
|
+
msg = str(e)
|
|
62
|
+
code = getattr(e, "code", None)
|
|
63
|
+
rid = getattr(e, "request_id", None)
|
|
64
|
+
if rid and rid not in msg:
|
|
65
|
+
msg += f" (request_id={rid})"
|
|
66
|
+
return ToolError(f"Talksign API error{f' ({code})' if code else ''}: {msg}")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _text(text: str) -> str:
|
|
70
|
+
t = (text or "").strip()
|
|
71
|
+
if not t:
|
|
72
|
+
raise ToolError("text is empty.")
|
|
73
|
+
if len(t) > MAX_TEXT:
|
|
74
|
+
raise ToolError(f"text is {len(t)} characters; the limit per call is {MAX_TEXT}. Split it.")
|
|
75
|
+
return t
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _file(path: str, what: str) -> Path:
|
|
79
|
+
p = Path(path).expanduser()
|
|
80
|
+
if not p.is_file():
|
|
81
|
+
raise ToolError(f"{what} file not found: {path}. Give a path to a local file on this computer.")
|
|
82
|
+
return p
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _cost(usage: dict[str, Any] | None) -> dict[str, Any]:
|
|
86
|
+
u = usage or {}
|
|
87
|
+
return {k: u[k] for k in ("costUsd", "walletRemainingUsd") if u.get(k) is not None}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _job(job: dict[str, Any]) -> dict[str, Any]:
|
|
91
|
+
out = {k: job.get(k) for k in ("id", "type", "status", "created_at", "finished_at")}
|
|
92
|
+
if job.get("result"):
|
|
93
|
+
out["result"] = {k: v for k, v in job["result"].items() if v is not None}
|
|
94
|
+
if job.get("error"):
|
|
95
|
+
out["error"] = job["error"]
|
|
96
|
+
if job.get("usage"):
|
|
97
|
+
out["usage"] = job["usage"]
|
|
98
|
+
return out
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def build_server(client_factory: ClientFactory = _client_factory) -> MCPServer:
|
|
102
|
+
"""The MCP server with every Talksign tool. ``client_factory`` is swappable for tests."""
|
|
103
|
+
mcp = MCPServer(
|
|
104
|
+
name="talksign",
|
|
105
|
+
title="Talksign",
|
|
106
|
+
description="Sign language video for AI assistants: text to sign (Echo 2.0), Morph, live meeting interpreter.",
|
|
107
|
+
instructions=INSTRUCTIONS,
|
|
108
|
+
website_url="https://talksign.co",
|
|
109
|
+
version=__version__,
|
|
110
|
+
)
|
|
111
|
+
holder: dict[str, AsyncTalksign] = {}
|
|
112
|
+
|
|
113
|
+
def client() -> AsyncTalksign:
|
|
114
|
+
if "c" not in holder:
|
|
115
|
+
holder["c"] = client_factory()
|
|
116
|
+
return holder["c"]
|
|
117
|
+
|
|
118
|
+
@mcp.tool(
|
|
119
|
+
title="Text to sign language (clips)",
|
|
120
|
+
annotations=PAID,
|
|
121
|
+
description="Translate text into sign language as a playlist of short signed video clips (Echo 2.0), "
|
|
122
|
+
"fast enough for live use. Costs the Speech-to-Sign rate (a few cents per sentence). Returns the "
|
|
123
|
+
"gloss (sign order) and clip URLs to play back to back; URLs expire (see expires_at).",
|
|
124
|
+
)
|
|
125
|
+
async def text_to_sign(text: str, language: str = "asl", avatar: str | None = None) -> dict[str, Any]:
|
|
126
|
+
try:
|
|
127
|
+
res = await client().speech_to_sign.realtime(_text(text), language=language, avatar=avatar)
|
|
128
|
+
except TalksignError as e:
|
|
129
|
+
raise _fail(e) from e
|
|
130
|
+
d = res.get("data", {})
|
|
131
|
+
clips = [{"gloss": c.get("gloss"), "url": c.get("url")} for c in d.get("playlist", []) if c.get("url")]
|
|
132
|
+
out = {
|
|
133
|
+
"language": d.get("language"),
|
|
134
|
+
"avatar": d.get("avatar"),
|
|
135
|
+
"glosses": d.get("glosses", []),
|
|
136
|
+
"clips": clips,
|
|
137
|
+
"expires_at": d.get("expires_at"),
|
|
138
|
+
"has_missing_signs": bool(d.get("has_missing")),
|
|
139
|
+
**_cost(res.get("usage")),
|
|
140
|
+
}
|
|
141
|
+
if d.get("notice"):
|
|
142
|
+
out["notice"] = d["notice"]
|
|
143
|
+
return out
|
|
144
|
+
|
|
145
|
+
@mcp.tool(
|
|
146
|
+
title="Render a sign language video (MP4)",
|
|
147
|
+
annotations=PAID,
|
|
148
|
+
description="Render text as ONE downloadable MP4 of the avatar signing it (Echo 2.0). Costs the Sign Video "
|
|
149
|
+
"rate (about $1.32 per minute of rendered video, minimum $0.01). Waits up to wait_seconds for the "
|
|
150
|
+
"video; if it is not ready by then, returns a job id to pass to get_job.",
|
|
151
|
+
)
|
|
152
|
+
async def render_sign_video(
|
|
153
|
+
text: str, language: str = "asl", avatar: str | None = None, wait_seconds: int = 90
|
|
154
|
+
) -> dict[str, Any]:
|
|
155
|
+
try:
|
|
156
|
+
job = await client().speech_to_sign.studio(_text(text), language=language, avatar=avatar, async_=True)
|
|
157
|
+
job_id = job.get("id")
|
|
158
|
+
if job_id and wait_seconds > 0:
|
|
159
|
+
try:
|
|
160
|
+
job = await client().jobs.wait(job_id, poll_interval=2.0, timeout=float(min(wait_seconds, 300)))
|
|
161
|
+
except TalksignError as e:
|
|
162
|
+
if getattr(e, "code", None) != "wait_timeout":
|
|
163
|
+
raise
|
|
164
|
+
except TalksignError as e:
|
|
165
|
+
raise _fail(e) from e
|
|
166
|
+
return _job(dict(job))
|
|
167
|
+
|
|
168
|
+
@mcp.tool(
|
|
169
|
+
title="Text to sign gloss",
|
|
170
|
+
annotations=PAID,
|
|
171
|
+
description="Return only the sign language gloss (the signs in signing order, e.g. 'TOMORROW STORE I GO') "
|
|
172
|
+
"for text, without video. Costs the Speech-to-Sign rate on the text length (fractions of a cent).",
|
|
173
|
+
)
|
|
174
|
+
async def text_to_gloss(text: str, language: str = "asl") -> dict[str, Any]:
|
|
175
|
+
try:
|
|
176
|
+
res = await client().speech_to_sign.gloss(_text(text), language=language)
|
|
177
|
+
except TalksignError as e:
|
|
178
|
+
raise _fail(e) from e
|
|
179
|
+
d = res.get("data", {})
|
|
180
|
+
return {
|
|
181
|
+
"gloss": d.get("gloss"),
|
|
182
|
+
"glosses": d.get("glosses", []),
|
|
183
|
+
"language": d.get("language"),
|
|
184
|
+
**_cost(res.get("usage")),
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@mcp.tool(
|
|
188
|
+
title="Morph: make a person sign",
|
|
189
|
+
annotations=PAID,
|
|
190
|
+
description="Animate the person in a photo (or a preset avatar) so they perform the signing in a short "
|
|
191
|
+
"video. Inputs are LOCAL file paths. Costs $0.055/s of output at 480p or $0.11/s at 720p, 10 s minimum. "
|
|
192
|
+
"consent MUST be true and only when the user has explicitly confirmed they have the rights to the photo "
|
|
193
|
+
"and video and the consent of every person in them; never assume it. Returns a job id; poll get_job. "
|
|
194
|
+
"Output carries a machine-readable AI-generated label.",
|
|
195
|
+
)
|
|
196
|
+
async def morph_video(
|
|
197
|
+
video_path: str,
|
|
198
|
+
consent: bool,
|
|
199
|
+
photo_path: str | None = None,
|
|
200
|
+
avatar: Literal["arthur", "amara", "daniel", "elena"] | None = None,
|
|
201
|
+
quality: Literal["480p", "720p"] = "480p",
|
|
202
|
+
) -> dict[str, Any]:
|
|
203
|
+
if consent is not True:
|
|
204
|
+
raise ToolError(
|
|
205
|
+
"consent is required: ask the user to confirm they have the rights to this photo and video and "
|
|
206
|
+
"the consent of every person in them, then call again with consent=true."
|
|
207
|
+
)
|
|
208
|
+
if bool(photo_path) == bool(avatar):
|
|
209
|
+
raise ToolError("Give exactly one of photo_path (a person's photo) or avatar (a preset avatar id).")
|
|
210
|
+
video = _file(video_path, "Video")
|
|
211
|
+
fields: dict[str, Any] = {"quality": quality, "consent": "true"}
|
|
212
|
+
photo = None
|
|
213
|
+
if photo_path:
|
|
214
|
+
photo = _file(photo_path, "Photo")
|
|
215
|
+
else:
|
|
216
|
+
fields["avatar"] = avatar
|
|
217
|
+
try:
|
|
218
|
+
job = await client().jobs.create("morph", video=video, photo=photo, **fields)
|
|
219
|
+
except TalksignError as e:
|
|
220
|
+
raise _fail(e) from e
|
|
221
|
+
return _job(dict(job))
|
|
222
|
+
|
|
223
|
+
@mcp.tool(
|
|
224
|
+
title="Get job status",
|
|
225
|
+
annotations=READ_ONLY,
|
|
226
|
+
description="Status and result of a job (sign video or Morph): queued, running, succeeded, failed or "
|
|
227
|
+
"canceled. On success the result has video_url / download_url. Free.",
|
|
228
|
+
)
|
|
229
|
+
async def get_job(job_id: str) -> dict[str, Any]:
|
|
230
|
+
try:
|
|
231
|
+
return _job(dict(await client().jobs.get(job_id)))
|
|
232
|
+
except TalksignError as e:
|
|
233
|
+
raise _fail(e) from e
|
|
234
|
+
|
|
235
|
+
@mcp.tool(
|
|
236
|
+
title="Cancel a job",
|
|
237
|
+
annotations=ToolAnnotations(readOnlyHint=False, destructiveHint=True, idempotentHint=True, openWorldHint=True),
|
|
238
|
+
description="Cancel a queued or running job. A canceled job is not charged. Free.",
|
|
239
|
+
)
|
|
240
|
+
async def cancel_job(job_id: str) -> dict[str, Any]:
|
|
241
|
+
try:
|
|
242
|
+
return _job(dict(await client().jobs.cancel(job_id)))
|
|
243
|
+
except TalksignError as e:
|
|
244
|
+
raise _fail(e) from e
|
|
245
|
+
|
|
246
|
+
@mcp.tool(
|
|
247
|
+
title="Send a sign language interpreter to a meeting",
|
|
248
|
+
annotations=PAID,
|
|
249
|
+
description="Send the Talksign AI interpreter into a Google Meet, Zoom or Microsoft Teams "
|
|
250
|
+
"call; once the host admits it, it signs what is said on its camera. Costs about $0.40 per "
|
|
251
|
+
"minute in the call. disclosure_accepted MUST be true only when the user confirms participants are "
|
|
252
|
+
"told an AI interpreter is in the call. Returns a meeting id for get_meeting / stop_meeting.",
|
|
253
|
+
)
|
|
254
|
+
async def send_interpreter_to_meeting(
|
|
255
|
+
meeting_url: str, disclosure_accepted: bool, avatar: str | None = None
|
|
256
|
+
) -> dict[str, Any]:
|
|
257
|
+
if disclosure_accepted is not True:
|
|
258
|
+
raise ToolError(
|
|
259
|
+
"disclosure_accepted is required: confirm with the user that meeting participants will be told an "
|
|
260
|
+
"AI interpreter is in the call, then call again with disclosure_accepted=true."
|
|
261
|
+
)
|
|
262
|
+
try:
|
|
263
|
+
return dict(await client().meetings.create(meeting_url, disclosure_accepted=True, avatar=avatar))
|
|
264
|
+
except TalksignError as e:
|
|
265
|
+
raise _fail(e) from e
|
|
266
|
+
|
|
267
|
+
@mcp.tool(
|
|
268
|
+
title="Get meeting interpreter status",
|
|
269
|
+
annotations=READ_ONLY,
|
|
270
|
+
description="Status of a meeting interpreter: requested, joining, waiting_room, live, ended, failed. Free.",
|
|
271
|
+
)
|
|
272
|
+
async def get_meeting(meeting_id: str) -> dict[str, Any]:
|
|
273
|
+
try:
|
|
274
|
+
return dict(await client().meetings.get(meeting_id))
|
|
275
|
+
except TalksignError as e:
|
|
276
|
+
raise _fail(e) from e
|
|
277
|
+
|
|
278
|
+
@mcp.tool(
|
|
279
|
+
title="Remove the interpreter from a meeting",
|
|
280
|
+
annotations=ToolAnnotations(readOnlyHint=False, destructiveHint=True, idempotentHint=True, openWorldHint=True),
|
|
281
|
+
description="Make the interpreter leave the meeting now; billing stops. Free.",
|
|
282
|
+
)
|
|
283
|
+
async def stop_meeting(meeting_id: str) -> dict[str, Any]:
|
|
284
|
+
try:
|
|
285
|
+
return dict(await client().meetings.stop(meeting_id))
|
|
286
|
+
except TalksignError as e:
|
|
287
|
+
raise _fail(e) from e
|
|
288
|
+
|
|
289
|
+
@mcp.tool(
|
|
290
|
+
title="List avatars",
|
|
291
|
+
annotations=READ_ONLY,
|
|
292
|
+
description="Avatars this account can use (preset and custom), with their sign languages and status. Free.",
|
|
293
|
+
)
|
|
294
|
+
async def list_avatars(language: str | None = None) -> dict[str, Any]:
|
|
295
|
+
try:
|
|
296
|
+
d = (await client().avatars.list(language=language)).get("data", {})
|
|
297
|
+
except TalksignError as e:
|
|
298
|
+
raise _fail(e) from e
|
|
299
|
+
|
|
300
|
+
def slim(a: dict[str, Any]) -> dict[str, Any]:
|
|
301
|
+
return {k: a.get(k) for k in ("id", "name", "languages", "status") if a.get(k) is not None}
|
|
302
|
+
|
|
303
|
+
return {
|
|
304
|
+
"preset": [slim(a) for a in d.get("system_avatars", [])],
|
|
305
|
+
"custom": [slim(a) for a in d.get("custom_avatars", [])],
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
@mcp.tool(
|
|
309
|
+
title="Get balance",
|
|
310
|
+
annotations=READ_ONLY,
|
|
311
|
+
description="The account's prepaid API balance in USD (available and reserved). Free.",
|
|
312
|
+
)
|
|
313
|
+
async def get_balance() -> dict[str, Any]:
|
|
314
|
+
try:
|
|
315
|
+
b = await client().balance.retrieve()
|
|
316
|
+
except TalksignError as e:
|
|
317
|
+
raise _fail(e) from e
|
|
318
|
+
return {k: b.get(k) for k in ("currency", "available_usd", "reserved_usd")}
|
|
319
|
+
|
|
320
|
+
return mcp
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def main() -> None:
|
|
324
|
+
p = argparse.ArgumentParser(prog="talksign-mcp", description="Talksign MCP server (stdio by default).")
|
|
325
|
+
p.add_argument("--transport", choices=["stdio", "streamable-http"], default="stdio")
|
|
326
|
+
p.add_argument("--version", action="version", version=f"talksign-mcp {__version__}")
|
|
327
|
+
a = p.parse_args()
|
|
328
|
+
logging.getLogger("httpx").setLevel(logging.WARNING) # no per-request lines on stderr
|
|
329
|
+
build_server().run(transport=a.transport)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
if __name__ == "__main__":
|
|
333
|
+
main()
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"""Talksign MCP server over the real MCP protocol (in-memory client), with the Talksign API mocked (respx).
|
|
2
|
+
|
|
3
|
+
No network, no API key, nothing billed.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
|
|
10
|
+
import httpx
|
|
11
|
+
import respx
|
|
12
|
+
from mcp.client.client import Client
|
|
13
|
+
|
|
14
|
+
from talksign_mcp import build_server
|
|
15
|
+
from talksign_mcp.server import make_client
|
|
16
|
+
|
|
17
|
+
API = "https://api.test.invalid"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def make_server():
|
|
21
|
+
return build_server(lambda: make_client(api_key="ts_test_key", base_url=API, max_retries=0))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def route(mock: respx.MockRouter, method: str, path: str):
|
|
25
|
+
return mock.route(method=method, url__regex=rf"^{API}(/v1)?{path}(\?.*)?$")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def data(result):
|
|
29
|
+
assert not result.is_error, result.content
|
|
30
|
+
if result.structured_content is not None:
|
|
31
|
+
sc = result.structured_content
|
|
32
|
+
return sc.get("result", sc) if isinstance(sc, dict) and set(sc) == {"result"} else sc
|
|
33
|
+
return json.loads(result.content[0].text)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def error_text(result) -> str:
|
|
37
|
+
assert result.is_error
|
|
38
|
+
return result.content[0].text
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
async def test_lists_every_tool_with_hints():
|
|
42
|
+
async with Client(make_server()) as c:
|
|
43
|
+
tools = {t.name: t for t in (await c.list_tools()).tools}
|
|
44
|
+
assert set(tools) == {
|
|
45
|
+
"text_to_sign",
|
|
46
|
+
"render_sign_video",
|
|
47
|
+
"text_to_gloss",
|
|
48
|
+
"morph_video",
|
|
49
|
+
"get_job",
|
|
50
|
+
"cancel_job",
|
|
51
|
+
"send_interpreter_to_meeting",
|
|
52
|
+
"get_meeting",
|
|
53
|
+
"stop_meeting",
|
|
54
|
+
"list_avatars",
|
|
55
|
+
"get_balance",
|
|
56
|
+
}
|
|
57
|
+
for free in ("get_job", "get_meeting", "list_avatars", "get_balance"):
|
|
58
|
+
assert tools[free].annotations.read_only_hint is True
|
|
59
|
+
for paid in ("text_to_sign", "render_sign_video", "morph_video", "send_interpreter_to_meeting"):
|
|
60
|
+
assert tools[paid].annotations.read_only_hint is False
|
|
61
|
+
assert "$" in tools[paid].description or "rate" in tools[paid].description
|
|
62
|
+
assert set(tools["morph_video"].input_schema["required"]) >= {"video_path", "consent"}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@respx.mock
|
|
66
|
+
async def test_text_to_sign_returns_clips_and_cost():
|
|
67
|
+
r = route(respx.mock, "POST", "/speech-to-sign/realtime").mock(
|
|
68
|
+
return_value=httpx.Response(
|
|
69
|
+
200,
|
|
70
|
+
json={
|
|
71
|
+
"success": True,
|
|
72
|
+
"data": {
|
|
73
|
+
"language": "asl",
|
|
74
|
+
"avatar": "arthur",
|
|
75
|
+
"glosses": ["HELLO", "FRIEND"],
|
|
76
|
+
"playlist": [
|
|
77
|
+
{"gloss": "HELLO", "url": "https://cdn/x/hello.mp4"},
|
|
78
|
+
{"gloss": "FRIEND", "url": "https://cdn/x/friend.mp4"},
|
|
79
|
+
],
|
|
80
|
+
"expires_at": "2026-12-05T00:00:00Z",
|
|
81
|
+
"has_missing": False,
|
|
82
|
+
},
|
|
83
|
+
"usage": {"costUsd": 0.002, "walletRemainingUsd": 9.5},
|
|
84
|
+
},
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
async with Client(make_server()) as c:
|
|
88
|
+
out = data(await c.call_tool("text_to_sign", {"text": "Hello friend"}))
|
|
89
|
+
assert out["glosses"] == ["HELLO", "FRIEND"]
|
|
90
|
+
assert [x["url"] for x in out["clips"]] == ["https://cdn/x/hello.mp4", "https://cdn/x/friend.mp4"]
|
|
91
|
+
assert out["costUsd"] == 0.002
|
|
92
|
+
sent = r.calls.last.request
|
|
93
|
+
assert sent.headers["authorization"] == "Bearer ts_test_key"
|
|
94
|
+
assert sent.headers["x-talksign-client"].startswith("talksign-mcp/")
|
|
95
|
+
assert json.loads(sent.content)["text"] == "Hello friend"
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
async def test_empty_and_too_long_text_rejected_without_api_call():
|
|
99
|
+
async with Client(make_server()) as c:
|
|
100
|
+
assert "empty" in error_text(await c.call_tool("text_to_sign", {"text": " "}))
|
|
101
|
+
assert "limit" in error_text(await c.call_tool("text_to_gloss", {"text": "a" * 5001}))
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@respx.mock
|
|
105
|
+
async def test_render_sign_video_waits_for_job():
|
|
106
|
+
route(respx.mock, "POST", "/speech-to-sign/studio").mock(
|
|
107
|
+
return_value=httpx.Response(
|
|
108
|
+
202, json={"id": "job_1", "object": "job", "type": "sign_video", "status": "queued"}
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
route(respx.mock, "GET", "/jobs/job_1").mock(
|
|
112
|
+
side_effect=[
|
|
113
|
+
httpx.Response(200, json={"id": "job_1", "status": "running"}),
|
|
114
|
+
httpx.Response(
|
|
115
|
+
200,
|
|
116
|
+
json={
|
|
117
|
+
"id": "job_1",
|
|
118
|
+
"type": "sign_video",
|
|
119
|
+
"status": "succeeded",
|
|
120
|
+
"result": {"video_url": "https://cdn/v.mp4", "download_url": None},
|
|
121
|
+
},
|
|
122
|
+
),
|
|
123
|
+
]
|
|
124
|
+
)
|
|
125
|
+
async with Client(make_server()) as c:
|
|
126
|
+
out = data(await c.call_tool("render_sign_video", {"text": "Thank you", "wait_seconds": 30}))
|
|
127
|
+
assert out["status"] == "succeeded"
|
|
128
|
+
assert out["result"] == {"video_url": "https://cdn/v.mp4"}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@respx.mock
|
|
132
|
+
async def test_render_sign_video_no_wait_returns_job_id():
|
|
133
|
+
route(respx.mock, "POST", "/speech-to-sign/studio").mock(
|
|
134
|
+
return_value=httpx.Response(202, json={"id": "job_2", "status": "queued"})
|
|
135
|
+
)
|
|
136
|
+
async with Client(make_server()) as c:
|
|
137
|
+
out = data(await c.call_tool("render_sign_video", {"text": "Hi", "wait_seconds": 0}))
|
|
138
|
+
assert out["id"] == "job_2" and out["status"] == "queued"
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
async def test_morph_refuses_without_consent_and_bad_inputs(tmp_path):
|
|
142
|
+
v = tmp_path / "sign.mp4"
|
|
143
|
+
v.write_bytes(b"x")
|
|
144
|
+
async with Client(make_server()) as c:
|
|
145
|
+
assert "consent is required" in error_text(
|
|
146
|
+
await c.call_tool("morph_video", {"video_path": str(v), "consent": False, "avatar": "arthur"})
|
|
147
|
+
)
|
|
148
|
+
assert "exactly one" in error_text(await c.call_tool("morph_video", {"video_path": str(v), "consent": True}))
|
|
149
|
+
assert "not found" in error_text(
|
|
150
|
+
await c.call_tool(
|
|
151
|
+
"morph_video", {"video_path": str(tmp_path / "nope.mp4"), "consent": True, "avatar": "arthur"}
|
|
152
|
+
)
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
@respx.mock
|
|
157
|
+
async def test_morph_uploads_files_with_consent(tmp_path):
|
|
158
|
+
v = tmp_path / "sign.mp4"
|
|
159
|
+
v.write_bytes(b"VIDEO")
|
|
160
|
+
p = tmp_path / "me.jpg"
|
|
161
|
+
p.write_bytes(b"PHOTO")
|
|
162
|
+
r = route(respx.mock, "POST", "/jobs").mock(
|
|
163
|
+
return_value=httpx.Response(202, json={"id": "job_m", "type": "morph", "status": "queued"})
|
|
164
|
+
)
|
|
165
|
+
async with Client(make_server()) as c:
|
|
166
|
+
out = data(
|
|
167
|
+
await c.call_tool(
|
|
168
|
+
"morph_video", {"video_path": str(v), "photo_path": str(p), "consent": True, "quality": "720p"}
|
|
169
|
+
)
|
|
170
|
+
)
|
|
171
|
+
assert out["id"] == "job_m"
|
|
172
|
+
body = r.calls.last.request.content
|
|
173
|
+
for part in (b'name="type"', b"morph", b'name="consent"', b"true", b"720p", b"VIDEO", b"PHOTO"):
|
|
174
|
+
assert part in body
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
async def test_meeting_needs_disclosure():
|
|
178
|
+
async with Client(make_server()) as c:
|
|
179
|
+
msg = error_text(
|
|
180
|
+
await c.call_tool(
|
|
181
|
+
"send_interpreter_to_meeting",
|
|
182
|
+
{"meeting_url": "https://meet.google.com/abc-defg-hij", "disclosure_accepted": False},
|
|
183
|
+
)
|
|
184
|
+
)
|
|
185
|
+
assert "disclosure_accepted is required" in msg
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
@respx.mock
|
|
189
|
+
async def test_meeting_create_and_stop():
|
|
190
|
+
r = route(respx.mock, "POST", "/meetings").mock(
|
|
191
|
+
return_value=httpx.Response(
|
|
192
|
+
201, json={"id": "mtg_1", "object": "meeting", "status": "requested", "platform": "meet"}
|
|
193
|
+
)
|
|
194
|
+
)
|
|
195
|
+
route(respx.mock, "POST", "/meetings/mtg_1/stop").mock(
|
|
196
|
+
return_value=httpx.Response(200, json={"id": "mtg_1", "status": "ended"})
|
|
197
|
+
)
|
|
198
|
+
async with Client(make_server()) as c:
|
|
199
|
+
out = data(
|
|
200
|
+
await c.call_tool(
|
|
201
|
+
"send_interpreter_to_meeting",
|
|
202
|
+
{"meeting_url": "https://meet.google.com/abc-defg-hij", "disclosure_accepted": True},
|
|
203
|
+
)
|
|
204
|
+
)
|
|
205
|
+
stopped = data(await c.call_tool("stop_meeting", {"meeting_id": "mtg_1"}))
|
|
206
|
+
assert out["id"] == "mtg_1" and stopped["status"] == "ended"
|
|
207
|
+
assert json.loads(r.calls.last.request.content)["disclosure_accepted"] is True
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
@respx.mock
|
|
211
|
+
async def test_free_tools():
|
|
212
|
+
route(respx.mock, "GET", "/avatars").mock(
|
|
213
|
+
return_value=httpx.Response(
|
|
214
|
+
200,
|
|
215
|
+
json={
|
|
216
|
+
"success": True,
|
|
217
|
+
"data": {
|
|
218
|
+
"system_avatars": [
|
|
219
|
+
{
|
|
220
|
+
"id": "arthur",
|
|
221
|
+
"name": "Arthur",
|
|
222
|
+
"languages": ["asl"],
|
|
223
|
+
"status": "ready",
|
|
224
|
+
"idle": {"url": "x"},
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"custom_avatars": [],
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
)
|
|
231
|
+
)
|
|
232
|
+
route(respx.mock, "GET", "/balance").mock(
|
|
233
|
+
return_value=httpx.Response(
|
|
234
|
+
200, json={"object": "balance", "currency": "usd", "available_usd": 12.5, "reserved_usd": 0.5}
|
|
235
|
+
)
|
|
236
|
+
)
|
|
237
|
+
async with Client(make_server()) as c:
|
|
238
|
+
av = data(await c.call_tool("list_avatars", {}))
|
|
239
|
+
bal = data(await c.call_tool("get_balance", {}))
|
|
240
|
+
assert av == {"preset": [{"id": "arthur", "name": "Arthur", "languages": ["asl"], "status": "ready"}], "custom": []}
|
|
241
|
+
assert bal == {"currency": "usd", "available_usd": 12.5, "reserved_usd": 0.5}
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
@respx.mock
|
|
245
|
+
async def test_api_errors_become_readable_tool_errors():
|
|
246
|
+
route(respx.mock, "GET", "/jobs/missing").mock(
|
|
247
|
+
return_value=httpx.Response(
|
|
248
|
+
404,
|
|
249
|
+
json={
|
|
250
|
+
"error": {"code": "not_found", "message": "No such job.", "type": "invalid_request_error"},
|
|
251
|
+
"request_id": "req_9",
|
|
252
|
+
},
|
|
253
|
+
)
|
|
254
|
+
)
|
|
255
|
+
route(respx.mock, "GET", "/balance").mock(
|
|
256
|
+
return_value=httpx.Response(
|
|
257
|
+
401,
|
|
258
|
+
json={"error": {"code": "invalid_api_key", "message": "Invalid API key.", "type": "authentication_error"}},
|
|
259
|
+
)
|
|
260
|
+
)
|
|
261
|
+
async with Client(make_server()) as c:
|
|
262
|
+
msg = error_text(await c.call_tool("get_job", {"job_id": "missing"}))
|
|
263
|
+
auth = error_text(await c.call_tool("get_balance", {}))
|
|
264
|
+
assert "not_found" in msg and "req_9" in msg
|
|
265
|
+
assert "invalid_api_key" in auth
|
|
266
|
+
assert "ts_test_key" not in msg + auth # the key is never echoed
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
async def test_missing_api_key_message(monkeypatch):
|
|
270
|
+
monkeypatch.delenv("TALKSIGN_API_KEY", raising=False)
|
|
271
|
+
async with Client(build_server()) as c:
|
|
272
|
+
msg = error_text(await c.call_tool("get_balance", {}))
|
|
273
|
+
assert "TALKSIGN_API_KEY" in msg and "developer.talksign.co" in msg
|