@agentailor/create-mcp-server 0.10.0 → 0.12.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.
Files changed (53) hide show
  1. package/README.md +8 -2
  2. package/dist/cli.d.ts +1 -2
  3. package/dist/cli.js +10 -7
  4. package/dist/cli.test.js +29 -48
  5. package/dist/project-generator.js +21 -28
  6. package/dist/skills.d.ts +9 -0
  7. package/dist/skills.js +9 -0
  8. package/dist/templates/common/agents.md.js +60 -3
  9. package/dist/templates/common/agents.md.test.js +28 -0
  10. package/dist/templates/common/package.json.js +13 -12
  11. package/dist/templates/common/skill-readme.d.ts +8 -0
  12. package/dist/templates/common/skill-readme.js +35 -0
  13. package/dist/templates/common/skill-readme.test.js +25 -0
  14. package/dist/templates/common/types.d.ts +6 -1
  15. package/dist/templates/sdk/{stateless → http}/index.d.ts +2 -1
  16. package/dist/templates/sdk/{stateless → http}/index.js +2 -1
  17. package/dist/templates/sdk/{stateless → http}/readme.js +9 -13
  18. package/dist/templates/sdk/{stateless → http}/server-test.js +59 -3
  19. package/dist/templates/sdk/{stateless → http}/store.js +5 -0
  20. package/dist/templates/sdk/{stateless → http}/templates.test.js +119 -1
  21. package/dist/templates/sdk/{stateless → http}/tools.js +135 -1
  22. package/dist/templates/sdk/stdio/index.d.ts +6 -6
  23. package/dist/templates/sdk/stdio/index.js +6 -6
  24. package/dist/templates/sdk/stdio/readme.js +9 -13
  25. package/dist/templates/sdk/stdio/server.d.ts +1 -1
  26. package/dist/templates/sdk/stdio/server.js +2 -2
  27. package/dist/templates/sdk/stdio/templates.test.js +2 -2
  28. package/package.json +1 -1
  29. package/dist/templates/sdk/stateful/index.d.ts +0 -11
  30. package/dist/templates/sdk/stateful/index.js +0 -12
  31. package/dist/templates/sdk/stateful/readme.d.ts +0 -1
  32. package/dist/templates/sdk/stateful/readme.js +0 -3
  33. package/dist/templates/sdk/stateful/server.d.ts +0 -1
  34. package/dist/templates/sdk/stateful/server.js +0 -2
  35. package/dist/templates/sdk/stateful/templates.test.js +0 -198
  36. /package/dist/templates/{sdk/stateful/auth.test.d.ts → common/skill-readme.test.d.ts} +0 -0
  37. /package/dist/templates/sdk/{stateful → http}/auth.d.ts +0 -0
  38. /package/dist/templates/sdk/{stateful → http}/auth.js +0 -0
  39. /package/dist/templates/sdk/{stateful/templates.test.d.ts → http/auth.test.d.ts} +0 -0
  40. /package/dist/templates/sdk/{stateful → http}/auth.test.js +0 -0
  41. /package/dist/templates/sdk/{stateless → http}/prompts.d.ts +0 -0
  42. /package/dist/templates/sdk/{stateless → http}/prompts.js +0 -0
  43. /package/dist/templates/sdk/{stateless → http}/readme.d.ts +0 -0
  44. /package/dist/templates/sdk/{stateless → http}/resources.d.ts +0 -0
  45. /package/dist/templates/sdk/{stateless → http}/resources.js +0 -0
  46. /package/dist/templates/sdk/{stateless → http}/server-test.d.ts +0 -0
  47. /package/dist/templates/sdk/{stateless → http}/server.d.ts +0 -0
  48. /package/dist/templates/sdk/{stateless → http}/server.js +0 -0
  49. /package/dist/templates/sdk/{stateless → http}/store-test.d.ts +0 -0
  50. /package/dist/templates/sdk/{stateless → http}/store-test.js +0 -0
  51. /package/dist/templates/sdk/{stateless → http}/store.d.ts +0 -0
  52. /package/dist/templates/sdk/{stateless → http}/templates.test.d.ts +0 -0
  53. /package/dist/templates/sdk/{stateless → http}/tools.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  export type { SdkTemplateOptions as TemplateOptions } from '../../common/types.js';
2
2
  import type { SdkTemplateOptions } from '../../common/types.js';
3
3
  /**
4
- * Shared HTTP entrypoint template, used by both SDK HTTP template types.
4
+ * HTTP entrypoint template.
5
5
  * Varies only by `options.withOAuth`.
6
6
  */
7
7
  export declare function getIndexTemplate(options?: SdkTemplateOptions): string;
@@ -13,3 +13,4 @@ export { getPromptsTemplate } from './prompts.js';
13
13
  export { getResourcesTemplate } from './resources.js';
14
14
  export { getStoreTestTemplate } from './store-test.js';
15
15
  export { getServerTestTemplate } from './server-test.js';
16
+ export { getAuthTemplate } from './auth.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Shared HTTP entrypoint template, used by both SDK HTTP template types.
2
+ * HTTP entrypoint template.
3
3
  * Varies only by `options.withOAuth`.
4
4
  */
5
5
  export function getIndexTemplate(options) {
@@ -99,3 +99,4 @@ export { getPromptsTemplate } from './prompts.js';
99
99
  export { getResourcesTemplate } from './resources.js';
100
100
  export { getStoreTestTemplate } from './store-test.js';
101
101
  export { getServerTestTemplate } from './server-test.js';
102
+ export { getAuthTemplate } from './auth.js';
@@ -1,3 +1,4 @@
1
+ import { getSkillReadmeSection } from '../../common/skill-readme.js';
1
2
  /**
2
3
  * Shared README template, used by both SDK HTTP template types.
3
4
  * Varies only by `options.withOAuth`.
@@ -187,6 +188,13 @@ well. Notes are held in memory, so they last until the process restarts.
187
188
  - \`body\`: Plain text
188
189
  - \`tags\` (optional): Tags used to filter in \`list_notes\`
189
190
 
191
+ - **delete_note** - Delete a note, after asking the user to confirm.
192
+ - \`id\`: Note id as returned by \`list_notes\` or \`create_note\`
193
+
194
+ Uses elicitation: the client shows the user a Delete it / Keep it choice
195
+ before anything happens. Declining, dismissing, or a client that cannot ask
196
+ all return \`deleted: false\` with the reason, never a silent success.
197
+
190
198
  ### Resources
191
199
 
192
200
  - **notes://{id}** - A single note as JSON. Listing the resource enumerates
@@ -236,19 +244,7 @@ docker run -p 3000:3000 ${projectName}
236
244
  instance is discarded between calls.
237
245
  - Modify the HTTP handler and Express configuration in \`src/index.ts\`${customizationOAuthNote}
238
246
 
239
- ## Tool design skill
240
-
241
- Agentailor's [tool-design](https://github.com/agentailor/skills) skill is
242
- included at \`.agents/skills/tool-design/\`, so a coding agent working here has
243
- the guidance on hand. Commit it so the whole team gets the same copy.
244
-
245
- It is the version that shipped with the scaffolding CLI. To check for a newer
246
- one — your call, not automatic:
247
-
248
- \`\`\`bash
249
- npx skills update -p -y
250
- \`\`\`
251
-
247
+ ${getSkillReadmeSection(options?.withSkills ?? true)}
252
248
  ## Learn More
253
249
 
254
250
  - [Model Context Protocol](https://modelcontextprotocol.io/)
@@ -2,7 +2,7 @@ export function getServerTestTemplate() {
2
2
  return `import { describe, it, expect, beforeEach } from 'vitest';
3
3
  import { InMemoryTransport } from '@modelcontextprotocol/server';
4
4
  import { Client } from '@modelcontextprotocol/client';
5
- import type { CallToolResult } from '@modelcontextprotocol/server';
5
+ import type { CallToolResult, ElicitResult } from '@modelcontextprotocol/server';
6
6
  import { getServer } from './server.js';
7
7
  import * as notes from './notes-store.js';
8
8
 
@@ -16,9 +16,20 @@ import * as notes from './notes-store.js';
16
16
  // the surface an agent reads, and a tool can be internally correct while still
17
17
  // returning something misleading.
18
18
 
19
- async function connect(): Promise<Client> {
19
+ /**
20
+ * Connects a client. Pass an answer to make it a client that supports
21
+ * elicitation: it answers every question the server asks with that result,
22
+ * standing in for the user.
23
+ */
24
+ async function connect(answer?: ElicitResult): Promise<Client> {
20
25
  const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
21
- const client = new Client({ name: 'test', version: '1.0.0' });
26
+ const client = new Client(
27
+ { name: 'test', version: '1.0.0' },
28
+ { capabilities: answer ? { elicitation: { form: {} } } : {} }
29
+ );
30
+ if (answer) {
31
+ client.setRequestHandler('elicitation/create', async () => answer);
32
+ }
22
33
  await Promise.all([getServer().connect(serverTransport), client.connect(clientTransport)]);
23
34
  return client;
24
35
  }
@@ -170,6 +181,51 @@ describe('server', () => {
170
181
  const read = await client.readResource({ uri });
171
182
  expect(JSON.parse(read.contents[0].text as string).title).toBe('Ship v2');
172
183
  });
184
+
185
+ it('deletes only when the user says yes', async () => {
186
+ // Every way of not saying yes must leave the note in place and say why.
187
+ // A bare success here would let the agent tell the user it deleted
188
+ // something it did not.
189
+ const answers: Array<[ElicitResult, boolean]> = [
190
+ [{ action: 'accept', content: { decision: 'delete' } }, true],
191
+ [{ action: 'accept', content: { decision: 'keep' } }, false],
192
+ [{ action: 'decline' }, false],
193
+ [{ action: 'cancel' }, false],
194
+ ];
195
+
196
+ for (const [answer, deleted] of answers) {
197
+ const asking = await connect(answer);
198
+ const note = notes.create({ title: 'Ship v2', body: '' });
199
+
200
+ const result = payload(
201
+ (await asking.callTool({
202
+ name: 'delete_note',
203
+ arguments: { id: note.id },
204
+ })) as CallToolResult
205
+ );
206
+
207
+ expect(result.deleted, answer.action).toBe(deleted);
208
+ expect(notes.get(note.id) === undefined).toBe(deleted);
209
+ if (!deleted) expect(result.reason).toBeTruthy();
210
+ }
211
+ });
212
+
213
+ it('says so when the client cannot ask the user', async () => {
214
+ // Asking a client without the elicitation capability fails the call, so
215
+ // the tool has to notice first and explain, rather than error or guess.
216
+ const note = notes.create({ title: 'Ship v2', body: '' });
217
+
218
+ const result = payload(
219
+ (await client.callTool({
220
+ name: 'delete_note',
221
+ arguments: { id: note.id },
222
+ })) as CallToolResult
223
+ );
224
+
225
+ expect(result.deleted).toBe(false);
226
+ expect(result.reason).toContain('could not be asked');
227
+ expect(notes.get(note.id)).toBeDefined();
228
+ });
173
229
  });
174
230
  `;
175
231
  }
@@ -97,6 +97,11 @@ export function create(input: { title: string; body: string; tags?: string[] }):
97
97
  return note;
98
98
  }
99
99
 
100
+ /** Deletes a note. Returns false when no note had that id. */
101
+ export function remove(id: string): boolean {
102
+ return notes.delete(id);
103
+ }
104
+
100
105
  /** Test helper: replaces all notes. Not part of the tool surface. */
101
106
  export function seedForTests(seed: Note[]): void {
102
107
  notes.clear();
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from 'vitest';
2
2
  import { getServerTemplate, getIndexTemplate, getReadmeTemplate, getStoreTemplate, getToolsTemplate, getPromptsTemplate, getResourcesTemplate, getStoreTestTemplate, getServerTestTemplate, } from './index.js';
3
- describe('sdk/stateless templates', () => {
3
+ describe('sdk/http templates', () => {
4
4
  const projectName = 'test-project';
5
5
  describe('getServerTemplate', () => {
6
6
  it('should include project name in server config', () => {
@@ -43,6 +43,35 @@ describe('sdk/stateless templates', () => {
43
43
  expect(template).toContain("'list_notes'");
44
44
  expect(template).toContain("'get_note'");
45
45
  expect(template).toContain("'create_note'");
46
+ expect(template).toContain("'delete_note'");
47
+ });
48
+ // delete_note is the elicitation example. These pin the parts that are
49
+ // easy to lose in an edit and fail quietly when they go.
50
+ describe('delete_note elicitation', () => {
51
+ it('asks with the 2026-07-28 input-required return, not a mid-call request', () => {
52
+ const template = getToolsTemplate();
53
+ expect(template).toContain('inputRequired({');
54
+ expect(template).toContain('inputRequired.elicit(');
55
+ expect(template).not.toContain('elicitInput');
56
+ });
57
+ it('checks the client capability before asking', () => {
58
+ // Without it, a client that cannot elicit gets a protocol error.
59
+ const template = getToolsTemplate();
60
+ expect(template).toContain('CLIENT_CAPABILITIES_META_KEY');
61
+ expect(template).toContain('getClientCapabilities()');
62
+ });
63
+ it('validates the answer and reports every way of not saying yes', () => {
64
+ const template = getToolsTemplate();
65
+ expect(template).toContain('acceptedContent(ctx.mcpReq.inputResponses');
66
+ for (const action of ['accept:', 'decline:', 'cancel:']) {
67
+ expect(template).toContain(action);
68
+ }
69
+ });
70
+ it('uses a labelled single-select choice', () => {
71
+ const template = getToolsTemplate();
72
+ expect(template).toContain("{ const: 'delete', title: 'Delete it' }");
73
+ expect(template).toContain("{ const: 'keep', title: 'Keep it' }");
74
+ });
46
75
  });
47
76
  // Most MCP clients prepend the server name, so a hardcoded prefix would
48
77
  // surface as "my-server_notes_list".
@@ -284,4 +313,93 @@ describe('sdk/stateless templates', () => {
284
313
  }
285
314
  });
286
315
  });
316
+ describe('getIndexTemplate with OAuth', () => {
317
+ it('should include auth imports when OAuth enabled', () => {
318
+ const template = getIndexTemplate({ withOAuth: true });
319
+ expect(template).toContain("from './auth.js'");
320
+ expect(template).toContain('setupAuthMetadataRouter');
321
+ expect(template).toContain('authMiddleware');
322
+ expect(template).toContain('getOAuthMetadataUrl');
323
+ });
324
+ it('should import validateOAuthConfig when OAuth enabled', () => {
325
+ const template = getIndexTemplate({ withOAuth: true });
326
+ expect(template).toContain('validateOAuthConfig');
327
+ });
328
+ it('should setup auth metadata router when OAuth enabled', () => {
329
+ const template = getIndexTemplate({ withOAuth: true });
330
+ expect(template).toContain('setupAuthMetadataRouter(app)');
331
+ });
332
+ it('should apply auth middleware to the /mcp route when OAuth enabled', () => {
333
+ const template = getIndexTemplate({ withOAuth: true });
334
+ expect(template).toContain("app.all('/mcp', authMiddleware,");
335
+ });
336
+ it('should log OAuth metadata URL on startup when OAuth enabled', () => {
337
+ const template = getIndexTemplate({ withOAuth: true });
338
+ expect(template).toContain('getOAuthMetadataUrl()');
339
+ });
340
+ it('should call validateOAuthConfig before starting server when OAuth enabled', () => {
341
+ const template = getIndexTemplate({ withOAuth: true });
342
+ expect(template).toContain('await validateOAuthConfig()');
343
+ });
344
+ it('should wrap server startup in async main function when OAuth enabled', () => {
345
+ const template = getIndexTemplate({ withOAuth: true });
346
+ expect(template).toContain('async function main()');
347
+ expect(template).toContain('main().catch');
348
+ });
349
+ it('should exit with error if OAuth validation fails', () => {
350
+ const template = getIndexTemplate({ withOAuth: true });
351
+ expect(template).toContain('Failed to start server');
352
+ expect(template).toContain('process.exit(1)');
353
+ });
354
+ it('should NOT include auth imports when OAuth disabled', () => {
355
+ const template = getIndexTemplate({ withOAuth: false });
356
+ expect(template).not.toContain("from './auth.js'");
357
+ expect(template).not.toContain('authMiddleware');
358
+ });
359
+ it('should NOT include auth imports by default', () => {
360
+ const template = getIndexTemplate();
361
+ expect(template).not.toContain("from './auth.js'");
362
+ });
363
+ it('should NOT wrap in async main when OAuth disabled', () => {
364
+ const template = getIndexTemplate({ withOAuth: false });
365
+ expect(template).not.toContain('async function main()');
366
+ });
367
+ });
368
+ describe('getReadmeTemplate with OAuth', () => {
369
+ it('should include OAuth section when enabled', () => {
370
+ const template = getReadmeTemplate(projectName, { withOAuth: true });
371
+ expect(template).toContain('## OAuth Authentication');
372
+ expect(template).toContain('OAUTH_ISSUER_URL');
373
+ expect(template).toContain('OAUTH_AUDIENCE');
374
+ expect(template).toContain('Bearer token');
375
+ });
376
+ it('should list supported OAuth providers', () => {
377
+ const template = getReadmeTemplate(projectName, { withOAuth: true });
378
+ expect(template).toContain('Auth0');
379
+ expect(template).toContain('Keycloak');
380
+ expect(template).toContain('Azure AD');
381
+ expect(template).toContain('Okta');
382
+ });
383
+ it('should document JWKS-based JWT validation', () => {
384
+ const template = getReadmeTemplate(projectName, { withOAuth: true });
385
+ expect(template).toContain('JWT');
386
+ expect(template).toContain('.well-known/jwks.json');
387
+ });
388
+ it('should document where auth info surfaces to handlers', () => {
389
+ const template = getReadmeTemplate(projectName, { withOAuth: true });
390
+ expect(template).toContain('ctx.http.authInfo');
391
+ });
392
+ it('should include auth.ts in project structure when OAuth enabled', () => {
393
+ const template = getReadmeTemplate(projectName, { withOAuth: true });
394
+ expect(template).toContain('auth.ts');
395
+ });
396
+ it('should NOT include OAuth section when disabled', () => {
397
+ const template = getReadmeTemplate(projectName, { withOAuth: false });
398
+ expect(template).not.toContain('## OAuth Authentication');
399
+ });
400
+ it('should NOT include OAuth section by default', () => {
401
+ const template = getReadmeTemplate(projectName);
402
+ expect(template).not.toContain('## OAuth Authentication');
403
+ });
404
+ });
287
405
  });
@@ -1,5 +1,17 @@
1
1
  export function getToolsTemplate() {
2
- return `import type { CallToolResult, McpServer } from '@modelcontextprotocol/server';
2
+ return `import {
3
+ acceptedContent,
4
+ CLIENT_CAPABILITIES_META_KEY,
5
+ inputRequired,
6
+ inputResponse,
7
+ } from '@modelcontextprotocol/server';
8
+ import type {
9
+ CallToolResult,
10
+ ClientCapabilities,
11
+ InputRequiredResult,
12
+ McpServer,
13
+ ServerContext,
14
+ } from '@modelcontextprotocol/server';
3
15
  import { z } from 'zod';
4
16
  import * as notes from './notes-store.js';
5
17
 
@@ -148,6 +160,128 @@ export function registerTools(server: McpServer): void {
148
160
  }
149
161
  }
150
162
  );
163
+
164
+ server.registerTool(
165
+ 'delete_note',
166
+ {
167
+ description:
168
+ 'Permanently delete a note by its id. The user is asked to confirm ' +
169
+ 'first, and nothing is deleted without their yes. Returns deleted: true ' +
170
+ 'when the note is gone, or deleted: false with the reason - the user ' +
171
+ 'kept it, dismissed the question, or this client cannot ask them.',
172
+ inputSchema: z.object({
173
+ id: z
174
+ .string()
175
+ .describe(
176
+ 'Id of the note to delete, exactly as returned by list_notes or ' +
177
+ 'create_note. Example: "note_0000000a".'
178
+ ),
179
+ }),
180
+ annotations: { destructiveHint: true },
181
+ },
182
+ async ({ id }, ctx): Promise<CallToolResult | InputRequiredResult> => {
183
+ const note = notes.get(id);
184
+ if (!note) {
185
+ return toolError(
186
+ \`No note has id "\${id}", so nothing was deleted. \` +
187
+ 'Call list_notes to see the available notes and their ids.'
188
+ );
189
+ }
190
+
191
+ // Elicitation runs in two rounds. The first call has no answer yet, so
192
+ // the tool returns the question instead of a result. The client shows it
193
+ // to the user and calls the tool again with their answer attached.
194
+ const answer = inputResponse(ctx.mcpReq.inputResponses, CONFIRM_KEY);
195
+
196
+ if (answer.kind !== 'elicit') {
197
+ // Asking a client that cannot answer fails the whole call, so check
198
+ // first and say plainly why nothing happened.
199
+ if (!canAskUser(server, ctx)) {
200
+ return toolJson({
201
+ deleted: false,
202
+ id,
203
+ reason:
204
+ 'The user could not be asked to confirm (this client or connection ' +
205
+ 'does not support elicitation), so the note was not deleted. Ask ' +
206
+ 'the user to delete it themselves.',
207
+ });
208
+ }
209
+
210
+ return inputRequired({
211
+ inputRequests: {
212
+ [CONFIRM_KEY]: inputRequired.elicit({
213
+ message: \`Delete the note "\${note.title}"? This cannot be undone.\`,
214
+ requestedSchema: CONFIRM_FORM,
215
+ }),
216
+ },
217
+ });
218
+ }
219
+
220
+ // The answer comes from the client, so validate it rather than trust it.
221
+ const decision = acceptedContent(ctx.mcpReq.inputResponses, CONFIRM_KEY, ConfirmAnswer);
222
+
223
+ if (decision?.decision !== 'delete') {
224
+ const reason =
225
+ answer.action === 'accept' && decision === undefined
226
+ ? 'The answer did not match the form, so the note was kept.'
227
+ : NOT_DELETED[answer.action];
228
+ return toolJson({ deleted: false, id, reason });
229
+ }
230
+
231
+ if (!notes.remove(id)) {
232
+ return toolError(\`Note "\${id}" was already deleted.\`);
233
+ }
234
+ return toolJson({ deleted: true, id });
235
+ }
236
+ );
237
+ }
238
+
239
+ const CONFIRM_KEY = 'confirm';
240
+
241
+ // The form the user sees: one required choice. oneOf with const + title is the
242
+ // spec's labelled single-select, so clients can show "Delete it" rather than
243
+ // the raw value. Keep elicitation forms this small - they interrupt the user.
244
+ const CONFIRM_FORM = {
245
+ type: 'object' as const,
246
+ properties: {
247
+ decision: {
248
+ type: 'string' as const,
249
+ title: 'Delete this note?',
250
+ oneOf: [
251
+ { const: 'delete', title: 'Delete it' },
252
+ { const: 'keep', title: 'Keep it' },
253
+ ],
254
+ },
255
+ },
256
+ required: ['decision'],
257
+ };
258
+
259
+ const ConfirmAnswer = z.object({ decision: z.enum(['delete', 'keep']) });
260
+
261
+ // Each way of not saying yes gets its own reason, so the agent can report what
262
+ // actually happened instead of a bare "not deleted".
263
+ const NOT_DELETED = {
264
+ accept: 'The user chose to keep the note.',
265
+ decline: 'The user declined to delete the note.',
266
+ cancel: 'The user dismissed the question without answering, so the note was kept.',
267
+ } as const;
268
+
269
+ /**
270
+ * True when the client can show the user a form on this request.
271
+ *
272
+ * 2026-07-28 clients send their capabilities with every request; 2025-era
273
+ * clients declared them once, when they connected. Over HTTP a 2025-era client
274
+ * reads as unable to ask: each request gets a fresh server, so there is no
275
+ * connection to carry the question back.
276
+ */
277
+ function canAskUser(server: McpServer, ctx: ServerContext): boolean {
278
+ const envelope = ctx.mcpReq.envelope as Record<string, unknown> | undefined;
279
+ const capabilities =
280
+ (envelope?.[CLIENT_CAPABILITIES_META_KEY] as ClientCapabilities | undefined) ??
281
+ server.server.getClientCapabilities();
282
+ const elicitation = capabilities?.elicitation;
283
+ // An empty elicitation capability means form mode, from before modes existed.
284
+ return elicitation !== undefined && (elicitation.form !== undefined || elicitation.url === undefined);
151
285
  }
152
286
 
153
287
  /** Wraps a payload as the JSON text result an agent reads. */
@@ -3,9 +3,9 @@ import type { SdkTemplateOptions } from '../../common/types.js';
3
3
  export declare function getIndexTemplate(_options?: SdkTemplateOptions): string;
4
4
  export { getServerTemplate } from './server.js';
5
5
  export { getReadmeTemplate } from './readme.js';
6
- export { getStoreTemplate } from '../stateless/store.js';
7
- export { getToolsTemplate } from '../stateless/tools.js';
8
- export { getPromptsTemplate } from '../stateless/prompts.js';
9
- export { getResourcesTemplate } from '../stateless/resources.js';
10
- export { getStoreTestTemplate } from '../stateless/store-test.js';
11
- export { getServerTestTemplate } from '../stateless/server-test.js';
6
+ export { getStoreTemplate } from '../http/store.js';
7
+ export { getToolsTemplate } from '../http/tools.js';
8
+ export { getPromptsTemplate } from '../http/prompts.js';
9
+ export { getResourcesTemplate } from '../http/resources.js';
10
+ export { getStoreTestTemplate } from '../http/store-test.js';
11
+ export { getServerTestTemplate } from '../http/server-test.js';
@@ -12,9 +12,9 @@ console.error('MCP Server running on stdio');
12
12
  }
13
13
  export { getServerTemplate } from './server.js';
14
14
  export { getReadmeTemplate } from './readme.js';
15
- export { getStoreTemplate } from '../stateless/store.js';
16
- export { getToolsTemplate } from '../stateless/tools.js';
17
- export { getPromptsTemplate } from '../stateless/prompts.js';
18
- export { getResourcesTemplate } from '../stateless/resources.js';
19
- export { getStoreTestTemplate } from '../stateless/store-test.js';
20
- export { getServerTestTemplate } from '../stateless/server-test.js';
15
+ export { getStoreTemplate } from '../http/store.js';
16
+ export { getToolsTemplate } from '../http/tools.js';
17
+ export { getPromptsTemplate } from '../http/prompts.js';
18
+ export { getResourcesTemplate } from '../http/resources.js';
19
+ export { getStoreTestTemplate } from '../http/store-test.js';
20
+ export { getServerTestTemplate } from '../http/server-test.js';
@@ -1,3 +1,4 @@
1
+ import { getSkillReadmeSection } from '../../common/skill-readme.js';
1
2
  export function getReadmeTemplate(projectName, options) {
2
3
  const packageManager = options?.packageManager ?? 'npm';
3
4
  const commands = {
@@ -103,6 +104,13 @@ well. Notes are held in memory, so they last until the process restarts.
103
104
  - \`body\`: Plain text
104
105
  - \`tags\` (optional): Tags used to filter in \`list_notes\`
105
106
 
107
+ - **delete_note** - Delete a note, after asking the user to confirm.
108
+ - \`id\`: Note id as returned by \`list_notes\` or \`create_note\`
109
+
110
+ Uses elicitation: the client shows the user a Delete it / Keep it choice
111
+ before anything happens. Declining, dismissing, or a client that cannot ask
112
+ all return \`deleted: false\` with the reason, never a silent success.
113
+
106
114
  ### Resources
107
115
 
108
116
  - **notes://{id}** - A single note as JSON. Listing the resource enumerates
@@ -151,19 +159,7 @@ ${projectName}/
151
159
  imports so it stays testable on its own.
152
160
  - Modify transport configuration in \`src/index.ts\`
153
161
 
154
- ## Tool design skill
155
-
156
- Agentailor's [tool-design](https://github.com/agentailor/skills) skill is
157
- included at \`.agents/skills/tool-design/\`, so a coding agent working here has
158
- the guidance on hand. Commit it so the whole team gets the same copy.
159
-
160
- It is the version that shipped with the scaffolding CLI. To check for a newer
161
- one — your call, not automatic:
162
-
163
- \`\`\`bash
164
- npx skills update -p -y
165
- \`\`\`
166
-
162
+ ${getSkillReadmeSection(options?.withSkills ?? true)}
167
163
  ## Learn More
168
164
 
169
165
  - [Model Context Protocol](https://modelcontextprotocol.io/)
@@ -1 +1 @@
1
- export { getServerTemplate } from '../stateless/server.js';
1
+ export { getServerTemplate } from '../http/server.js';
@@ -1,2 +1,2 @@
1
- // Re-export from stateless template - server logic is identical for stdio
2
- export { getServerTemplate } from '../stateless/server.js';
1
+ // Re-export from the HTTP template - server logic is identical for stdio
2
+ export { getServerTemplate } from '../http/server.js';
@@ -12,8 +12,8 @@ describe('sdk/stdio templates', () => {
12
12
  expect(template).toContain("from '@modelcontextprotocol/server'");
13
13
  expect(template).not.toContain('@modelcontextprotocol/sdk');
14
14
  });
15
- // The server is re-exported from stateless/, so this only checks that the
16
- // same composition arrives here - its detail is tested in stateless/.
15
+ // The server is re-exported from http/, so this only checks that the
16
+ // same composition arrives here - its detail is tested in http/.
17
17
  it('should compose the shared primitives', () => {
18
18
  const template = getServerTemplate(projectName);
19
19
  expect(template).toContain('registerTools(server)');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentailor/create-mcp-server",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "Create a new MCP (Model Context Protocol) server project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,11 +0,0 @@
1
- export type { SdkTemplateOptions as TemplateOptions } from '../../common/types.js';
2
- export { getIndexTemplate } from '../stateless/index.js';
3
- export { getServerTemplate } from './server.js';
4
- export { getReadmeTemplate } from './readme.js';
5
- export { getAuthTemplate } from './auth.js';
6
- export { getStoreTemplate } from '../stateless/store.js';
7
- export { getToolsTemplate } from '../stateless/tools.js';
8
- export { getPromptsTemplate } from '../stateless/prompts.js';
9
- export { getResourcesTemplate } from '../stateless/resources.js';
10
- export { getStoreTestTemplate } from '../stateless/store-test.js';
11
- export { getServerTestTemplate } from '../stateless/server-test.js';
@@ -1,12 +0,0 @@
1
- // Intentionally identical to the stateless template - see "Why stateless and
2
- // stateful are identical" in AGENTS.md. Edit behaviour in stateless/, not here.
3
- export { getIndexTemplate } from '../stateless/index.js';
4
- export { getServerTemplate } from './server.js';
5
- export { getReadmeTemplate } from './readme.js';
6
- export { getAuthTemplate } from './auth.js';
7
- export { getStoreTemplate } from '../stateless/store.js';
8
- export { getToolsTemplate } from '../stateless/tools.js';
9
- export { getPromptsTemplate } from '../stateless/prompts.js';
10
- export { getResourcesTemplate } from '../stateless/resources.js';
11
- export { getStoreTestTemplate } from '../stateless/store-test.js';
12
- export { getServerTestTemplate } from '../stateless/server-test.js';
@@ -1 +0,0 @@
1
- export { getReadmeTemplate } from '../stateless/readme.js';
@@ -1,3 +0,0 @@
1
- // Intentionally identical to the stateless template - see "Why stateless and
2
- // stateful are identical" in AGENTS.md. Edit behaviour in stateless/, not here.
3
- export { getReadmeTemplate } from '../stateless/readme.js';
@@ -1 +0,0 @@
1
- export { getServerTemplate } from '../stateless/server.js';
@@ -1,2 +0,0 @@
1
- // Re-export from stateless template - server logic is identical
2
- export { getServerTemplate } from '../stateless/server.js';