Commit ab92fd0
feat: accept api_key for authentication in create_new_artist MCP tool (#118)
* feat: accept api_key for authentication in create_new_artist MCP tool
- Add optional api_key parameter to resolve account_id automatically
- Use getApiKeyDetails to validate API key and get accountId
- Support account_id override for org API keys with access validation
- Return clear error messages for invalid keys or access denied
- Add comprehensive tests for new authentication flow
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: move API key authentication to MCP server level
- Implement withMcpAuth wrapper for MCP server-level authentication
- Remove api_key parameter from create_new_artist tool schema
- Tool now receives accountId via extra.authInfo from the auth layer
- MCP server accepts API key via Authorization: Bearer or x-api-key header
- Update tests to use new auth flow with mock authInfo
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: require API key authentication for MCP server
Unauthenticated requests will now receive a 401 response.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: extract verifyApiKey to lib/mcp/verifyApiKey.ts
Follow SRP - move auth verification to its own module.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: use Authorization: Bearer header for MCP API key auth
Remove x-api-key header support, use only Authorization: Bearer.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: add McpAuthInfo type for typed auth info access
Export McpAuthInfo and McpAuthInfoExtra types from verifyApiKey.ts
for use in tool handlers.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: extract resolveAccountId to lib/mcp/resolveAccountId.ts
Move account resolution logic with org access validation to its own module.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: add index signature to McpAuthInfoExtra for AuthInfo compatibility
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 7409482 commit ab92fd0
File tree
5 files changed
+302
-55
lines changed- app/mcp
- lib/mcp
- tools/artists
- __tests__
5 files changed
+302
-55
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
3 | 4 | | |
4 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
5 | 16 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
27 | 21 | | |
28 | 22 | | |
29 | 23 | | |
| |||
32 | 26 | | |
33 | 27 | | |
34 | 28 | | |
35 | | - | |
36 | 29 | | |
37 | 30 | | |
38 | 31 | | |
| |||
43 | 36 | | |
44 | 37 | | |
45 | 38 | | |
46 | | - | |
47 | 39 | | |
48 | 40 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
Lines changed: 166 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
15 | 22 | | |
16 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
17 | 48 | | |
18 | 49 | | |
19 | | - | |
| 50 | + | |
20 | 51 | | |
21 | 52 | | |
22 | 53 | | |
| |||
40 | 71 | | |
41 | 72 | | |
42 | 73 | | |
43 | | - | |
| 74 | + | |
44 | 75 | | |
45 | 76 | | |
46 | 77 | | |
| |||
50 | 81 | | |
51 | 82 | | |
52 | 83 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
57 | 91 | | |
58 | 92 | | |
59 | 93 | | |
| |||
66 | 100 | | |
67 | 101 | | |
68 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
69 | 131 | | |
70 | 132 | | |
71 | 133 | | |
| |||
77 | 139 | | |
78 | 140 | | |
79 | 141 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
85 | 150 | | |
86 | 151 | | |
87 | 152 | | |
| |||
104 | 169 | | |
105 | 170 | | |
106 | 171 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
112 | 180 | | |
113 | 181 | | |
114 | 182 | | |
115 | 183 | | |
116 | 184 | | |
117 | 185 | | |
118 | 186 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
123 | 194 | | |
124 | 195 | | |
125 | 196 | | |
| |||
134 | 205 | | |
135 | 206 | | |
136 | 207 | | |
137 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
138 | 231 | | |
139 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
140 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
141 | 266 | | |
142 | 267 | | |
143 | 268 | | |
144 | 269 | | |
145 | 270 | | |
146 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
147 | 290 | | |
148 | 291 | | |
149 | 292 | | |
| |||
0 commit comments