sonilo-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.
- sonilo_mcp-0.1.0/LICENSE +21 -0
- sonilo_mcp-0.1.0/PKG-INFO +152 -0
- sonilo_mcp-0.1.0/README.md +119 -0
- sonilo_mcp-0.1.0/pyproject.toml +48 -0
- sonilo_mcp-0.1.0/setup.cfg +4 -0
- sonilo_mcp-0.1.0/setup.py +21 -0
- sonilo_mcp-0.1.0/src/sonilo_mcp/__init__.py +4 -0
- sonilo_mcp-0.1.0/src/sonilo_mcp/__main__.py +3 -0
- sonilo_mcp-0.1.0/src/sonilo_mcp/api.py +596 -0
- sonilo_mcp-0.1.0/src/sonilo_mcp.egg-info/PKG-INFO +152 -0
- sonilo_mcp-0.1.0/src/sonilo_mcp.egg-info/SOURCES.txt +14 -0
- sonilo_mcp-0.1.0/src/sonilo_mcp.egg-info/dependency_links.txt +1 -0
- sonilo_mcp-0.1.0/src/sonilo_mcp.egg-info/entry_points.txt +2 -0
- sonilo_mcp-0.1.0/src/sonilo_mcp.egg-info/requires.txt +10 -0
- sonilo_mcp-0.1.0/src/sonilo_mcp.egg-info/top_level.txt +1 -0
- sonilo_mcp-0.1.0/tests/test_api.py +1042 -0
sonilo_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sonilo
|
|
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,152 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sonilo-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for Sonilo AI music generation API
|
|
5
|
+
Home-page: https://github.com/sonilo-ai/sonilo-api-dashboard
|
|
6
|
+
Author: Sonilo
|
|
7
|
+
Author-email: Sonilo <support@sonilo.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://platform.sonilo.com
|
|
10
|
+
Project-URL: Repository, https://github.com/sonilo-ai/sonilo-mcp
|
|
11
|
+
Keywords: sonilo,mcp,music,ai,audio,video-to-music
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: mcp[cli]>=1.6.0
|
|
21
|
+
Requires-Dist: httpx>=0.27
|
|
22
|
+
Requires-Dist: sounddevice>=0.5.1
|
|
23
|
+
Requires-Dist: soundfile>=0.13.1
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
27
|
+
Requires-Dist: respx>=0.21; extra == "dev"
|
|
28
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
29
|
+
Dynamic: author
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
Dynamic: requires-python
|
|
33
|
+
|
|
34
|
+
# Sonilo MCP Server
|
|
35
|
+
|
|
36
|
+
An MCP (Model Context Protocol) server that exposes [Sonilo](https://platform.sonilo.com)'s AI music generation API to MCP-compatible clients (Claude Desktop, Cursor, etc.).
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uvx sonilo-mcp
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or install with pip:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install sonilo-mcp
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Audio Playback Dependencies
|
|
51
|
+
|
|
52
|
+
The `play_audio` tool requires PortAudio at runtime (for `sounddevice`). On macOS/Linux, install via:
|
|
53
|
+
|
|
54
|
+
- **macOS**: `brew install portaudio`
|
|
55
|
+
- **Debian/Ubuntu**: `sudo apt-get install libportaudio2`
|
|
56
|
+
|
|
57
|
+
`uvx sonilo-mcp` and `pip install` will pull the Python bindings, but the system PortAudio library must be installed separately. The other tools (`text_to_music`, `video_to_music`, `get_account_services`, `get_usage`) work without PortAudio.
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
### Claude Desktop
|
|
62
|
+
|
|
63
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"sonilo": {
|
|
69
|
+
"command": "uvx",
|
|
70
|
+
"args": ["sonilo-mcp"],
|
|
71
|
+
"env": {
|
|
72
|
+
"SONILO_API_KEY": "sk_live_..."
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Get your API key at <https://platform.sonilo.com/dashboard/api-keys>.
|
|
80
|
+
|
|
81
|
+
### Codex
|
|
82
|
+
|
|
83
|
+
Add the server to `~/.codex/config.toml`:
|
|
84
|
+
|
|
85
|
+
```toml
|
|
86
|
+
[mcp_servers.sonilo]
|
|
87
|
+
command = "uvx"
|
|
88
|
+
args = ["sonilo-mcp"]
|
|
89
|
+
|
|
90
|
+
[mcp_servers.sonilo.env]
|
|
91
|
+
SONILO_API_KEY = "sk_live_..."
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Restart Codex (or start a new session) to load it, then run `/mcp` to confirm
|
|
95
|
+
`sonilo` is connected and its tools are listed.
|
|
96
|
+
|
|
97
|
+
### Environment Variables
|
|
98
|
+
|
|
99
|
+
| Variable | Default | Description |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| `SONILO_API_KEY` | _(required)_ | Bearer token. |
|
|
102
|
+
| `SONILO_API_URL` | `https://api.sonilo.com` | Public API base URL. |
|
|
103
|
+
| `SONILO_MCP_BASE_PATH` | `~/Desktop` | Default output directory and base for relative input paths. Also the confinement boundary (see below). |
|
|
104
|
+
| `SONILO_MCP_ALLOW_ANY_PATH` | `false` | Set to `true` to let tools read/write files outside `SONILO_MCP_BASE_PATH`. |
|
|
105
|
+
| `TIME_OUT_SECONDS` | `300` | Generation timeout. |
|
|
106
|
+
|
|
107
|
+
### File access & confinement
|
|
108
|
+
|
|
109
|
+
By default, the file tools (`video_to_music` input, `play_audio`, and any
|
|
110
|
+
`output_directory`) are **confined to `SONILO_MCP_BASE_PATH`**. Paths that
|
|
111
|
+
resolve outside it (after symlink resolution) are rejected. This limits the
|
|
112
|
+
blast radius if a client is tricked into reading or exfiltrating arbitrary
|
|
113
|
+
files. To opt out — e.g. to read a video from elsewhere on disk — set
|
|
114
|
+
`SONILO_MCP_ALLOW_ANY_PATH=true`.
|
|
115
|
+
|
|
116
|
+
## Tools
|
|
117
|
+
|
|
118
|
+
| Tool | Description | Cost |
|
|
119
|
+
|---|---|---|
|
|
120
|
+
| `text_to_music(prompt, duration, output_directory?)` | Generate music from a text prompt. | ✅ |
|
|
121
|
+
| `video_to_music(video_path? \| video_url?, prompt?, output_directory?)` | Generate music matched to a video. | ✅ |
|
|
122
|
+
| `get_account_services()` | List available services and limits. | ❌ |
|
|
123
|
+
| `get_usage(days=30)` | Show usage summary + per-day breakdown. | ❌ |
|
|
124
|
+
| `play_audio(input_file_path)` | Play a local audio file. | ❌ |
|
|
125
|
+
|
|
126
|
+
Tools marked ✅ make API calls that incur charges on your Sonilo account.
|
|
127
|
+
|
|
128
|
+
## Output Format
|
|
129
|
+
|
|
130
|
+
Generated audio is saved as `.m4a` (AAC in MP4 container — this is what the backend currently emits). File names use the title returned by the backend (slugified) or a `sonilo-<timestamp>.m4a` fallback. When multiple parallel streams are returned, a `-<index>` suffix is appended.
|
|
131
|
+
|
|
132
|
+
## Common Errors
|
|
133
|
+
|
|
134
|
+
| Message | What to do |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `Invalid SONILO_API_KEY` | Verify the key at <https://platform.sonilo.com/dashboard/api-keys>. |
|
|
137
|
+
| `Insufficient minutes` / `Credit limit exceeded` | Top up at <https://platform.sonilo.com/dashboard/billing>. |
|
|
138
|
+
| `Rate limit exceeded` | Check `get_account_services` for your rpm/concurrency limits. |
|
|
139
|
+
| `Generation timed out` | Raise `TIME_OUT_SECONDS`. Check `get_usage` to confirm whether the backend completed and charged. |
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
python -m venv .venv
|
|
145
|
+
source .venv/bin/activate
|
|
146
|
+
pip install -e ".[dev]"
|
|
147
|
+
pytest
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
MIT
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Sonilo MCP Server
|
|
2
|
+
|
|
3
|
+
An MCP (Model Context Protocol) server that exposes [Sonilo](https://platform.sonilo.com)'s AI music generation API to MCP-compatible clients (Claude Desktop, Cursor, etc.).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uvx sonilo-mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or install with pip:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install sonilo-mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Audio Playback Dependencies
|
|
18
|
+
|
|
19
|
+
The `play_audio` tool requires PortAudio at runtime (for `sounddevice`). On macOS/Linux, install via:
|
|
20
|
+
|
|
21
|
+
- **macOS**: `brew install portaudio`
|
|
22
|
+
- **Debian/Ubuntu**: `sudo apt-get install libportaudio2`
|
|
23
|
+
|
|
24
|
+
`uvx sonilo-mcp` and `pip install` will pull the Python bindings, but the system PortAudio library must be installed separately. The other tools (`text_to_music`, `video_to_music`, `get_account_services`, `get_usage`) work without PortAudio.
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
### Claude Desktop
|
|
29
|
+
|
|
30
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"sonilo": {
|
|
36
|
+
"command": "uvx",
|
|
37
|
+
"args": ["sonilo-mcp"],
|
|
38
|
+
"env": {
|
|
39
|
+
"SONILO_API_KEY": "sk_live_..."
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Get your API key at <https://platform.sonilo.com/dashboard/api-keys>.
|
|
47
|
+
|
|
48
|
+
### Codex
|
|
49
|
+
|
|
50
|
+
Add the server to `~/.codex/config.toml`:
|
|
51
|
+
|
|
52
|
+
```toml
|
|
53
|
+
[mcp_servers.sonilo]
|
|
54
|
+
command = "uvx"
|
|
55
|
+
args = ["sonilo-mcp"]
|
|
56
|
+
|
|
57
|
+
[mcp_servers.sonilo.env]
|
|
58
|
+
SONILO_API_KEY = "sk_live_..."
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Restart Codex (or start a new session) to load it, then run `/mcp` to confirm
|
|
62
|
+
`sonilo` is connected and its tools are listed.
|
|
63
|
+
|
|
64
|
+
### Environment Variables
|
|
65
|
+
|
|
66
|
+
| Variable | Default | Description |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| `SONILO_API_KEY` | _(required)_ | Bearer token. |
|
|
69
|
+
| `SONILO_API_URL` | `https://api.sonilo.com` | Public API base URL. |
|
|
70
|
+
| `SONILO_MCP_BASE_PATH` | `~/Desktop` | Default output directory and base for relative input paths. Also the confinement boundary (see below). |
|
|
71
|
+
| `SONILO_MCP_ALLOW_ANY_PATH` | `false` | Set to `true` to let tools read/write files outside `SONILO_MCP_BASE_PATH`. |
|
|
72
|
+
| `TIME_OUT_SECONDS` | `300` | Generation timeout. |
|
|
73
|
+
|
|
74
|
+
### File access & confinement
|
|
75
|
+
|
|
76
|
+
By default, the file tools (`video_to_music` input, `play_audio`, and any
|
|
77
|
+
`output_directory`) are **confined to `SONILO_MCP_BASE_PATH`**. Paths that
|
|
78
|
+
resolve outside it (after symlink resolution) are rejected. This limits the
|
|
79
|
+
blast radius if a client is tricked into reading or exfiltrating arbitrary
|
|
80
|
+
files. To opt out — e.g. to read a video from elsewhere on disk — set
|
|
81
|
+
`SONILO_MCP_ALLOW_ANY_PATH=true`.
|
|
82
|
+
|
|
83
|
+
## Tools
|
|
84
|
+
|
|
85
|
+
| Tool | Description | Cost |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `text_to_music(prompt, duration, output_directory?)` | Generate music from a text prompt. | ✅ |
|
|
88
|
+
| `video_to_music(video_path? \| video_url?, prompt?, output_directory?)` | Generate music matched to a video. | ✅ |
|
|
89
|
+
| `get_account_services()` | List available services and limits. | ❌ |
|
|
90
|
+
| `get_usage(days=30)` | Show usage summary + per-day breakdown. | ❌ |
|
|
91
|
+
| `play_audio(input_file_path)` | Play a local audio file. | ❌ |
|
|
92
|
+
|
|
93
|
+
Tools marked ✅ make API calls that incur charges on your Sonilo account.
|
|
94
|
+
|
|
95
|
+
## Output Format
|
|
96
|
+
|
|
97
|
+
Generated audio is saved as `.m4a` (AAC in MP4 container — this is what the backend currently emits). File names use the title returned by the backend (slugified) or a `sonilo-<timestamp>.m4a` fallback. When multiple parallel streams are returned, a `-<index>` suffix is appended.
|
|
98
|
+
|
|
99
|
+
## Common Errors
|
|
100
|
+
|
|
101
|
+
| Message | What to do |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `Invalid SONILO_API_KEY` | Verify the key at <https://platform.sonilo.com/dashboard/api-keys>. |
|
|
104
|
+
| `Insufficient minutes` / `Credit limit exceeded` | Top up at <https://platform.sonilo.com/dashboard/billing>. |
|
|
105
|
+
| `Rate limit exceeded` | Check `get_account_services` for your rpm/concurrency limits. |
|
|
106
|
+
| `Generation timed out` | Raise `TIME_OUT_SECONDS`. Check `get_usage` to confirm whether the backend completed and charged. |
|
|
107
|
+
|
|
108
|
+
## Development
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
python -m venv .venv
|
|
112
|
+
source .venv/bin/activate
|
|
113
|
+
pip install -e ".[dev]"
|
|
114
|
+
pytest
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "sonilo-mcp"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "MCP server for Sonilo AI music generation API"
|
|
5
|
+
authors = [{ name = "Sonilo", email = "support@sonilo.com" }]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = { text = "MIT" }
|
|
8
|
+
keywords = ["sonilo", "mcp", "music", "ai", "audio", "video-to-music"]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 3 - Alpha",
|
|
11
|
+
"License :: OSI Approved :: MIT License",
|
|
12
|
+
"Programming Language :: Python :: 3.10",
|
|
13
|
+
"Programming Language :: Python :: 3.11",
|
|
14
|
+
"Programming Language :: Python :: 3.12",
|
|
15
|
+
]
|
|
16
|
+
requires-python = ">=3.10"
|
|
17
|
+
dependencies = [
|
|
18
|
+
"mcp[cli]>=1.6.0",
|
|
19
|
+
"httpx>=0.27",
|
|
20
|
+
"sounddevice>=0.5.1",
|
|
21
|
+
"soundfile>=0.13.1",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
dev = [
|
|
26
|
+
"pytest>=8",
|
|
27
|
+
"pytest-asyncio>=0.23",
|
|
28
|
+
"respx>=0.21",
|
|
29
|
+
"build>=1.2",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
sonilo-mcp = "sonilo_mcp.api:main"
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://platform.sonilo.com"
|
|
37
|
+
Repository = "https://github.com/sonilo-ai/sonilo-mcp"
|
|
38
|
+
|
|
39
|
+
[build-system]
|
|
40
|
+
requires = ["setuptools>=61", "wheel"]
|
|
41
|
+
build-backend = "setuptools.build_meta"
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.packages.find]
|
|
44
|
+
where = ["src"]
|
|
45
|
+
|
|
46
|
+
[tool.pytest.ini_options]
|
|
47
|
+
testpaths = ["tests"]
|
|
48
|
+
asyncio_mode = "auto"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="sonilo-mcp",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
package_dir={"": "src"},
|
|
7
|
+
packages=find_packages(where="src"),
|
|
8
|
+
include_package_data=True,
|
|
9
|
+
entry_points={
|
|
10
|
+
"console_scripts": [
|
|
11
|
+
"sonilo-mcp = sonilo_mcp.api:main",
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
author="Sonilo",
|
|
15
|
+
author_email="support@sonilo.com",
|
|
16
|
+
description="MCP server for Sonilo AI music generation API",
|
|
17
|
+
url="https://github.com/sonilo-ai/sonilo-api-dashboard",
|
|
18
|
+
python_requires=">=3.10",
|
|
19
|
+
long_description=open("README.md").read() if __import__("os").path.exists("README.md") else "",
|
|
20
|
+
long_description_content_type="text/markdown",
|
|
21
|
+
)
|