@ray0404/zig-audio-mcp 0.1.4 → 0.2.0
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.
- package/.kilo/plans/mcp-resources-plan.md +174 -0
- package/AGENTS.md +53 -5
- package/GEMINI.md +65 -4
- package/README.md +82 -6
- package/dist/index.js +935 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +981 -10
- package/src/test.ts +259 -6
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Plan: Add MCP Resources to Zig Audio MCP Server
|
|
2
|
+
|
|
3
|
+
## Executive Summary
|
|
4
|
+
|
|
5
|
+
Add 10 MCP resources to expose the server's substantial static reference data as read-only context. Currently, all data is only accessible through tools, requiring LLMs to make tool calls for every lookup. Resources enable direct context inclusion, improving efficiency and UX.
|
|
6
|
+
|
|
7
|
+
## Assessment of Current State
|
|
8
|
+
|
|
9
|
+
| Component | Count | Status |
|
|
10
|
+
|-----------|-------|--------|
|
|
11
|
+
| Tools | 14 | ✅ Comprehensive |
|
|
12
|
+
| Prompts | 4 | ✅ Good |
|
|
13
|
+
| **Resources** | **0** | ❌ **Missing** |
|
|
14
|
+
|
|
15
|
+
## Proposed Resources
|
|
16
|
+
|
|
17
|
+
### Tier 1: Core Reference Resources (Implement First)
|
|
18
|
+
|
|
19
|
+
| URI | Name | MIME Type | Content |
|
|
20
|
+
|-----|------|-----------|---------|
|
|
21
|
+
| `zig-audio://libraries` | Zig Audio Libraries | `application/json` | Complete library database (9 libs) |
|
|
22
|
+
| `zig-dsp://filters` | DSP Filter Reference | `application/json` | All filter types with formulas |
|
|
23
|
+
| `zig-dsp://concepts` | Audio/DSP Concepts | `application/json` | Fundamental DSP terminology |
|
|
24
|
+
|
|
25
|
+
### Tier 2: Code & Project Resources
|
|
26
|
+
|
|
27
|
+
| URI | Name | MIME Type | Content |
|
|
28
|
+
|-----|------|-----------|---------|
|
|
29
|
+
| `zig-audio://templates/code` | Code Templates | `application/json` | 9 code snippets (oscillator, filter, etc.) |
|
|
30
|
+
| `zig-audio://templates/project` | Project Templates | `application/json` | 5 project skeletons |
|
|
31
|
+
| `zig-audio://resources` | Learning Resources | `application/json` | 21 curated tutorials/articles |
|
|
32
|
+
|
|
33
|
+
### Tier 3: Troubleshooting Resources
|
|
34
|
+
|
|
35
|
+
| URI | Name | MIME Type | Content |
|
|
36
|
+
|-----|------|-----------|---------|
|
|
37
|
+
| `zig-audio://troubleshooting` | Troubleshooting Guide | `application/json` | 6 issue types with solutions |
|
|
38
|
+
| `zig-audio://compatibility` | Compatibility Matrix | `application/json` | Library version compatibility |
|
|
39
|
+
|
|
40
|
+
### Tier 4: Parameterized Templates
|
|
41
|
+
|
|
42
|
+
| URI Template | Name | Description |
|
|
43
|
+
|--------------|------|-------------|
|
|
44
|
+
| `zig-audio://libraries/{name}` | Library Detail | Individual library info |
|
|
45
|
+
| `zig-dsp://filters/{type}` | Filter Detail | Individual filter explanation |
|
|
46
|
+
|
|
47
|
+
## Implementation Steps
|
|
48
|
+
|
|
49
|
+
### Step 1: Add Resource Data Constants
|
|
50
|
+
|
|
51
|
+
Create unified resource data constants extracted from existing handler functions:
|
|
52
|
+
- `LIBRARY_RESOURCES` - From `ZIG_AUDIO_LIBRARIES`
|
|
53
|
+
- `FILTER_RESOURCES` - From `DSP_FILTERS`
|
|
54
|
+
- `CODE_TEMPLATES` - From `handleGenerateCode`
|
|
55
|
+
- `PROJECT_TEMPLATES` - From `handleProjectTemplate`
|
|
56
|
+
- `TROUBLESHOOTING_GUIDES` - From `handleTroubleshoot`
|
|
57
|
+
- `CONCEPTS` - From `handleGetConcepts`
|
|
58
|
+
- `LEARNING_RESOURCES` - From `handleListResources`
|
|
59
|
+
- `COMPATIBILITY_MATRIX` - From `handleDeprecationCheck`
|
|
60
|
+
|
|
61
|
+
### Step 2: Update Server Capabilities
|
|
62
|
+
|
|
63
|
+
Add `resources` capability to the server configuration:
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
{
|
|
67
|
+
capabilities: {
|
|
68
|
+
tools: {},
|
|
69
|
+
prompts: {},
|
|
70
|
+
resources: {} // Add this
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Step 3: Import MCP Resource Types
|
|
76
|
+
|
|
77
|
+
Add imports from `@modelcontextprotocol/sdk/types.js`:
|
|
78
|
+
- `ListResourcesRequestSchema`
|
|
79
|
+
- `ReadResourceRequestSchema`
|
|
80
|
+
- `ListResourceTemplatesRequestSchema`
|
|
81
|
+
|
|
82
|
+
### Step 4: Implement ListResourcesRequestSchema Handler
|
|
83
|
+
|
|
84
|
+
Return all static resources with:
|
|
85
|
+
- `uri` - Unique resource identifier
|
|
86
|
+
- `name` - Human-readable name
|
|
87
|
+
- `description` - Brief description
|
|
88
|
+
- `mimeType` - `application/json`
|
|
89
|
+
|
|
90
|
+
### Step 5: Implement ReadResourceRequestSchema Handler
|
|
91
|
+
|
|
92
|
+
Handle URI-based reads:
|
|
93
|
+
- Parse URI scheme and path
|
|
94
|
+
- Route to appropriate data source
|
|
95
|
+
- Return `contents` array with `text` field
|
|
96
|
+
|
|
97
|
+
### Step 6: Implement ListResourceTemplatesRequestSchema Handler
|
|
98
|
+
|
|
99
|
+
Return parameterized templates:
|
|
100
|
+
- `zig-audio://libraries/{name}`
|
|
101
|
+
- `zig-dsp://filters/{type}`
|
|
102
|
+
|
|
103
|
+
### Step 7: Update Evaluation Tests
|
|
104
|
+
|
|
105
|
+
Add tests for resource functionality:
|
|
106
|
+
- List resources test
|
|
107
|
+
- Read library resource test
|
|
108
|
+
- Read filter resource test
|
|
109
|
+
- Read concepts resource test
|
|
110
|
+
|
|
111
|
+
## Resource URI Scheme Design
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
zig-audio:// # Main namespace
|
|
115
|
+
├── libraries # All libraries
|
|
116
|
+
│ └── {name} # Individual library (template)
|
|
117
|
+
├── templates
|
|
118
|
+
│ ├── code # Code templates
|
|
119
|
+
│ └── project # Project templates
|
|
120
|
+
├── resources # Learning resources
|
|
121
|
+
├── troubleshooting # Troubleshooting guides
|
|
122
|
+
└── compatibility # Compatibility matrix
|
|
123
|
+
|
|
124
|
+
zig-dsp:// # DSP-specific namespace
|
|
125
|
+
├── filters # All filters
|
|
126
|
+
│ └── {type} # Individual filter (template)
|
|
127
|
+
└── concepts # DSP concepts
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Content Format
|
|
131
|
+
|
|
132
|
+
All resources return JSON:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"uri": "zig-audio://libraries",
|
|
137
|
+
"mimeType": "application/json",
|
|
138
|
+
"text": "{ ... JSON data ... }"
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Files to Modify
|
|
143
|
+
|
|
144
|
+
1. **`src/index.ts`** - Main implementation file
|
|
145
|
+
- Add resource data constants
|
|
146
|
+
- Add resource type imports
|
|
147
|
+
- Add resource capability
|
|
148
|
+
- Implement 3 resource request handlers
|
|
149
|
+
- Add resource templates support
|
|
150
|
+
|
|
151
|
+
2. **`src/test.ts`** - Test file
|
|
152
|
+
- Add resource listing tests
|
|
153
|
+
- Add resource reading tests
|
|
154
|
+
|
|
155
|
+
## Benefits
|
|
156
|
+
|
|
157
|
+
| Before (Tools Only) | After (Resources + Tools) |
|
|
158
|
+
|---------------------|---------------------------|
|
|
159
|
+
| Must call tool for each lookup | Resources auto-included as context |
|
|
160
|
+
| One-time data fetch | Persistent reference data |
|
|
161
|
+
| Tool call overhead per query | Direct URI access |
|
|
162
|
+
| No discovery mechanism | List all available resources |
|
|
163
|
+
|
|
164
|
+
## Testing Plan
|
|
165
|
+
|
|
166
|
+
1. **Unit Tests**: Verify each resource returns correct data
|
|
167
|
+
2. **Integration Tests**: Test ListResources and ReadResource flows
|
|
168
|
+
3. **Evaluation Tests**: Add 2-3 new test cases for resources
|
|
169
|
+
|
|
170
|
+
## Backward Compatibility
|
|
171
|
+
|
|
172
|
+
- All existing tools remain unchanged
|
|
173
|
+
- Resources are additive - no breaking changes
|
|
174
|
+
- Clients that don't support resources continue working
|
package/AGENTS.md
CHANGED
|
@@ -6,13 +6,18 @@ Build an MCP (Model Context Protocol) server that communicates with either local
|
|
|
6
6
|
|
|
7
7
|
## Project Overview
|
|
8
8
|
|
|
9
|
-
This is a Node.js/TypeScript project that implements an MCP server to help AI systems assist developers in writing Zig audio and DSP code. The server provides tools for:
|
|
9
|
+
This is a Node.js/TypeScript project that implements an MCP server to help AI systems assist developers in writing Zig audio and DSP code. The server provides tools and resources for:
|
|
10
10
|
|
|
11
|
-
- Discovering and learning about Zig audio/DSP libraries
|
|
11
|
+
- Discovering and learning about Zig audio/DSP libraries (9 libraries total)
|
|
12
12
|
- Understanding DSP filter algorithms and their implementations
|
|
13
13
|
- Generating starter code for common audio programming tasks
|
|
14
14
|
- Learning fundamental audio/DSP concepts
|
|
15
15
|
- Finding resources for further learning
|
|
16
|
+
- Getting intelligent library recommendations
|
|
17
|
+
- Interactive DSP filter design with coefficient calculation
|
|
18
|
+
- Code verification and project template generation
|
|
19
|
+
- Troubleshooting audio programming issues
|
|
20
|
+
- Direct access to reference data via MCP resources
|
|
16
21
|
|
|
17
22
|
## Technology Stack
|
|
18
23
|
|
|
@@ -50,13 +55,15 @@ MCP_Zig/
|
|
|
50
55
|
|
|
51
56
|
## MCP Tools
|
|
52
57
|
|
|
53
|
-
The server exposes
|
|
58
|
+
The server exposes 14 tools for AI assistants:
|
|
59
|
+
|
|
60
|
+
### Core Tools (6)
|
|
54
61
|
|
|
55
62
|
### 1. zig_audio_list_libraries
|
|
56
63
|
List available Zig audio/DSP libraries with optional filtering.
|
|
57
64
|
|
|
58
65
|
### 2. zig_audio_library_info
|
|
59
|
-
Get detailed information about a specific library (zang, zaudio, bonk, pcm, zig-liquid-dsp, dalek).
|
|
66
|
+
Get detailed information about a specific library (zang, zaudio, bonk, pcm, zig-liquid-dsp, dalek, zsynth, zig-synth, noize).
|
|
60
67
|
|
|
61
68
|
### 3. zig_dsp_explain_filter
|
|
62
69
|
Explain DSP filter types (lowpass, highpass, bandpass, notch, biquad, one-pole) with formulas and use cases.
|
|
@@ -70,6 +77,8 @@ List learning resources (tutorials, references, examples, articles).
|
|
|
70
77
|
### 6. zig_dsp_get_concepts
|
|
71
78
|
Get explanations of fundamental audio/DSP concepts.
|
|
72
79
|
|
|
80
|
+
### Advanced Tools (8)
|
|
81
|
+
|
|
73
82
|
### 7. zig_audio_recommend_library
|
|
74
83
|
Get intelligent library recommendations based on use case and requirements.
|
|
75
84
|
|
|
@@ -82,6 +91,42 @@ Verify Zig code for syntax issues and missing imports.
|
|
|
82
91
|
### 10. zig_audio_project_template
|
|
83
92
|
Generate complete project templates for audio applications.
|
|
84
93
|
|
|
94
|
+
### 11. zig_audio_compare_libraries
|
|
95
|
+
Compare multiple Zig audio libraries side-by-side.
|
|
96
|
+
|
|
97
|
+
### 12. zig_audio_troubleshoot
|
|
98
|
+
Debug common audio programming issues and get solutions.
|
|
99
|
+
|
|
100
|
+
### 13. zig_audio_deprecation_check
|
|
101
|
+
Check if a library is deprecated or needs updates for your Zig version.
|
|
102
|
+
|
|
103
|
+
### 14. zig_dsp_calculate_delay
|
|
104
|
+
Convert delay values between milliseconds, samples, feet, and meters.
|
|
105
|
+
|
|
106
|
+
## MCP Resources
|
|
107
|
+
|
|
108
|
+
The server exposes 8 static resources + 2 parameterized templates for direct context access:
|
|
109
|
+
|
|
110
|
+
### Static Resources
|
|
111
|
+
|
|
112
|
+
| URI | Name | Content |
|
|
113
|
+
|-----|------|---------|
|
|
114
|
+
| `zig-audio://libraries` | Zig Audio Libraries | Complete database of 9 libraries |
|
|
115
|
+
| `zig-dsp://filters` | DSP Filter Reference | 6 filter types with formulas |
|
|
116
|
+
| `zig-dsp://concepts` | Audio/DSP Concepts | 5 fundamental concepts |
|
|
117
|
+
| `zig-audio://templates/code` | Code Templates | 9 code snippets |
|
|
118
|
+
| `zig-audio://templates/project` | Project Templates | 5 project skeletons |
|
|
119
|
+
| `zig-audio://resources` | Learning Resources | 11 tutorials/references |
|
|
120
|
+
| `zig-audio://troubleshooting` | Troubleshooting Guide | 6 issue types with solutions |
|
|
121
|
+
| `zig-audio://compatibility` | Compatibility Matrix | Library version info |
|
|
122
|
+
|
|
123
|
+
### Parameterized Templates
|
|
124
|
+
|
|
125
|
+
| URI Template | Purpose |
|
|
126
|
+
|--------------|---------|
|
|
127
|
+
| `zig-audio://libraries/{name}` | Individual library details (zang, zaudio, etc.) |
|
|
128
|
+
| `zig-dsp://filters/{type}` | Individual filter details (lowpass, highpass, etc.) |
|
|
129
|
+
|
|
85
130
|
## Development Guidelines
|
|
86
131
|
|
|
87
132
|
### MCP Protocol Compliance
|
|
@@ -114,13 +159,16 @@ To add new tools:
|
|
|
114
159
|
|
|
115
160
|
The server maintains knowledge of the Zig audio ecosystem:
|
|
116
161
|
|
|
117
|
-
### Libraries
|
|
162
|
+
### Libraries (9 total)
|
|
118
163
|
- **zang** - Synthesis library (MIT)
|
|
119
164
|
- **zaudio** - miniaudio wrapper (MIT)
|
|
120
165
|
- **bonk** - DSP objects (MPL-2.0)
|
|
121
166
|
- **pcm** - File I/O (MIT)
|
|
122
167
|
- **zig-liquid-dsp** - SDR library (MIT)
|
|
123
168
|
- **dalek** - Experimental engine (MIT)
|
|
169
|
+
- **zsynth** - FM synthesis library (MIT)
|
|
170
|
+
- **zig-synth** - Sokol audio wrapper (MIT)
|
|
171
|
+
- **noize** - Simple synthesis library (MIT)
|
|
124
172
|
|
|
125
173
|
### Filter Types
|
|
126
174
|
- Low pass, high pass, band pass, notch
|
package/GEMINI.md
CHANGED
|
@@ -50,13 +50,15 @@ MCP_Zig/
|
|
|
50
50
|
|
|
51
51
|
## MCP Tools
|
|
52
52
|
|
|
53
|
-
The server exposes
|
|
53
|
+
The server exposes 14 tools for AI assistants:
|
|
54
|
+
|
|
55
|
+
### Core Tools (6)
|
|
54
56
|
|
|
55
57
|
### 1. zig_audio_list_libraries
|
|
56
58
|
List available Zig audio/DSP libraries with optional filtering.
|
|
57
59
|
|
|
58
60
|
### 2. zig_audio_library_info
|
|
59
|
-
Get detailed information about a specific library (zang, zaudio, bonk, pcm, zig-liquid-dsp, dalek).
|
|
61
|
+
Get detailed information about a specific library (zang, zaudio, bonk, pcm, zig-liquid-dsp, dalek, zsynth, zig-synth, noize).
|
|
60
62
|
|
|
61
63
|
### 3. zig_dsp_explain_filter
|
|
62
64
|
Explain DSP filter types (lowpass, highpass, bandpass, notch, biquad, one-pole) with formulas and use cases.
|
|
@@ -70,6 +72,56 @@ List learning resources (tutorials, references, examples, articles).
|
|
|
70
72
|
### 6. zig_dsp_get_concepts
|
|
71
73
|
Get explanations of fundamental audio/DSP concepts.
|
|
72
74
|
|
|
75
|
+
### Advanced Tools (8)
|
|
76
|
+
|
|
77
|
+
### 7. zig_audio_recommend_library
|
|
78
|
+
Get intelligent library recommendations based on use case and requirements.
|
|
79
|
+
|
|
80
|
+
### 8. zig_dsp_design_filter
|
|
81
|
+
Design DSP filters with coefficient calculation and stability verification.
|
|
82
|
+
|
|
83
|
+
### 9. zig_audio_verify_code
|
|
84
|
+
Verify Zig code for syntax issues and missing imports.
|
|
85
|
+
|
|
86
|
+
### 10. zig_audio_project_template
|
|
87
|
+
Generate complete project templates for audio applications.
|
|
88
|
+
|
|
89
|
+
### 11. zig_audio_compare_libraries
|
|
90
|
+
Compare multiple Zig audio libraries side-by-side.
|
|
91
|
+
|
|
92
|
+
### 12. zig_audio_troubleshoot
|
|
93
|
+
Debug common audio programming issues and get solutions.
|
|
94
|
+
|
|
95
|
+
### 13. zig_audio_deprecation_check
|
|
96
|
+
Check if a library is deprecated or needs updates for your Zig version.
|
|
97
|
+
|
|
98
|
+
### 14. zig_dsp_calculate_delay
|
|
99
|
+
Convert delay values between milliseconds, samples, feet, and meters.
|
|
100
|
+
|
|
101
|
+
## MCP Resources
|
|
102
|
+
|
|
103
|
+
The server exposes 8 static resources + 2 parameterized templates for direct context access:
|
|
104
|
+
|
|
105
|
+
### Static Resources
|
|
106
|
+
|
|
107
|
+
| URI | Name | Content |
|
|
108
|
+
|-----|------|---------|
|
|
109
|
+
| `zig-audio://libraries` | Zig Audio Libraries | Complete database of 9 libraries |
|
|
110
|
+
| `zig-dsp://filters` | DSP Filter Reference | 6 filter types with formulas |
|
|
111
|
+
| `zig-dsp://concepts` | Audio/DSP Concepts | 5 fundamental concepts |
|
|
112
|
+
| `zig-audio://templates/code` | Code Templates | 9 code snippets |
|
|
113
|
+
| `zig-audio://templates/project` | Project Templates | 5 project skeletons |
|
|
114
|
+
| `zig-audio://resources` | Learning Resources | 11 tutorials/references |
|
|
115
|
+
| `zig-audio://troubleshooting` | Troubleshooting Guide | 6 issue types with solutions |
|
|
116
|
+
| `zig-audio://compatibility` | Compatibility Matrix | Library version info |
|
|
117
|
+
|
|
118
|
+
### Parameterized Templates
|
|
119
|
+
|
|
120
|
+
| URI Template | Purpose |
|
|
121
|
+
|--------------|---------|
|
|
122
|
+
| `zig-audio://libraries/{name}` | Individual library details (zang, zaudio, etc.) |
|
|
123
|
+
| `zig-dsp://filters/{type}` | Individual filter details (lowpass, highpass, etc.) |
|
|
124
|
+
|
|
73
125
|
## Development Guidelines
|
|
74
126
|
|
|
75
127
|
### MCP Protocol Compliance
|
|
@@ -102,13 +154,16 @@ To add new tools:
|
|
|
102
154
|
|
|
103
155
|
The server maintains knowledge of the Zig audio ecosystem:
|
|
104
156
|
|
|
105
|
-
### Libraries
|
|
157
|
+
### Libraries (9 total)
|
|
106
158
|
- **zang** - Synthesis library (MIT)
|
|
107
159
|
- **zaudio** - miniaudio wrapper (MIT)
|
|
108
160
|
- **bonk** - DSP objects (MPL-2.0)
|
|
109
161
|
- **pcm** - File I/O (MIT)
|
|
110
162
|
- **zig-liquid-dsp** - SDR library (MIT)
|
|
111
163
|
- **dalek** - Experimental engine (MIT)
|
|
164
|
+
- **zsynth** - FM synthesis library (MIT)
|
|
165
|
+
- **zig-synth** - Sokol audio wrapper (MIT)
|
|
166
|
+
- **noize** - Simple synthesis library (MIT)
|
|
112
167
|
|
|
113
168
|
### Filter Types
|
|
114
169
|
- Low pass, high pass, band pass, notch
|
|
@@ -146,6 +201,12 @@ When an AI assistant needs to help with Zig audio/DSP programming, it can call t
|
|
|
146
201
|
3. **Generate Code** - Create starter implementations for common patterns
|
|
147
202
|
4. **Learn Concepts** - Understand fundamental audio terminology
|
|
148
203
|
5. **Find Resources** - Locate tutorials and documentation
|
|
204
|
+
6. **Get Recommendations** - Receive intelligent library suggestions based on use cases
|
|
205
|
+
7. **Design Filters** - Interactive DSP filter design with coefficient calculation
|
|
206
|
+
8. **Verify Code** - Check Zig code for syntax issues and missing imports
|
|
207
|
+
9. **Generate Projects** - Create complete project templates with build files
|
|
208
|
+
10. **Troubleshoot Issues** - Debug common audio programming problems
|
|
209
|
+
11. **Access Resources** - Direct context access to reference data via MCP resources
|
|
149
210
|
|
|
150
211
|
## Tool Usage Examples
|
|
151
212
|
|
|
@@ -243,7 +304,7 @@ Before relying on this server for production tasks, AI assistants should verify
|
|
|
243
304
|
npx tsx src/test.ts
|
|
244
305
|
```
|
|
245
306
|
|
|
246
|
-
This runs
|
|
307
|
+
This runs 30 tests covering all tool functionality and MCP resource access.
|
|
247
308
|
|
|
248
309
|
## Integration Points
|
|
249
310
|
|
package/README.md
CHANGED
|
@@ -4,11 +4,11 @@ A Model Context Protocol (MCP) server that provides AI assistance for writing hi
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
MCP Zig Audio is an MCP server that helps LLMs, AI agents, and developers write better Zig code for audio programming, digital signal processing (DSP), and synthesizer development. It provides tools for discovering audio libraries, understanding DSP concepts, explaining filter algorithms,
|
|
7
|
+
MCP Zig Audio is an MCP server that helps LLMs, AI agents, and developers write better Zig code for audio programming, digital signal processing (DSP), and synthesizer development. It provides tools and resources for discovering audio libraries, understanding DSP concepts, explaining filter algorithms, generating starter code, and troubleshooting common issues.
|
|
8
8
|
|
|
9
9
|
## Key Features
|
|
10
10
|
|
|
11
|
-
- **Library Discovery** - Browse and filter through
|
|
11
|
+
- **Library Discovery** - Browse and filter through 9 major Zig audio/DSP libraries
|
|
12
12
|
- **Smart Recommendations** - Get library suggestions based on your specific audio programming needs
|
|
13
13
|
- **DSP Filter Design** - Interactive filter design with coefficient calculation and stability checks
|
|
14
14
|
- **Code Generation** - Generate starter code for oscillators, envelopes, filters, delay lines, and more
|
|
@@ -16,6 +16,8 @@ MCP Zig Audio is an MCP server that helps LLMs, AI agents, and developers write
|
|
|
16
16
|
- **Project Templates** - Generate complete project skeletons with build files
|
|
17
17
|
- **Learning Resources** - Curated tutorials, examples, and documentation references
|
|
18
18
|
- **Core Concepts** - Explanations of fundamental audio/DSP terminology
|
|
19
|
+
- **Troubleshooting** - Debug common audio programming issues with solutions
|
|
20
|
+
- **MCP Resources** - Direct access to reference data via MCP resource URIs
|
|
19
21
|
|
|
20
22
|
## Quick Start
|
|
21
23
|
|
|
@@ -102,7 +104,7 @@ Lists available Zig audio/DSP libraries with optional filtering by category or f
|
|
|
102
104
|
Gets detailed information about a specific Zig audio library.
|
|
103
105
|
|
|
104
106
|
**Parameters:**
|
|
105
|
-
- `library` (required): Library name (zang, zaudio, bonk, pcm, zig-liquid-dsp, dalek)
|
|
107
|
+
- `library` (required): Library name (zang, zaudio, bonk, pcm, zig-liquid-dsp, dalek, zsynth, zig-synth, noize)
|
|
106
108
|
|
|
107
109
|
**Example:**
|
|
108
110
|
```json
|
|
@@ -238,6 +240,62 @@ Generate complete project templates for different types of audio applications.
|
|
|
238
240
|
}
|
|
239
241
|
```
|
|
240
242
|
|
|
243
|
+
### 11. zig_audio_compare_libraries
|
|
244
|
+
|
|
245
|
+
Compare multiple Zig audio libraries side-by-side.
|
|
246
|
+
|
|
247
|
+
**Parameters:**
|
|
248
|
+
- `libraries` (required): Array of library names to compare (2-6 libraries)
|
|
249
|
+
|
|
250
|
+
### 12. zig_audio_troubleshoot
|
|
251
|
+
|
|
252
|
+
Debug common audio programming issues and get solutions.
|
|
253
|
+
|
|
254
|
+
**Parameters:**
|
|
255
|
+
- `issue_type` (required): Type of issue (audio-glitches, latency, no-sound, crash, compilation-error, performance)
|
|
256
|
+
|
|
257
|
+
### 13. zig_audio_deprecation_check
|
|
258
|
+
|
|
259
|
+
Check if a library is deprecated or needs updates for your Zig version.
|
|
260
|
+
|
|
261
|
+
**Parameters:**
|
|
262
|
+
- `library` (required): Library name to check
|
|
263
|
+
- `zig_version` (optional): Your Zig version (defaults to 0.12.0)
|
|
264
|
+
|
|
265
|
+
### 14. zig_dsp_calculate_delay
|
|
266
|
+
|
|
267
|
+
Convert delay values between milliseconds, samples, feet, and meters.
|
|
268
|
+
|
|
269
|
+
**Parameters:**
|
|
270
|
+
- `value` (required): The delay value to convert
|
|
271
|
+
- `from_unit` (required): Unit to convert from (ms, samples, feet, meters)
|
|
272
|
+
- `to_unit` (required): Unit to convert to (ms, samples, feet, meters)
|
|
273
|
+
- `sample_rate` (optional): Sample rate in Hz (defaults to 44100)
|
|
274
|
+
|
|
275
|
+
## MCP Resources
|
|
276
|
+
|
|
277
|
+
The server exposes 8 static resources + 2 parameterized templates for direct context access:
|
|
278
|
+
|
|
279
|
+
### Static Resources
|
|
280
|
+
|
|
281
|
+
| URI | Name | Content |
|
|
282
|
+
|-----|------|---------|
|
|
283
|
+
| `zig-audio://libraries` | Zig Audio Libraries | Complete database of 9 libraries |
|
|
284
|
+
| `zig-dsp://filters` | DSP Filter Reference | 6 filter types with formulas |
|
|
285
|
+
| `zig-dsp://concepts` | Audio/DSP Concepts | 5 fundamental concepts |
|
|
286
|
+
| `zig-audio://templates/code` | Code Templates | 9 code snippets |
|
|
287
|
+
| `zig-audio://templates/project` | Project Templates | 5 project skeletons |
|
|
288
|
+
| `zig-audio://resources` | Learning Resources | 11 tutorials/references |
|
|
289
|
+
| `zig-audio://troubleshooting` | Troubleshooting Guide | 6 issue types with solutions |
|
|
290
|
+
| `zig-audio://compatibility` | Compatibility Matrix | Library version info |
|
|
291
|
+
|
|
292
|
+
### Parameterized Templates
|
|
293
|
+
|
|
294
|
+
| URI Template | Purpose |
|
|
295
|
+
|--------------|---------|
|
|
296
|
+
| `zig-audio://libraries/{name}` | Individual library details (zang, zaudio, etc.) |
|
|
297
|
+
| `zig-dsp://filters/{type}` | Individual filter details (lowpass, highpass, etc.) |
|
|
298
|
+
|
|
241
299
|
## Supported Zig Libraries
|
|
242
300
|
|
|
243
301
|
### zang
|
|
@@ -276,6 +334,24 @@ Generate complete project templates for different types of audio applications.
|
|
|
276
334
|
- **Features:** Data-oriented design, performance optimization
|
|
277
335
|
- **Repository:** https://github.com/chr15m/dalek
|
|
278
336
|
|
|
337
|
+
### zsynth
|
|
338
|
+
- **Description:** Simple FM synthesis library for Zig
|
|
339
|
+
- **License:** MIT
|
|
340
|
+
- **Features:** FM synthesis, operators, modulation
|
|
341
|
+
- **Repository:** https://github.com/zsynth/zsynth
|
|
342
|
+
|
|
343
|
+
### zig-synth
|
|
344
|
+
- **Description:** Zig wrapper for sokol_audio for low-latency audio
|
|
345
|
+
- **License:** MIT
|
|
346
|
+
- **Features:** Low-latency, sokol, playback
|
|
347
|
+
- **Repository:** https://github.com/zig-synth/zig-synth
|
|
348
|
+
|
|
349
|
+
### noize
|
|
350
|
+
- **Description:** Simple audio synthesis library with a focus on ease of use
|
|
351
|
+
- **License:** MIT
|
|
352
|
+
- **Features:** Synthesis, generators, noise
|
|
353
|
+
- **Repository:** https://github.com/noize/noize
|
|
354
|
+
|
|
279
355
|
## DSP Filter Reference
|
|
280
356
|
|
|
281
357
|
### Low Pass Filter
|
|
@@ -398,7 +474,7 @@ This runs the server with tsx for auto-reloading on file changes.
|
|
|
398
474
|
|
|
399
475
|
## Evaluation
|
|
400
476
|
|
|
401
|
-
The project includes an evaluation suite in `evaluation.xml` with
|
|
477
|
+
The project includes an evaluation suite in `evaluation.xml` with Q&A pairs to verify the MCP server correctly answers questions about Zig audio programming.
|
|
402
478
|
|
|
403
479
|
To run evaluation tests:
|
|
404
480
|
|
|
@@ -407,8 +483,8 @@ npx tsx src/test.ts
|
|
|
407
483
|
```
|
|
408
484
|
|
|
409
485
|
Expected output:
|
|
410
|
-
- All
|
|
411
|
-
- Tests cover tool listing, library discovery, filter explanations, code generation, and
|
|
486
|
+
- All 30 tests should pass
|
|
487
|
+
- Tests cover tool listing, library discovery, filter explanations, code generation, concept queries, and MCP resource access
|
|
412
488
|
|
|
413
489
|
## Use Cases
|
|
414
490
|
|