@cyanheads/eur-lex-mcp-server 0.1.1
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/AGENTS.md +383 -0
- package/CLAUDE.md +383 -0
- package/Dockerfile +99 -0
- package/LICENSE +201 -0
- package/README.md +343 -0
- package/changelog/0.1.x/0.1.1.md +31 -0
- package/changelog/template.md +127 -0
- package/dist/config/server-config.d.ts +16 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +43 -0
- package/dist/config/server-config.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/eurlex-comparative-analysis.prompt.d.ts +10 -0
- package/dist/mcp-server/prompts/definitions/eurlex-comparative-analysis.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/eurlex-comparative-analysis.prompt.js +60 -0
- package/dist/mcp-server/prompts/definitions/eurlex-comparative-analysis.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/index.d.ts +9 -0
- package/dist/mcp-server/prompts/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/index.js +7 -0
- package/dist/mcp-server/prompts/definitions/index.js.map +1 -0
- package/dist/mcp-server/resources/definitions/eurlex-document-relations.resource.d.ts +9 -0
- package/dist/mcp-server/resources/definitions/eurlex-document-relations.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/eurlex-document-relations.resource.js +91 -0
- package/dist/mcp-server/resources/definitions/eurlex-document-relations.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/eurlex-document.resource.d.ts +9 -0
- package/dist/mcp-server/resources/definitions/eurlex-document.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/eurlex-document.resource.js +61 -0
- package/dist/mcp-server/resources/definitions/eurlex-document.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/index.d.ts +8 -0
- package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/index.js +11 -0
- package/dist/mcp-server/resources/definitions/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-browse-subjects.tool.d.ts +25 -0
- package/dist/mcp-server/tools/definitions/eurlex-browse-subjects.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-browse-subjects.tool.js +121 -0
- package/dist/mcp-server/tools/definitions/eurlex-browse-subjects.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-cases.tool.d.ts +44 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-cases.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-cases.tool.js +189 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-cases.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-document.tool.d.ts +46 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-document.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-document.tool.js +222 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-document.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-relations.tool.d.ts +38 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-relations.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-relations.tool.js +203 -0
- package/dist/mcp-server/tools/definitions/eurlex-get-relations.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-lookup-celex.tool.d.ts +32 -0
- package/dist/mcp-server/tools/definitions/eurlex-lookup-celex.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-lookup-celex.tool.js +152 -0
- package/dist/mcp-server/tools/definitions/eurlex-lookup-celex.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-query-sparql.tool.d.ts +25 -0
- package/dist/mcp-server/tools/definitions/eurlex-query-sparql.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-query-sparql.tool.js +104 -0
- package/dist/mcp-server/tools/definitions/eurlex-query-sparql.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-search-documents.tool.d.ts +47 -0
- package/dist/mcp-server/tools/definitions/eurlex-search-documents.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/eurlex-search-documents.tool.js +203 -0
- package/dist/mcp-server/tools/definitions/eurlex-search-documents.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/index.d.ts +207 -0
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/index.js +21 -0
- package/dist/mcp-server/tools/definitions/index.js.map +1 -0
- package/dist/services/cellar-sparql/cellar-sparql-service.d.ts +27 -0
- package/dist/services/cellar-sparql/cellar-sparql-service.d.ts.map +1 -0
- package/dist/services/cellar-sparql/cellar-sparql-service.js +123 -0
- package/dist/services/cellar-sparql/cellar-sparql-service.js.map +1 -0
- package/dist/services/cellar-sparql/types.d.ts +62 -0
- package/dist/services/cellar-sparql/types.d.ts.map +1 -0
- package/dist/services/cellar-sparql/types.js +6 -0
- package/dist/services/cellar-sparql/types.js.map +1 -0
- package/dist/services/eurlex-content/eurlex-content-service.d.ts +45 -0
- package/dist/services/eurlex-content/eurlex-content-service.d.ts.map +1 -0
- package/dist/services/eurlex-content/eurlex-content-service.js +93 -0
- package/dist/services/eurlex-content/eurlex-content-service.js.map +1 -0
- package/package.json +105 -0
- package/server.json +161 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
# Developer Protocol
|
|
2
|
+
|
|
3
|
+
**Server:** eur-lex-mcp-server
|
|
4
|
+
**Version:** 0.1.1
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.9.21`
|
|
6
|
+
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
|
+
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.29.0
|
|
8
|
+
**Zod:** ^4.4.3
|
|
9
|
+
|
|
10
|
+
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## What's Next?
|
|
15
|
+
|
|
16
|
+
When the user asks what's next or needs direction, suggest options based on the current project state. Common next steps:
|
|
17
|
+
|
|
18
|
+
1. **Field-test definitions** — exercise tools/resources/prompts with real inputs using the `field-test` skill, get a report of issues and pain points
|
|
19
|
+
2. **Run the `security-pass` skill** — audit handlers for MCP-specific security gaps: output injection, scope blast radius, input sinks, tenant isolation
|
|
20
|
+
3. **Run `devcheck`** — lint, format, typecheck, and security audit
|
|
21
|
+
4. **Add tools/resources/prompts** — scaffold new definitions using the `add-tool`, `add-resource`, `add-prompt` skills
|
|
22
|
+
5. **Run the `maintenance` skill** — investigate changelogs, adopt upstream changes, and sync skills after `bun update --latest`
|
|
23
|
+
|
|
24
|
+
Tailor suggestions to what's actually missing or stale — don't recite the full list every time.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Core Rules
|
|
29
|
+
|
|
30
|
+
- **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
|
|
31
|
+
- **Use `ctx.log`** for request-scoped logging. No `console` calls.
|
|
32
|
+
- **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
|
|
33
|
+
- **Check `ctx.elicit` / `ctx.sample`** for presence before calling.
|
|
34
|
+
- **Secrets in env vars only** — never hardcoded.
|
|
35
|
+
- **Close the loop on issues.** When implementing work tracked by a GitHub issue, comment on the issue with what landed and close it. Do both — a comment without a close leaves stale issues open; a close without a comment leaves no record of what shipped. The comment is for future readers — state the concrete changes, not the conversation that produced them.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Patterns
|
|
40
|
+
|
|
41
|
+
### Tool
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
45
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
46
|
+
import { getCellarSparqlService } from '@/services/cellar-sparql/cellar-sparql-service.js';
|
|
47
|
+
|
|
48
|
+
export const eurlex_browse_subjects = tool('eurlex_browse_subjects', {
|
|
49
|
+
description: 'Search the EuroVoc multilingual thesaurus to resolve a human-readable term into EuroVoc concept IDs.',
|
|
50
|
+
annotations: { readOnlyHint: true, openWorldHint: true, idempotentHint: true },
|
|
51
|
+
input: z.object({
|
|
52
|
+
keyword: z.string().min(1).describe('Search term to match against EuroVoc concept labels.'),
|
|
53
|
+
language: z.string().default('en').describe('Language code for concept labels (e.g. "en", "fr", "de").'),
|
|
54
|
+
limit: z.number().int().min(1).max(50).default(20).describe('Maximum number of concepts to return (1–50).'),
|
|
55
|
+
}),
|
|
56
|
+
output: z.object({
|
|
57
|
+
concepts: z.array(z.object({
|
|
58
|
+
concept_uri: z.string().describe('Full EuroVoc concept URI, usable in the eurovoc_concept filter.'),
|
|
59
|
+
pref_label: z.string().describe('Preferred label in the requested language.'),
|
|
60
|
+
concept_code: z.string().optional().describe('Numeric EuroVoc concept code.'),
|
|
61
|
+
})).describe('Matching EuroVoc concepts.'),
|
|
62
|
+
total_found: z.number().int().describe('Total concepts returned.'),
|
|
63
|
+
keyword: z.string().describe('Search keyword used.'),
|
|
64
|
+
}),
|
|
65
|
+
errors: [
|
|
66
|
+
{ reason: 'no_concepts', code: JsonRpcErrorCode.NotFound,
|
|
67
|
+
when: 'No EuroVoc concepts matched the keyword',
|
|
68
|
+
recovery: 'Try a broader term or retry with language "en".' },
|
|
69
|
+
],
|
|
70
|
+
|
|
71
|
+
async handler(input, ctx) {
|
|
72
|
+
const service = getCellarSparqlService();
|
|
73
|
+
const concepts = await service.browseSubjects(input.keyword, input.language, input.limit);
|
|
74
|
+
if (concepts.length === 0) throw ctx.fail('no_concepts', `No EuroVoc concepts matched "${input.keyword}"`);
|
|
75
|
+
ctx.log.info('EuroVoc subjects found', { keyword: input.keyword, count: concepts.length });
|
|
76
|
+
return { concepts, total_found: concepts.length, keyword: input.keyword };
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
format: (result) => [{
|
|
80
|
+
type: 'text',
|
|
81
|
+
text: result.concepts.map(c => `**${c.pref_label}** (${c.concept_code ?? 'n/a'}): ${c.concept_uri}`).join('\n'),
|
|
82
|
+
}],
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Resource
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
90
|
+
import { notFound } from '@cyanheads/mcp-ts-core/errors';
|
|
91
|
+
import { getCellarSparqlService } from '@/services/cellar-sparql/cellar-sparql-service.js';
|
|
92
|
+
|
|
93
|
+
export const eurlex_document = resource('eurlex://document/{celexNumber}', {
|
|
94
|
+
description: 'Metadata snapshot for a CELLAR work — type, date, title, author institution, in-force flag.',
|
|
95
|
+
params: z.object({ celexNumber: z.string().describe('CELEX number (e.g. 32016R0679 for GDPR).') }),
|
|
96
|
+
async handler(params, ctx) {
|
|
97
|
+
const service = getCellarSparqlService();
|
|
98
|
+
const doc = await service.getDocumentMetadata(params.celexNumber);
|
|
99
|
+
if (!doc) throw notFound(`Work ${params.celexNumber} not found in CELLAR`, { celexNumber: params.celexNumber });
|
|
100
|
+
return doc;
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Server config
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
// src/config/server-config.ts — lazy-parsed, separate from framework config
|
|
109
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
110
|
+
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
111
|
+
|
|
112
|
+
const ServerConfigSchema = z.object({
|
|
113
|
+
cellarSparqlEndpoint: z.string().url()
|
|
114
|
+
.default('http://publications.europa.eu/webapi/rdf/sparql')
|
|
115
|
+
.describe('CELLAR SPARQL endpoint URL'),
|
|
116
|
+
sparqlQueryTimeoutMs: z.coerce.number().int().positive().default(55_000)
|
|
117
|
+
.describe('Client-side timeout for SPARQL requests in milliseconds'),
|
|
118
|
+
maxSparqlResults: z.coerce.number().int().positive().max(100).default(100)
|
|
119
|
+
.describe('Enforced ceiling on LIMIT in generated SPARQL queries'),
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
let _config: z.infer<typeof ServerConfigSchema> | undefined;
|
|
123
|
+
export function getServerConfig() {
|
|
124
|
+
_config ??= parseEnvConfig(ServerConfigSchema, {
|
|
125
|
+
cellarSparqlEndpoint: 'CELLAR_SPARQL_ENDPOINT',
|
|
126
|
+
sparqlQueryTimeoutMs: 'SPARQL_QUERY_TIMEOUT_MS',
|
|
127
|
+
maxSparqlResults: 'MAX_SPARQL_RESULTS',
|
|
128
|
+
});
|
|
129
|
+
return _config;
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`MY_API_KEY`) not the path (`apiKey`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
|
|
134
|
+
|
|
135
|
+
### Server instructions
|
|
136
|
+
|
|
137
|
+
`createApp({ instructions })` — optional server-level orientation, sent to clients on every `initialize` as session-level context. Use it for deployment guidance (connection aliases, regional notes, scope hints) instead of repeating the same context across tool descriptions. Client adoption is uneven, but there's no downside when set.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Context
|
|
142
|
+
|
|
143
|
+
Handlers receive a unified `ctx` object. Key properties:
|
|
144
|
+
|
|
145
|
+
| Property | Description |
|
|
146
|
+
|:---------|:------------|
|
|
147
|
+
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
|
|
148
|
+
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
149
|
+
| `ctx.elicit` | Ask user for structured input. **Check for presence first:** `if (ctx.elicit) { ... }` |
|
|
150
|
+
| `ctx.sample` | Request LLM completion from the client. **Check for presence first:** `if (ctx.sample) { ... }` |
|
|
151
|
+
| `ctx.signal` | `AbortSignal` for cancellation. |
|
|
152
|
+
| `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
|
|
153
|
+
| `ctx.requestId` | Unique request ID. |
|
|
154
|
+
| `ctx.tenantId` | Tenant ID from JWT or `'default'` for stdio. |
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Errors
|
|
159
|
+
|
|
160
|
+
Handlers throw — the framework catches, classifies, and formats.
|
|
161
|
+
|
|
162
|
+
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required descriptive metadata for the agent's next move (≥ 5 words, lint-validated); for the wire `data.recovery.hint` (mirrored into `content[]` text), pass explicitly at the throw site when dynamic context matters: `ctx.fail('reason', msg, { recovery: { hint: '...' } })`. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
166
|
+
|
|
167
|
+
errors: [
|
|
168
|
+
{ reason: 'no_match', code: JsonRpcErrorCode.NotFound,
|
|
169
|
+
when: 'No item matched the query',
|
|
170
|
+
recovery: 'Broaden the query or check the spelling and try again.' },
|
|
171
|
+
],
|
|
172
|
+
async handler(input, ctx) {
|
|
173
|
+
const item = await db.find(input.id);
|
|
174
|
+
if (!item) throw ctx.fail('no_match', `No item ${input.id}`);
|
|
175
|
+
return item;
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Declare contracts inline on each tool.** The contract is part of the tool's public surface — one file should give the full picture. Don't extract a shared `errors[]` constant; per-tool repetition is the intended cost of locality.
|
|
180
|
+
|
|
181
|
+
**Fallback (no contract entry fits):** throw via factories or plain `Error`.
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
// Error factories — explicit code
|
|
185
|
+
import { notFound, serviceUnavailable } from '@cyanheads/mcp-ts-core/errors';
|
|
186
|
+
throw notFound('Item not found', { itemId });
|
|
187
|
+
throw serviceUnavailable('API unavailable', { url }, { cause: err });
|
|
188
|
+
|
|
189
|
+
// Plain Error — framework auto-classifies from message patterns
|
|
190
|
+
throw new Error('Item not found'); // → NotFound
|
|
191
|
+
throw new Error('Invalid query format'); // → ValidationError
|
|
192
|
+
|
|
193
|
+
// McpError — when no factory exists for the code
|
|
194
|
+
import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
195
|
+
throw new McpError(JsonRpcErrorCode.DatabaseError, 'Connection failed', { pool: 'primary' });
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
See framework CLAUDE.md and the `api-errors` skill for the full auto-classification table, all available factories, and the contract reference.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Structure
|
|
203
|
+
|
|
204
|
+
```text
|
|
205
|
+
src/
|
|
206
|
+
index.ts # createApp() entry point
|
|
207
|
+
config/
|
|
208
|
+
server-config.ts # Server-specific env vars (Zod schema)
|
|
209
|
+
services/
|
|
210
|
+
cellar-sparql/
|
|
211
|
+
cellar-sparql-service.ts # CELLAR SPARQL POST client, binding mapper, LIMIT enforcement
|
|
212
|
+
types.ts # SPARQL binding types
|
|
213
|
+
eurlex-content/
|
|
214
|
+
eurlex-content-service.ts # EUR-Lex content API GET client, language fallback
|
|
215
|
+
types.ts # Content API types
|
|
216
|
+
mcp-server/
|
|
217
|
+
tools/definitions/
|
|
218
|
+
eurlex-browse-subjects.tool.ts # EuroVoc thesaurus search
|
|
219
|
+
eurlex-get-cases.tool.ts # CJEU/GC case law search
|
|
220
|
+
eurlex-get-document.tool.ts # Fetch metadata + full text
|
|
221
|
+
eurlex-get-relations.tool.ts # CELLAR relationship graph traversal
|
|
222
|
+
eurlex-lookup-celex.tool.ts # Citation resolution
|
|
223
|
+
eurlex-query-sparql.tool.ts # Raw SPARQL escape hatch
|
|
224
|
+
eurlex-search-documents.tool.ts # Document corpus search
|
|
225
|
+
resources/definitions/
|
|
226
|
+
eurlex-document.resource.ts # eurlex://document/{celexNumber}
|
|
227
|
+
eurlex-document-relations.resource.ts # eurlex://document/{celexNumber}/relations
|
|
228
|
+
prompts/definitions/
|
|
229
|
+
eurlex-comparative-analysis.prompt.ts # EU/US comparative analysis prompt
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Naming
|
|
235
|
+
|
|
236
|
+
| What | Convention | Example |
|
|
237
|
+
|:-----|:-----------|:--------|
|
|
238
|
+
| Files | kebab-case with suffix | `search-docs.tool.ts` |
|
|
239
|
+
| Tool/resource/prompt names | snake_case | `search_docs` |
|
|
240
|
+
| Directories | kebab-case | `src/services/doc-search/` |
|
|
241
|
+
| Descriptions | Single string or template literal, no `+` concatenation | `'Search items by query and filter.'` |
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Skills
|
|
246
|
+
|
|
247
|
+
Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
|
|
248
|
+
|
|
249
|
+
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
250
|
+
|
|
251
|
+
Available skills:
|
|
252
|
+
|
|
253
|
+
| Skill | Purpose |
|
|
254
|
+
|:------|:--------|
|
|
255
|
+
| `setup` | Post-init project orientation |
|
|
256
|
+
| `design-mcp-server` | Design tool surface, resources, and services for a new server |
|
|
257
|
+
| `add-tool` | Scaffold a new tool definition |
|
|
258
|
+
| `add-app-tool` | Scaffold an MCP App tool + paired UI resource |
|
|
259
|
+
| `add-resource` | Scaffold a new resource definition |
|
|
260
|
+
| `add-prompt` | Scaffold a new prompt definition |
|
|
261
|
+
| `add-service` | Scaffold a new service integration |
|
|
262
|
+
| `add-test` | Scaffold test file for a tool, resource, or service |
|
|
263
|
+
| `field-test` | Exercise tools/resources/prompts with real inputs, verify behavior, report issues |
|
|
264
|
+
| `tool-defs-analysis` | Read-only audit of MCP definition language across the surface — voice, leaks, defaults, recovery hints, output descriptions |
|
|
265
|
+
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
266
|
+
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
267
|
+
| `devcheck` | Lint, format, typecheck, audit |
|
|
268
|
+
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
269
|
+
| `git-wrapup` | Land working-tree changes as a versioned commit + annotated tag — version bump, changelog, verify, tag. Local only. |
|
|
270
|
+
| `release-and-publish` | Push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
271
|
+
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
272
|
+
| `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
|
|
273
|
+
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
274
|
+
| `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
|
|
275
|
+
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
276
|
+
| `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
|
|
277
|
+
| `api-config` | AppConfig, parseConfig, env vars |
|
|
278
|
+
| `api-context` | Context interface, logger, state, progress |
|
|
279
|
+
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
280
|
+
| `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
|
|
281
|
+
| `api-services` | LLM, Speech, Graph services |
|
|
282
|
+
| `api-testing` | createMockContext, test patterns |
|
|
283
|
+
| `api-utils` | Formatting, parsing, security, pagination, scheduling, telemetry helpers |
|
|
284
|
+
| `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
|
|
285
|
+
| `api-workers` | Cloudflare Workers runtime |
|
|
286
|
+
|
|
287
|
+
**Chaining skills into pipelines.** When the user wants a multi-phase effort — build this server out, QA-and-fix the surface, update-and-ship — *and you can spawn sub-agents*, `skills/orchestrations/SKILL.md` sequences the task skills above into a gated pipeline with verification at each step. Read it to drive the run. Optional: skip it if you can't orchestrate sub-agents, and ignore it entirely if you were *spawned* as one — you've already been scoped to a single phase.
|
|
288
|
+
|
|
289
|
+
When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Commands
|
|
294
|
+
|
|
295
|
+
**Runtime:** Scripts use `tsx` — both `npm run <cmd>` and `bun run <cmd>` work. `bun` is slightly faster for script invocation but not required.
|
|
296
|
+
|
|
297
|
+
| Command | Purpose |
|
|
298
|
+
|:--------|:--------|
|
|
299
|
+
| `npm run build` | Compile TypeScript |
|
|
300
|
+
| `npm run rebuild` | Clean + build |
|
|
301
|
+
| `npm run clean` | Remove build artifacts |
|
|
302
|
+
| `npm run devcheck` | Lint + format + typecheck + security + changelog sync |
|
|
303
|
+
| `bun run audit:refresh` | Delete `bun.lock`, reinstall, and re-run `bun audit`. Use when `devcheck` flags a transitive advisory — Bun's `update` is sticky on transitive resolutions, so the advisory may be a stale-lockfile false positive. If it survives the refresh, it's real. |
|
|
304
|
+
| `npm run tree` | Generate directory structure doc |
|
|
305
|
+
| `npm run format` | Auto-fix formatting (safe fixes only) |
|
|
306
|
+
| `npm run format:unsafe` | Also apply Biome's unsafe autofixes — review the diff; they can change behavior |
|
|
307
|
+
| `npm test` | Run tests |
|
|
308
|
+
| `npm run start:stdio` | Production mode (stdio) |
|
|
309
|
+
| `npm run start:http` | Production mode (HTTP) |
|
|
310
|
+
| `npm run changelog:build` | Regenerate `CHANGELOG.md` from `changelog/*.md` |
|
|
311
|
+
| `npm run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
|
|
312
|
+
| `npm run bundle` | Build and pack as `.mcpb` for one-click Claude Desktop install |
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Bundling
|
|
317
|
+
|
|
318
|
+
`npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
|
|
319
|
+
|
|
320
|
+
**Adding an env var requires both files:** `server.json` (registry discovery, `environmentVariables[]`) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `lint:packaging` (run by `devcheck`) verifies the env var names match.
|
|
321
|
+
|
|
322
|
+
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `skills/polish-docs-meta/references/readme.md`.
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Changelog
|
|
327
|
+
|
|
328
|
+
Directory-based, grouped by minor series via the `.x` semver-wildcard convention. Source of truth: `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.1.x/0.1.0.md`) — one file per release, shipped in the npm package. At release, author the per-version file with a concrete version and date, then run `npm run changelog:build` to regenerate the rollup. `changelog/template.md` is a **pristine format reference** — never edited or moved; read it for the frontmatter + section layout when scaffolding. `CHANGELOG.md` is a **navigation index** (header + link + summary per version), regenerated by `npm run changelog:build` — devcheck hard-fails on drift; never hand-edit it.
|
|
329
|
+
|
|
330
|
+
Each per-version file opens with YAML frontmatter:
|
|
331
|
+
|
|
332
|
+
```markdown
|
|
333
|
+
---
|
|
334
|
+
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
335
|
+
breaking: false # optional — true flags breaking changes
|
|
336
|
+
security: false # optional — true flags security fixes
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
# 0.1.0 — YYYY-MM-DD
|
|
340
|
+
...
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
`breaking: true` renders a `· ⚠️ Breaking` badge — use it when consumers must update code on upgrade (signature changes, removed APIs, config renames). `security: true` renders a `· 🛡️ Security` badge and pairs with a `## Security` body section. When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
344
|
+
|
|
345
|
+
`agent-notes` is an optional free-form field for maintenance agents processing the release downstream. Content here won't appear in the rendered CHANGELOG — it's consumed by agents running the `maintenance` skill. Use it for adoption instructions that don't fit the human-facing sections: new files to create, fields to populate, one-time migration steps. Omit entirely when there's nothing to say.
|
|
346
|
+
|
|
347
|
+
**Section order** (Keep a Changelog): Added, Changed, Deprecated, Removed, Fixed, Security. Include only sections with entries — don't ship empty headers.
|
|
348
|
+
|
|
349
|
+
**Tag annotations** render as GitHub Release bodies via `--notes-from-tag`. They must be structured markdown — never a flat comma-separated string. Subject omits the version number (GitHub prepends it). See `changelog/template.md` for the full format reference.
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Imports
|
|
354
|
+
|
|
355
|
+
```ts
|
|
356
|
+
// Framework — z is re-exported, no separate zod import needed
|
|
357
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
358
|
+
import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
359
|
+
|
|
360
|
+
// Server's own code — via path alias
|
|
361
|
+
import { getCellarSparqlService } from '@/services/cellar-sparql/cellar-sparql-service.js';
|
|
362
|
+
import { getEurLexContentService } from '@/services/eurlex-content/eurlex-content-service.js';
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## Checklist
|
|
368
|
+
|
|
369
|
+
- [ ] Zod schemas: all fields have `.describe()`, only JSON-Schema-serializable types (no `z.custom()`, `z.date()`, `z.transform()`, `z.bigint()`, `z.symbol()`, `z.void()`, `z.map()`, `z.set()`, `z.function()`, `z.nan()`)
|
|
370
|
+
- [ ] Optional nested objects: handler guards for empty inner values from form-based clients (`if (input.obj?.field && ...)`, not just `if (input.obj)`). When regex/length constraints matter, use `z.union([z.literal(''), z.string().regex(...).describe(...)])` — literal variants are exempt from `describe-on-fields`.
|
|
371
|
+
- [ ] JSDoc `@fileoverview` + `@module` on every file
|
|
372
|
+
- [ ] `ctx.log` for logging, `ctx.state` for storage
|
|
373
|
+
- [ ] Handlers throw on failure — error factories or plain `Error`, no try/catch
|
|
374
|
+
- [ ] `format()` renders all data the LLM needs — different clients forward different surfaces (Claude Code → `structuredContent`, Claude Desktop → `content[]`); both must carry the same data
|
|
375
|
+
- [ ] If wrapping external API: raw/domain/output schemas reviewed against real upstream sparsity/nullability before finalizing required vs optional fields
|
|
376
|
+
- [ ] If wrapping external API: normalization and `format()` preserve uncertainty; do not fabricate facts from missing upstream data
|
|
377
|
+
- [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
|
|
378
|
+
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
379
|
+
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
380
|
+
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` = package name; `interface.shortDescription` from `package.json` description
|
|
381
|
+
- [ ] `.codex-plugin/mcp.json` updated — server name key matches `package.json` name; env vars added for any required API keys
|
|
382
|
+
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry with server name key, env vars for any required API keys
|
|
383
|
+
- [ ] `npm run devcheck` passes
|