@withpica/mcp-server-directory 1.0.0 → 1.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/CHANGELOG.md +56 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -0
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +9 -12
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/public-question-atlas.d.ts +121 -0
- package/dist/prompts/public-question-atlas.d.ts.map +1 -0
- package/dist/prompts/public-question-atlas.js +404 -0
- package/dist/prompts/public-question-atlas.js.map +1 -0
- package/dist/resources/llms-primer.d.ts.map +1 -1
- package/dist/resources/llms-primer.js +1 -0
- package/dist/resources/llms-primer.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -0
- package/dist/server.js.map +1 -1
- package/dist/tools/chain.d.ts +12 -0
- package/dist/tools/chain.d.ts.map +1 -0
- package/dist/tools/chain.js +109 -0
- package/dist/tools/chain.js.map +1 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/people.d.ts +0 -1
- package/dist/tools/people.d.ts.map +1 -1
- package/dist/tools/people.js +24 -36
- package/dist/tools/people.js.map +1 -1
- package/dist/tools/recordings.d.ts.map +1 -1
- package/dist/tools/recordings.js +8 -3
- package/dist/tools/recordings.js.map +1 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +8 -4
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/works.d.ts +0 -1
- package/dist/tools/works.d.ts.map +1 -1
- package/dist/tools/works.js +42 -42
- package/dist/tools/works.js.map +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +1 -0
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/formatting.js +1 -0
- package/dist/utils/formatting.js.map +1 -1
- package/jest.config.js +31 -0
- package/package.json +3 -2
- package/src/__tests__/prompts/index.test.ts +128 -0
- package/src/__tests__/prompts/prompt-eval-harness.test.ts +282 -0
- package/src/__tests__/tools/chain.test.ts +122 -0
- package/src/__tests__/tools/composability-chains.test.ts +100 -0
- package/src/__tests__/tools/people.test.ts +112 -0
- package/src/__tests__/tools/search.test.ts +94 -0
- package/src/__tests__/tools/works.test.ts +177 -0
- package/src/client.ts +128 -0
- package/src/config.ts +23 -0
- package/src/index.ts +36 -0
- package/src/prompts/index.ts +206 -0
- package/src/prompts/public-question-atlas.ts +540 -0
- package/src/resources/llms-primer.ts +35 -0
- package/src/server.ts +134 -0
- package/src/tools/chain.ts +118 -0
- package/src/tools/index.ts +83 -0
- package/src/tools/people.ts +196 -0
- package/src/tools/recordings.ts +149 -0
- package/src/tools/search.ts +66 -0
- package/src/tools/works.ts +266 -0
- package/src/utils/errors.ts +64 -0
- package/src/utils/formatting.ts +28 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Prompt Registry for Directory MCP Server
|
|
5
|
+
* Guided workflows for music discovery, sync licensing, and rights research
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface PromptDefinition {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
arguments?: Array<{
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface PromptMessage {
|
|
19
|
+
role: "user" | "assistant";
|
|
20
|
+
content: {
|
|
21
|
+
type: string;
|
|
22
|
+
text: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface PromptResult {
|
|
27
|
+
messages: PromptMessage[];
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class PromptRegistry {
|
|
32
|
+
listPrompts(): PromptDefinition[] {
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
name: "find-music",
|
|
36
|
+
description:
|
|
37
|
+
"Find music for a sync brief, playlist, or project — search by mood, BPM, key, energy, or description",
|
|
38
|
+
arguments: [
|
|
39
|
+
{
|
|
40
|
+
name: "brief",
|
|
41
|
+
description:
|
|
42
|
+
"What you're looking for — a mood, scene description, or audio characteristics",
|
|
43
|
+
required: false,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "research-creator",
|
|
49
|
+
description:
|
|
50
|
+
"Research a songwriter, composer, or performer — see their works, identifiers, collaborators, and verification status",
|
|
51
|
+
arguments: [
|
|
52
|
+
{
|
|
53
|
+
name: "name_or_id",
|
|
54
|
+
description: "Creator name, IPI number, ISNI, or MusicBrainz ID",
|
|
55
|
+
required: false,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "directory-autopilot",
|
|
61
|
+
description:
|
|
62
|
+
"Not sure where to start? Describe what you need and get routed to the right workflow — sync search, rights research, or identifier lookup",
|
|
63
|
+
arguments: [],
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async getPrompt(
|
|
69
|
+
name: string,
|
|
70
|
+
args?: Record<string, any>,
|
|
71
|
+
): Promise<PromptResult> {
|
|
72
|
+
switch (name) {
|
|
73
|
+
case "find-music":
|
|
74
|
+
return this.getFindMusicPrompt(args?.brief);
|
|
75
|
+
case "research-creator":
|
|
76
|
+
return this.getResearchCreatorPrompt(args?.name_or_id);
|
|
77
|
+
case "directory-autopilot":
|
|
78
|
+
return this.getDirectoryAutopilotPrompt();
|
|
79
|
+
default:
|
|
80
|
+
throw new Error(`Prompt not found: ${name}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private getFindMusicPrompt(brief?: string): PromptResult {
|
|
85
|
+
const briefInstruction = brief
|
|
86
|
+
? `The user is looking for: "${brief}". Translate this into audio search parameters.`
|
|
87
|
+
: `Ask me what I'm looking for — a mood, a scene, a vibe, or specific audio characteristics (BPM, key, energy).`;
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
messages: [
|
|
91
|
+
{
|
|
92
|
+
role: "user",
|
|
93
|
+
content: {
|
|
94
|
+
type: "text",
|
|
95
|
+
text: `Help me find music in the PICA public directory for a sync brief or project.
|
|
96
|
+
|
|
97
|
+
${briefInstruction}
|
|
98
|
+
|
|
99
|
+
Workflow:
|
|
100
|
+
1. Translate the brief into search parameters for directory_search_recordings:
|
|
101
|
+
- Mood descriptions → energy, danceability, key_mode, mood filters
|
|
102
|
+
- "Upbeat" → min_energy: 0.6, min_danceability: 0.5
|
|
103
|
+
- "Dark/moody" → max_energy: 0.4, key_mode: minor
|
|
104
|
+
- "Chill" → max_energy: 0.4, max_bpm: 100
|
|
105
|
+
- Specific requests → use BPM, key, duration filters directly
|
|
106
|
+
|
|
107
|
+
2. Run directory_search_recordings with the parameters.
|
|
108
|
+
|
|
109
|
+
3. For each promising result, use directory_lookup_work to get:
|
|
110
|
+
- Who wrote it (credits with IPI numbers)
|
|
111
|
+
- Whether credits are attested (verified ownership)
|
|
112
|
+
- DSP links (Spotify, Apple Music — so the user can listen)
|
|
113
|
+
- Registration score (higher = cleaner rights chain)
|
|
114
|
+
|
|
115
|
+
4. Present results as a shortlist with:
|
|
116
|
+
- Title, artist, BPM, key, energy
|
|
117
|
+
- Credits summary (who to contact for licensing)
|
|
118
|
+
- Any flags (unattested credits, low registration score, missing ISRC)
|
|
119
|
+
|
|
120
|
+
If no results match, suggest broadening the search (wider BPM range, drop key filter, etc.).
|
|
121
|
+
|
|
122
|
+
Important: This is a public directory — only works from organisations that opted in are visible. If the catalog is small, say so.`,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private getResearchCreatorPrompt(nameOrId?: string): PromptResult {
|
|
130
|
+
const searchInstruction = nameOrId
|
|
131
|
+
? `Look up: "${nameOrId}". Try directory_lookup_person first (it accepts name, IPI, ISNI, or MusicBrainz ID). If that doesn't match, use directory_list_people with a text search.`
|
|
132
|
+
: `Ask me for the creator's name, IPI number, ISNI, or MusicBrainz ID.`;
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
messages: [
|
|
136
|
+
{
|
|
137
|
+
role: "user",
|
|
138
|
+
content: {
|
|
139
|
+
type: "text",
|
|
140
|
+
text: `Help me research a music creator in the PICA public directory.
|
|
141
|
+
|
|
142
|
+
${searchInstruction}
|
|
143
|
+
|
|
144
|
+
Once you find the person, use directory_lookup_person to get their complete profile:
|
|
145
|
+
- Identifiers (IPI, ISNI, MusicBrainz) — essential for rights verification
|
|
146
|
+
- All credited works with roles (writer, composer, performer, producer)
|
|
147
|
+
- Collaborator network — who they work with
|
|
148
|
+
- Verification score — how complete their profile is
|
|
149
|
+
|
|
150
|
+
Then for their most notable works (up to 5), use directory_lookup_work to get:
|
|
151
|
+
- Full credits and splits (are they the sole writer or one of many?)
|
|
152
|
+
- Recordings with ISRCs
|
|
153
|
+
- Audio analysis (BPM, key, energy)
|
|
154
|
+
- DSP links and registration status
|
|
155
|
+
|
|
156
|
+
Present a summary:
|
|
157
|
+
- Creator profile (name, identifiers, role patterns)
|
|
158
|
+
- Catalog overview (how many works, typical roles, common collaborators)
|
|
159
|
+
- Notable works with credit details
|
|
160
|
+
- Any gaps (missing identifiers, unattested credits, low scores)
|
|
161
|
+
|
|
162
|
+
This is useful for: rights research, due diligence before licensing, publisher evaluation, or understanding a catalog before acquisition.`,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
private getDirectoryAutopilotPrompt(): PromptResult {
|
|
170
|
+
return {
|
|
171
|
+
messages: [
|
|
172
|
+
{
|
|
173
|
+
role: "user",
|
|
174
|
+
content: {
|
|
175
|
+
type: "text",
|
|
176
|
+
text: `You've connected to the PICA public music directory. Help me find what I need.
|
|
177
|
+
|
|
178
|
+
First, read the llms://primer resource to understand what's available.
|
|
179
|
+
|
|
180
|
+
Then ask me what I'm looking for. Based on my answer, route to the right workflow:
|
|
181
|
+
|
|
182
|
+
If I'm looking for MUSIC FOR A PROJECT (sync brief, playlist, mood search):
|
|
183
|
+
→ Use the find-music workflow. Translate my description into audio search parameters and search recordings by BPM, key, energy, mood. Then look up full details on promising matches.
|
|
184
|
+
|
|
185
|
+
If I'm looking for INFORMATION ABOUT A CREATOR (songwriter, composer, performer):
|
|
186
|
+
→ Use the research-creator workflow. Look up their profile, works, identifiers, and collaborators.
|
|
187
|
+
|
|
188
|
+
If I have a SPECIFIC IDENTIFIER to resolve (ISRC, ISWC, IPI, ISNI):
|
|
189
|
+
→ Route directly to the right lookup tool:
|
|
190
|
+
- ISRC (e.g. USABC1234567) → directory_lookup_isrc → then directory_lookup_work
|
|
191
|
+
- ISWC (e.g. T-123.456.789-0) → directory_lookup_work
|
|
192
|
+
- IPI or ISNI → directory_lookup_person
|
|
193
|
+
- MusicBrainz ID → directory_lookup_person
|
|
194
|
+
|
|
195
|
+
If I want to BROWSE what's in the directory:
|
|
196
|
+
→ Use directory_search with a broad query, or directory_list_works / directory_list_people to paginate.
|
|
197
|
+
|
|
198
|
+
Tell me which workflow you chose and why, in one sentence. Offer alternatives.
|
|
199
|
+
|
|
200
|
+
Important: This is a read-only public directory. I can search and look up, but I can't create or modify anything. Only works from organisations that opted into the directory are visible.`,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|