Skip to content

Commit e97f812

Browse files
authored
feat: add support for typescript fastmcp and frameworks selection (#11)
* feat: add support for typescript fastmcp and frameworks selection * create base template options interface
1 parent 772213b commit e97f812

File tree

22 files changed

+597
-105
lines changed

22 files changed

+597
-105
lines changed

CLAUDE.md

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,29 @@ create-mcp-server/
1010
│ ├── index.ts # CLI entry point
1111
│ └── templates/
1212
│ ├── common/ # Shared template files
13-
│ │ ├── package.json.ts # package.json template
13+
│ │ ├── package.json.ts # package.json template (framework-aware)
1414
│ │ ├── tsconfig.json.ts # tsconfig.json template
1515
│ │ ├── gitignore.ts # .gitignore template
1616
│ │ ├── env.example.ts # .env.example template
1717
│ │ └── templates.test.ts # Tests for common templates
18-
│ ├── streamable-http/ # Stateless streamable HTTP template
19-
│ │ ├── server.ts # MCP server definition template
20-
│ │ ├── index.ts # Barrel export + getIndexTemplate
21-
│ │ ├── readme.ts # README.md template
22-
│ │ └── templates.test.ts # Tests for stateless template
23-
│ └── stateful-streamable-http/ # Stateful streamable HTTP template
24-
│ ├── server.ts # Re-exports from streamable-http
18+
│ ├── sdk/ # Official MCP SDK templates
19+
│ │ ├── stateless/ # Stateless HTTP template
20+
│ │ │ ├── server.ts # MCP server definition template
21+
│ │ │ ├── index.ts # Barrel export + getIndexTemplate
22+
│ │ │ ├── readme.ts # README.md template
23+
│ │ │ └── templates.test.ts
24+
│ │ └── stateful/ # Stateful HTTP template with OAuth option
25+
│ │ ├── server.ts # Re-exports from stateless
26+
│ │ ├── index.ts # Barrel export + getIndexTemplate
27+
│ │ ├── readme.ts # README.md template
28+
│ │ ├── auth.ts # OAuth authentication template
29+
│ │ ├── auth.test.ts # Tests for auth template
30+
│ │ └── templates.test.ts
31+
│ └── fastmcp/ # FastMCP templates
32+
│ ├── server.ts # FastMCP server definition template
2533
│ ├── index.ts # Barrel export + getIndexTemplate
2634
│ ├── readme.ts # README.md template
27-
│ ├── auth.ts # OAuth authentication template
28-
│ └── templates.test.ts # Tests for stateful template
35+
│ └── templates.test.ts
2936
├── dist/ # Compiled output (generated)
3037
├── docs/
3138
│ └── oauth-setup.md # OAuth setup guide for various providers
@@ -66,11 +73,23 @@ npm run format:check
6673
npm publish --access public
6774
```
6875

76+
## Frameworks
77+
78+
### Official MCP SDK (default)
79+
80+
Uses the official `@modelcontextprotocol/sdk` package with Express.js for full control.
81+
82+
### FastMCP
83+
84+
Uses [FastMCP](https://github.com/punkpeye/fastmcp), a TypeScript framework built on top of the official SDK that provides a simpler, more intuitive API.
85+
6986
## Templates
7087

71-
### streamable-http (stateless, default)
88+
### SDK Templates
89+
90+
#### sdk/stateless
7291

73-
A stateless streamable HTTP MCP server. Each request creates a new transport and server instance.
92+
A stateless streamable HTTP MCP server using the official SDK. Each request creates a new transport and server instance.
7493

7594
Features:
7695
- Express.js with `StreamableHTTPServerTransport`
@@ -81,9 +100,9 @@ Features:
81100
- TypeScript configuration
82101
- Environment variable support for PORT
83102

84-
### stateful-streamable-http
103+
#### sdk/stateful
85104

86-
A stateful streamable HTTP MCP server with session management.
105+
A stateful streamable HTTP MCP server with session management using the official SDK.
87106

88107
Features:
89108
- Session tracking via `mcp-session-id` header
@@ -94,7 +113,7 @@ Features:
94113
- Graceful shutdown with transport cleanup
95114
- **Optional OAuth authentication** (enabled via CLI prompt)
96115

97-
#### OAuth Option
116+
##### OAuth Option
98117

99118
When OAuth is enabled for the stateful template:
100119
- Generates `src/auth.ts` with JWKS/JWT-based OAuth middleware
@@ -105,17 +124,26 @@ When OAuth is enabled for the stateful template:
105124
- Server startup validation ensures OAuth provider is reachable
106125
- See [docs/oauth-setup.md](docs/oauth-setup.md) for provider-specific setup instructions
107126

108-
Generated project structure (same for both templates, +auth.ts when OAuth enabled):
127+
### FastMCP Templates
128+
129+
A single template that supports both stateless and stateful modes via the `stateless` configuration option. Uses the FastMCP framework for simpler server setup.
130+
131+
Features:
132+
- Declarative tool/prompt/resource registration
133+
- Built-in HTTP server (no Express setup required)
134+
- Supports both stateless and stateful modes via config
135+
- Example prompt, tool, and resource
136+
137+
Generated project structure (same for all templates, +auth.ts when OAuth enabled for SDK stateful):
109138
```
110139
{project-name}/
111140
├── src/
112141
│ ├── server.ts # MCP server with tools/prompts/resources
113-
│ ├── index.ts # Express app and transport setup
114-
│ └── auth.ts # OAuth middleware (only when OAuth enabled)
142+
│ ├── index.ts # Server startup configuration
143+
│ └── auth.ts # OAuth middleware (SDK stateful + OAuth only)
115144
├── package.json
116145
├── tsconfig.json
117146
├── .gitignore
118147
├── .env.example
119148
└── README.md
120149
```
121-

README.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,54 @@ npx @agentailor/create-mcp-server
1010

1111
## Features
1212

13-
- **Two templates** — stateless or stateful with session management
14-
- **Optional OAuth** — OIDC-compliant authentication ([setup guide](docs/oauth-setup.md))
13+
- **Two frameworks** — Official MCP SDK or FastMCP
14+
- **Two server modes** — stateless or stateful with session management
15+
- **Optional OAuth** — OIDC-compliant authentication (SDK only) ([setup guide](docs/oauth-setup.md))
1516
- **Package manager choice** — npm, pnpm, or yarn
16-
- **TypeScript + Express.js** — ready to customize
17+
- **TypeScript ready** — ready to customize
1718
- **MCP Inspector** — built-in debugging with `npm run inspect`
1819

19-
## Templates
20+
## Frameworks
21+
22+
| Framework | Description |
23+
|-----------|-------------|
24+
| **Official MCP SDK** (default) | Full control with Express.js, supports OAuth |
25+
| **FastMCP** | Simpler API with less boilerplate |
26+
27+
### FastMCP
28+
29+
[FastMCP](https://github.com/punkpeye/fastmcp) is a TypeScript framework built on top of the official MCP SDK that provides a simpler, more intuitive API for building MCP servers.
30+
31+
```typescript
32+
import { FastMCP } from "fastmcp";
33+
import { z } from "zod";
34+
35+
const server = new FastMCP({ name: "My Server", version: "1.0.0" });
36+
37+
server.addTool({
38+
name: "add",
39+
description: "Add two numbers",
40+
parameters: z.object({ a: z.number(), b: z.number() }),
41+
execute: async ({ a, b }) => String(a + b),
42+
});
43+
44+
server.start({ transportType: "httpStream", httpStream: { port: 3000 } });
45+
```
46+
47+
Learn more: [FastMCP Documentation](https://github.com/punkpeye/fastmcp)
48+
49+
## Server Modes
2050

2151
| Feature | Stateless (default) | Stateful |
2252
|---------|---------------------|----------|
2353
| Session management |||
2454
| SSE support |||
25-
| OAuth option |||
55+
| OAuth option (SDK only) |||
2656
| Endpoints | POST /mcp | POST, GET, DELETE /mcp |
2757

2858
**Stateless**: Simple HTTP server — each request creates a new transport instance.
2959

30-
**Stateful**: Session-based server with transport reuse, Server-Sent Events for real-time updates, and optional OAuth authentication.
60+
**Stateful**: Session-based server with transport reuse, Server-Sent Events for real-time updates, and optional OAuth authentication (SDK only).
3161

3262
## Generated Project
3363

0 commit comments

Comments
 (0)