@agentailor/create-mcp-server 0.9.0 → 0.11.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/README.md +13 -47
- package/dist/cli.d.ts +3 -4
- package/dist/cli.js +29 -16
- package/dist/cli.test.js +60 -67
- package/dist/index.js +0 -2
- package/dist/interactive.js +1 -48
- package/dist/project-generator.d.ts +1 -4
- package/dist/project-generator.js +11 -39
- package/dist/templates/common/agents.md.js +9 -30
- package/dist/templates/common/agents.md.test.js +4 -21
- package/dist/templates/common/env.example.js +2 -5
- package/dist/templates/common/package.json.js +16 -29
- package/dist/templates/common/templates.test.js +9 -44
- package/dist/templates/common/tsconfig.json.d.ts +1 -3
- package/dist/templates/common/tsconfig.json.js +2 -5
- package/dist/templates/common/types.d.ts +1 -12
- package/dist/templates/sdk/{stateless → http}/index.d.ts +2 -1
- package/dist/templates/sdk/{stateless → http}/index.js +2 -1
- package/dist/templates/sdk/{stateless → http}/templates.test.js +90 -1
- package/dist/templates/sdk/stdio/index.d.ts +6 -6
- package/dist/templates/sdk/stdio/index.js +6 -6
- package/dist/templates/sdk/stdio/server.d.ts +1 -1
- package/dist/templates/sdk/stdio/server.js +2 -2
- package/dist/templates/sdk/stdio/templates.test.js +2 -2
- package/package.json +1 -1
- package/dist/deprecations.d.ts +0 -7
- package/dist/deprecations.js +0 -17
- package/dist/deprecations.test.d.ts +0 -1
- package/dist/deprecations.test.js +0 -24
- package/dist/templates/fastmcp/index.d.ts +0 -5
- package/dist/templates/fastmcp/index.js +0 -32
- package/dist/templates/fastmcp/readme.d.ts +0 -2
- package/dist/templates/fastmcp/readme.js +0 -240
- package/dist/templates/fastmcp/server.js +0 -66
- package/dist/templates/fastmcp/templates.test.js +0 -109
- package/dist/templates/sdk/stateful/index.d.ts +0 -11
- package/dist/templates/sdk/stateful/index.js +0 -12
- package/dist/templates/sdk/stateful/readme.d.ts +0 -1
- package/dist/templates/sdk/stateful/readme.js +0 -3
- package/dist/templates/sdk/stateful/server.d.ts +0 -1
- package/dist/templates/sdk/stateful/server.js +0 -2
- package/dist/templates/sdk/stateful/templates.test.d.ts +0 -1
- package/dist/templates/sdk/stateful/templates.test.js +0 -198
- package/dist/templates/sdk/stateless/server.d.ts +0 -1
- package/dist/templates/sdk/stateless/templates.test.d.ts +0 -1
- /package/dist/templates/sdk/{stateful → http}/auth.d.ts +0 -0
- /package/dist/templates/sdk/{stateful → http}/auth.js +0 -0
- /package/dist/templates/sdk/{stateful → http}/auth.test.d.ts +0 -0
- /package/dist/templates/sdk/{stateful → http}/auth.test.js +0 -0
- /package/dist/templates/sdk/{stateless → http}/prompts.d.ts +0 -0
- /package/dist/templates/sdk/{stateless → http}/prompts.js +0 -0
- /package/dist/templates/sdk/{stateless → http}/readme.d.ts +0 -0
- /package/dist/templates/sdk/{stateless → http}/readme.js +0 -0
- /package/dist/templates/sdk/{stateless → http}/resources.d.ts +0 -0
- /package/dist/templates/sdk/{stateless → http}/resources.js +0 -0
- /package/dist/templates/sdk/{stateless → http}/server-test.d.ts +0 -0
- /package/dist/templates/sdk/{stateless → http}/server-test.js +0 -0
- /package/dist/templates/{fastmcp → sdk/http}/server.d.ts +0 -0
- /package/dist/templates/sdk/{stateless → http}/server.js +0 -0
- /package/dist/templates/sdk/{stateless → http}/store-test.d.ts +0 -0
- /package/dist/templates/sdk/{stateless → http}/store-test.js +0 -0
- /package/dist/templates/sdk/{stateless → http}/store.d.ts +0 -0
- /package/dist/templates/sdk/{stateless → http}/store.js +0 -0
- /package/dist/templates/{fastmcp → sdk/http}/templates.test.d.ts +0 -0
- /package/dist/templates/sdk/{stateless → http}/tools.d.ts +0 -0
- /package/dist/templates/sdk/{stateless → http}/tools.js +0 -0
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { getServerTemplate, getIndexTemplate, getReadmeTemplate } from './index.js';
|
|
3
|
-
import { getIndexTemplate as getStatelessIndexTemplate, getReadmeTemplate as getStatelessReadmeTemplate, } from '../stateless/index.js';
|
|
4
|
-
describe('sdk/stateful templates', () => {
|
|
5
|
-
const projectName = 'test-project';
|
|
6
|
-
// Pins the re-export: shared behaviour is covered by the stateless suite.
|
|
7
|
-
describe('convergence with the stateless template', () => {
|
|
8
|
-
it('should produce the same index template as stateless', () => {
|
|
9
|
-
expect(getIndexTemplate()).toBe(getStatelessIndexTemplate());
|
|
10
|
-
});
|
|
11
|
-
it('should produce the same index template as stateless with OAuth', () => {
|
|
12
|
-
expect(getIndexTemplate({ withOAuth: true })).toBe(getStatelessIndexTemplate({ withOAuth: true }));
|
|
13
|
-
});
|
|
14
|
-
it('should produce the same readme as stateless', () => {
|
|
15
|
-
expect(getReadmeTemplate(projectName)).toBe(getStatelessReadmeTemplate(projectName));
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
describe('getServerTemplate', () => {
|
|
19
|
-
it('should include project name in server config', () => {
|
|
20
|
-
const template = getServerTemplate(projectName);
|
|
21
|
-
expect(template).toContain(`name: '${projectName}'`);
|
|
22
|
-
});
|
|
23
|
-
it('should use SDK v2 imports', () => {
|
|
24
|
-
const template = getServerTemplate(projectName);
|
|
25
|
-
expect(template).toContain("from '@modelcontextprotocol/server'");
|
|
26
|
-
expect(template).not.toContain('@modelcontextprotocol/sdk');
|
|
27
|
-
});
|
|
28
|
-
// The server is re-exported from stateless/, so this only checks that the
|
|
29
|
-
// same composition arrives here - its detail is tested in stateless/.
|
|
30
|
-
it('should compose the shared primitives', () => {
|
|
31
|
-
const template = getServerTemplate(projectName);
|
|
32
|
-
expect(template).toContain('registerTools(server)');
|
|
33
|
-
expect(template).toContain('registerPrompts(server)');
|
|
34
|
-
expect(template).toContain('registerResources(server)');
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
describe('getIndexTemplate', () => {
|
|
38
|
-
it('should use SDK v2 serving imports', () => {
|
|
39
|
-
const template = getIndexTemplate();
|
|
40
|
-
expect(template).toContain("import { createMcpHandler } from '@modelcontextprotocol/server'");
|
|
41
|
-
expect(template).toContain("import { createMcpExpressApp } from '@modelcontextprotocol/express'");
|
|
42
|
-
expect(template).toContain("import { toNodeHandler } from '@modelcontextprotocol/node'");
|
|
43
|
-
});
|
|
44
|
-
it('should mount the /mcp endpoint with app.all', () => {
|
|
45
|
-
const template = getIndexTemplate();
|
|
46
|
-
expect(template).toContain("app.all('/mcp'");
|
|
47
|
-
});
|
|
48
|
-
it('should use PORT from environment variable', () => {
|
|
49
|
-
const template = getIndexTemplate();
|
|
50
|
-
expect(template).toContain('process.env.PORT');
|
|
51
|
-
});
|
|
52
|
-
it('should not carry over v1 session machinery', () => {
|
|
53
|
-
const template = getIndexTemplate();
|
|
54
|
-
expect(template).not.toContain('sessionIdGenerator');
|
|
55
|
-
expect(template).not.toContain('isInitializeRequest');
|
|
56
|
-
expect(template).not.toContain('randomUUID');
|
|
57
|
-
expect(template).not.toContain('mcp-session-id');
|
|
58
|
-
expect(template).not.toContain('const transports');
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe('getReadmeTemplate', () => {
|
|
62
|
-
it('should include project name', () => {
|
|
63
|
-
const template = getReadmeTemplate(projectName);
|
|
64
|
-
expect(template).toContain(`# ${projectName}`);
|
|
65
|
-
});
|
|
66
|
-
it('should include getting started instructions with npm by default', () => {
|
|
67
|
-
const template = getReadmeTemplate(projectName);
|
|
68
|
-
expect(template).toContain('npm install');
|
|
69
|
-
expect(template).toContain('npm run dev');
|
|
70
|
-
expect(template).toContain('npm run build');
|
|
71
|
-
expect(template).toContain('npm start');
|
|
72
|
-
});
|
|
73
|
-
it('should document the /mcp endpoint', () => {
|
|
74
|
-
const template = getReadmeTemplate(projectName);
|
|
75
|
-
expect(template).toContain('/mcp');
|
|
76
|
-
});
|
|
77
|
-
it('should not document removed session management', () => {
|
|
78
|
-
const template = getReadmeTemplate(projectName);
|
|
79
|
-
expect(template).not.toContain('mcp-session-id');
|
|
80
|
-
expect(template).not.toContain('DELETE /mcp');
|
|
81
|
-
expect(template).not.toContain('SSE');
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
describe('getReadmeTemplate with package manager', () => {
|
|
85
|
-
it('should use npm commands when packageManager is npm', () => {
|
|
86
|
-
const template = getReadmeTemplate(projectName, { packageManager: 'npm' });
|
|
87
|
-
expect(template).toContain('npm install');
|
|
88
|
-
expect(template).toContain('npm run dev');
|
|
89
|
-
expect(template).toContain('npm run build');
|
|
90
|
-
expect(template).toContain('npm start');
|
|
91
|
-
});
|
|
92
|
-
it('should use pnpm commands when packageManager is pnpm', () => {
|
|
93
|
-
const template = getReadmeTemplate(projectName, { packageManager: 'pnpm' });
|
|
94
|
-
expect(template).toContain('pnpm install');
|
|
95
|
-
expect(template).toContain('pnpm dev');
|
|
96
|
-
expect(template).toContain('pnpm build');
|
|
97
|
-
expect(template).toContain('pnpm start');
|
|
98
|
-
expect(template).not.toContain('npm run');
|
|
99
|
-
});
|
|
100
|
-
it('should use yarn commands when packageManager is yarn', () => {
|
|
101
|
-
const template = getReadmeTemplate(projectName, { packageManager: 'yarn' });
|
|
102
|
-
expect(template).toContain('yarn\n');
|
|
103
|
-
expect(template).toContain('yarn dev');
|
|
104
|
-
expect(template).toContain('yarn build');
|
|
105
|
-
expect(template).toContain('yarn start');
|
|
106
|
-
expect(template).not.toContain('npm run');
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
describe('getIndexTemplate with OAuth', () => {
|
|
110
|
-
it('should include auth imports when OAuth enabled', () => {
|
|
111
|
-
const template = getIndexTemplate({ withOAuth: true });
|
|
112
|
-
expect(template).toContain("from './auth.js'");
|
|
113
|
-
expect(template).toContain('setupAuthMetadataRouter');
|
|
114
|
-
expect(template).toContain('authMiddleware');
|
|
115
|
-
expect(template).toContain('getOAuthMetadataUrl');
|
|
116
|
-
});
|
|
117
|
-
it('should import validateOAuthConfig when OAuth enabled', () => {
|
|
118
|
-
const template = getIndexTemplate({ withOAuth: true });
|
|
119
|
-
expect(template).toContain('validateOAuthConfig');
|
|
120
|
-
});
|
|
121
|
-
it('should setup auth metadata router when OAuth enabled', () => {
|
|
122
|
-
const template = getIndexTemplate({ withOAuth: true });
|
|
123
|
-
expect(template).toContain('setupAuthMetadataRouter(app)');
|
|
124
|
-
});
|
|
125
|
-
it('should apply auth middleware to the /mcp route when OAuth enabled', () => {
|
|
126
|
-
const template = getIndexTemplate({ withOAuth: true });
|
|
127
|
-
expect(template).toContain("app.all('/mcp', authMiddleware,");
|
|
128
|
-
});
|
|
129
|
-
it('should log OAuth metadata URL on startup when OAuth enabled', () => {
|
|
130
|
-
const template = getIndexTemplate({ withOAuth: true });
|
|
131
|
-
expect(template).toContain('getOAuthMetadataUrl()');
|
|
132
|
-
});
|
|
133
|
-
it('should call validateOAuthConfig before starting server when OAuth enabled', () => {
|
|
134
|
-
const template = getIndexTemplate({ withOAuth: true });
|
|
135
|
-
expect(template).toContain('await validateOAuthConfig()');
|
|
136
|
-
});
|
|
137
|
-
it('should wrap server startup in async main function when OAuth enabled', () => {
|
|
138
|
-
const template = getIndexTemplate({ withOAuth: true });
|
|
139
|
-
expect(template).toContain('async function main()');
|
|
140
|
-
expect(template).toContain('main().catch');
|
|
141
|
-
});
|
|
142
|
-
it('should exit with error if OAuth validation fails', () => {
|
|
143
|
-
const template = getIndexTemplate({ withOAuth: true });
|
|
144
|
-
expect(template).toContain('Failed to start server');
|
|
145
|
-
expect(template).toContain('process.exit(1)');
|
|
146
|
-
});
|
|
147
|
-
it('should NOT include auth imports when OAuth disabled', () => {
|
|
148
|
-
const template = getIndexTemplate({ withOAuth: false });
|
|
149
|
-
expect(template).not.toContain("from './auth.js'");
|
|
150
|
-
expect(template).not.toContain('authMiddleware');
|
|
151
|
-
});
|
|
152
|
-
it('should NOT include auth imports by default', () => {
|
|
153
|
-
const template = getIndexTemplate();
|
|
154
|
-
expect(template).not.toContain("from './auth.js'");
|
|
155
|
-
});
|
|
156
|
-
it('should NOT wrap in async main when OAuth disabled', () => {
|
|
157
|
-
const template = getIndexTemplate({ withOAuth: false });
|
|
158
|
-
expect(template).not.toContain('async function main()');
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
describe('getReadmeTemplate with OAuth', () => {
|
|
162
|
-
it('should include OAuth section when enabled', () => {
|
|
163
|
-
const template = getReadmeTemplate(projectName, { withOAuth: true });
|
|
164
|
-
expect(template).toContain('## OAuth Authentication');
|
|
165
|
-
expect(template).toContain('OAUTH_ISSUER_URL');
|
|
166
|
-
expect(template).toContain('OAUTH_AUDIENCE');
|
|
167
|
-
expect(template).toContain('Bearer token');
|
|
168
|
-
});
|
|
169
|
-
it('should list supported OAuth providers', () => {
|
|
170
|
-
const template = getReadmeTemplate(projectName, { withOAuth: true });
|
|
171
|
-
expect(template).toContain('Auth0');
|
|
172
|
-
expect(template).toContain('Keycloak');
|
|
173
|
-
expect(template).toContain('Azure AD');
|
|
174
|
-
expect(template).toContain('Okta');
|
|
175
|
-
});
|
|
176
|
-
it('should document JWKS-based JWT validation', () => {
|
|
177
|
-
const template = getReadmeTemplate(projectName, { withOAuth: true });
|
|
178
|
-
expect(template).toContain('JWT');
|
|
179
|
-
expect(template).toContain('.well-known/jwks.json');
|
|
180
|
-
});
|
|
181
|
-
it('should document where auth info surfaces to handlers', () => {
|
|
182
|
-
const template = getReadmeTemplate(projectName, { withOAuth: true });
|
|
183
|
-
expect(template).toContain('ctx.http.authInfo');
|
|
184
|
-
});
|
|
185
|
-
it('should include auth.ts in project structure when OAuth enabled', () => {
|
|
186
|
-
const template = getReadmeTemplate(projectName, { withOAuth: true });
|
|
187
|
-
expect(template).toContain('auth.ts');
|
|
188
|
-
});
|
|
189
|
-
it('should NOT include OAuth section when disabled', () => {
|
|
190
|
-
const template = getReadmeTemplate(projectName, { withOAuth: false });
|
|
191
|
-
expect(template).not.toContain('## OAuth Authentication');
|
|
192
|
-
});
|
|
193
|
-
it('should NOT include OAuth section by default', () => {
|
|
194
|
-
const template = getReadmeTemplate(projectName);
|
|
195
|
-
expect(template).not.toContain('## OAuth Authentication');
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getServerTemplate(projectName: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|