Skip to content

Commit fb1c14c

Browse files
yigitkonurclaude
andcommitted
Enhance build pipeline and documentation with zero-warning enforcement
- Update documentation (CLAUDE.md, README.md) with complete pipeline commands - Standardize ESLint config with flat config format and strict type-safety rules - Streamline Prettier configuration to essential settings only - Add comprehensive quality assurance scripts (pipeline, smoke tests, checks) - Update Node.js requirement to >=20.0.0 for modern ESM support - Remove outdated test-elicitation.md file - Verify complete zero-warning build pipeline functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent eaa6df4 commit fb1c14c

19 files changed

+1276
-249
lines changed

.dockerignore

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Node modules and npm debug logs
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Environment variables
8+
.env
9+
.env.local
10+
.env.development.local
11+
.env.test.local
12+
.env.production.local
13+
14+
# Git
15+
.git/
16+
.gitignore
17+
18+
# IDE and editor files
19+
.vscode/
20+
.idea/
21+
*.swp
22+
*.swo
23+
*~
24+
25+
# OS files
26+
.DS_Store
27+
Thumbs.db
28+
29+
# Test coverage
30+
coverage/
31+
.nyc_output/
32+
33+
# TypeScript cache
34+
*.tsbuildinfo
35+
36+
# Documentation
37+
*.md
38+
docs/
39+
40+
# Docker files (avoid recursive builds)
41+
Dockerfile*
42+
docker-compose*.yml
43+
44+
# Build artifacts (we'll build fresh in container)
45+
dist/
46+
build/
47+
48+
# Development and test files
49+
src/tests/
50+
jest.config.js
51+
jest.setup.js
52+
*.test.ts
53+
*.spec.ts
54+
55+
# Temporary files
56+
tmp/
57+
temp/
58+
*.tmp
59+
*.temp
60+
61+
# Log files
62+
logs/
63+
*.log
64+
65+
# Package manager lock files (except package-lock.json which we need)
66+
yarn.lock
67+
pnpm-lock.yaml

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: ci
2+
on:
3+
push: { branches: [main] }
4+
pull_request:
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-node@v4
11+
with: { node-version: 22, cache: 'npm' }
12+
- run: npm ci
13+
- run: npm run typecheck
14+
- run: npm run lint:ci
15+
- run: npm run format:check
16+
- run: npm run build

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ playwright-report/
7373
# pnpm-lock.yaml
7474

7575
# Docker
76-
.dockerignore
76+
.dockerignore.DS_Store

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm exec lint-staged

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20
1+
22

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
node_modules/
3+
coverage/

.prettierrc.json

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
{
22
"printWidth": 100,
3-
"tabWidth": 2,
4-
"useTabs": false,
5-
"semi": true,
63
"singleQuote": true,
7-
"quoteProps": "as-needed",
8-
"jsxSingleQuote": false,
94
"trailingComma": "all",
10-
"bracketSpacing": true,
11-
"bracketSameLine": false,
12-
"arrowParens": "always",
13-
"requirePragma": false,
14-
"insertPragma": false,
15-
"proseWrap": "preserve",
16-
"htmlWhitespaceSensitivity": "css",
17-
"vueIndentScriptAndStyle": false,
18-
"endOfLine": "lf",
19-
"embeddedLanguageFormatting": "auto",
20-
"singleAttributePerLine": false
21-
}
5+
"semi": true
6+
}

CLAUDE.md

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ This repository is a **comprehensive educational curriculum for MCP development*
99
## Development Commands
1010

1111
### Core Development
12-
- `npm install` - Install dependencies
12+
13+
- `npm install` - Install dependencies
1314
- `npm start` - Run the MCP server (`dist/server.js --stdio`)
1415
- `npm run dev` - Development mode with auto-reload
1516
- `npm run build` - Build TypeScript to JavaScript
@@ -18,43 +19,56 @@ This repository is a **comprehensive educational curriculum for MCP development*
1819
- `npm run clean` - Remove dist directory
1920

2021
### Testing & Quality
22+
2123
- `npm run lint` - Run ESLint
2224
- `npm run lint:fix` - Fix linting issues
25+
- `npm run lint:ci` - Run ESLint with zero warnings enforced
2326
- `npm run typecheck` - TypeScript type checking
2427
- `npm run format` - Format code with Prettier
2528
- `npm run format:check` - Check code formatting
29+
- `npm run check:quick` - Quick verification (typecheck + lint:ci + format:check)
30+
- `npm run check:deep` - Deep verification with auto-fixes
31+
- `npm run pipeline` - Full pipeline (clean + typecheck + lint:fix + lint:ci + format + format:check + build)
32+
- `npm run smoke:stdio` - Test STDIO server startup/shutdown
33+
- `npm run all` - Complete pipeline + smoke test
2634

2735
### MCP Inspection
28-
- `npx @modelcontextprotocol/inspector --cli "node dist/server.js --stdio" --method tools/list` - List all 8 tools with schemas
36+
37+
- `npx @modelcontextprotocol/inspector --cli "node dist/server.js --stdio" --method tools/list` - List all 8 tools with schemas
2938
- `npx @modelcontextprotocol/inspector --cli "node dist/server.js --stdio" --method prompts/list` - List all 3 prompts
3039
- `npx @modelcontextprotocol/inspector --cli "node dist/server.js --stdio" --method resources/list` - List all 4 resources
3140
- `npx @modelcontextprotocol/inspector --cli "node dist/server.js --stdio" --method resources/read --uri "calculator://constants"` - Read specific resource
3241

3342
### Manual Testing
43+
3444
- `echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"calculate","arguments":{"a":7,"b":6,"op":"multiply"}}}' | node dist/server.js --stdio` - Test MCP SDK server
3545

3646
## Architecture
3747

3848
### MCP SDK Implementation
49+
3950
The project provides a **single, production-ready MCP server implementation**:
4051

4152
- **`dist/server.js`** - MCP SDK server using standard `registerTool()`, `registerResource()`, `registerPrompt()` APIs
4253
- Implements standard MCP protocol with `tools/list`, `tools/call`, `resources/list`, `prompts/list` methods
4354
- Compatible with all MCP clients and registries including Smithery
4455

4556
### MCP Advanced Features Implementation
57+
4658
- **8 Tools**: `calculate`, `batch_calculate`, `advanced_calculate`, `demo_progress`, `solve_math_problem`, `explain_formula`, `calculator_assistant`, `maintenance_mode`
4759
- **3 Prompts**: `explain-calculation`, `generate-problems`, `calculator-tutor` (all with completable arguments)
4860
- **4 Resources**: `calculator://constants`, `calculator://stats`, `formulas://library`, `calculator://history/{id}` (with completion support)
4961
- **Advanced SDK Features**: Progress notifications, interactive elicitation, dynamic lifecycle management, completable arguments
5062

5163
### State Management Architecture
64+
5265
- **Process Memory**: All state (calculation history, request counters, uptime) stored in-memory
5366
- **Per-Process Isolation**: State resets when process exits (by design for STDIO transport)
5467
- **History Limit**: Maximum 50 calculation entries stored
5568
- **Resource Limits**: Batch operations limited to 100 items
5669

5770
### Protocol Architecture
71+
5872
- **STDIO Transport**: Pure stdin/stdout communication with newline-delimited JSON-RPC
5973
- **Progress Notifications**: Real-time progress updates using `sendNotification` with `notifications/progress` method
6074
- **Interactive Elicitation**: Dynamic user input collection via `server.server.elicitInput()` for ambiguous requests
@@ -68,20 +82,23 @@ The project provides a **single, production-ready MCP server implementation**:
6882
**Important**: This is a complete educational curriculum designed for the MCP community, not just a code example.
6983

7084
### Learning Structure
85+
7186
- **3-Week Structured Path**: Fundamentals → Advanced Patterns → Production Readiness
7287
- **4 Progressive Exercises**: From basic statistics to advanced interactive tools
7388
- **12 Key Takeaways**: Specific learning outcomes covering all MCP concepts
7489
- **Comprehensive Best Practices**: Deep dive into SDK patterns and common pitfalls
7590
- **Production Deployment**: Real-world deployment and monitoring guidance
7691

7792
### Build Process & Quality
93+
7894
1. TypeScript source files in `src/` contain the full implementation
7995
2. `npm run build` compiles to `dist/server.js` (production-ready)
8096
3. Code is formatted with Prettier and validated with ESLint
8197
4. Zero warnings/errors policy maintained
8298
5. Use `npm start` or `node dist/server.js --stdio` to run the server
8399

84100
### Educational Content Structure
101+
85102
- **Core Learning Objectives**: 5 major areas (Architecture, Security, Protocol, Performance, Type Safety)
86103
- **Advanced SDK Features**: Progress notifications, elicitation, lifecycle, completion
87104
- **Testing & Validation**: Comprehensive testing strategy with MCP Inspector
@@ -90,6 +107,7 @@ The project provides a **single, production-ready MCP server implementation**:
90107
- **Hands-on Exercises**: Progressive exercises building complexity
91108

92109
### SDK Patterns Demonstrated
110+
93111
- **Progress Notifications**: Access `sendNotification` from handler's second parameter
94112
- **Interactive Elicitation**: Use `server.server.elicitInput()` for dynamic user input
95113
- **Tool Lifecycle**: Store handles from `registerTool()` for runtime management
@@ -99,13 +117,15 @@ The project provides a **single, production-ready MCP server implementation**:
99117
## Testing Strategy
100118

101119
The test suite validates MCP server functionality:
120+
102121
- **Integration Tests**: Test the MCP SDK server functionality
103122
- **Unit Tests**: Validate individual calculator operations
104123
- **API Tests**: Ensure MCP protocol compliance
105124

106125
## Message Protocol Specifics
107126

108127
### Standard MCP Protocol Format
128+
109129
```
110130
→ {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"calculate","arguments":{"a":5,"b":3,"op":"add"}}}
111131
{"result":{"content":[{"type":"text","text":"5 + 3 = 8"}]},"jsonrpc":"2.0","id":1}
@@ -123,59 +143,69 @@ The test suite validates MCP server functionality:
123143
## Progressive Exercise Curriculum
124144

125145
### Exercise 1: Statistics Tool (Type Safety & Registration)
146+
126147
- Goal: Master tool registration and type safety
127148
- Task: Implement mean, median, mode, standard deviation
128149
- Learning: Zod schemas, edge case handling
129150

130-
### Exercise 2: Persistent History (Resource Management)
151+
### Exercise 2: Persistent History (Resource Management)
152+
131153
- Goal: Advanced resource management
132154
- Task: File-based history persistence with reload
133155
- Learning: Async operations, resource lifecycle
134156

135157
### Exercise 3: Unit Conversion (Functionality Extension)
136-
- Goal: Extend server capabilities systematically
158+
159+
- Goal: Extend server capabilities systematically
137160
- Task: Multi-unit conversion tool (length, weight, temperature)
138161
- Learning: Complex business logic, conversion matrices
139162

140163
### Exercise 4: Guided Calculation (Advanced Interactive Features)
164+
141165
- Goal: Master all advanced SDK features combined
142166
- Task: Multi-step wizard with elicitation, progress, and lifecycle management
143167
- Learning: Complete integration of advanced patterns
144168

145169
## Advanced SDK Implementation Highlights
146170

147171
### Progress Notifications
172+
148173
```typescript
149174
// Correct pattern: Access sendNotification from second parameter
150175
async (params, { sendNotification }) => {
151-
await sendNotification({
152-
method: "notifications/progress",
153-
params: { progressToken: id, progress: 50, message: "Halfway" }
154-
});
155-
}
176+
await sendNotification({
177+
method: 'notifications/progress',
178+
params: { progressToken: id, progress: 50, message: 'Halfway' },
179+
});
180+
};
156181
```
157182

158183
### Interactive Elicitation
184+
159185
```typescript
160186
// Correct pattern: Use server.server for base Server instance
161187
const result = await server.server.elicitInput({
162-
message: "Need more information",
163-
requestedSchema: { /* JSON Schema */ }
188+
message: 'Need more information',
189+
requestedSchema: {
190+
/* JSON Schema */
191+
},
164192
});
165193
```
166194

167195
### Dynamic Lifecycle Management
196+
168197
```typescript
169198
// Correct pattern: Store handles for runtime control
170199
const toolHandle = server.registerTool(/* ... */);
171200
toolHandle.disable(); // Automatically sends tools/list_changed
172201
```
173202

174203
### Completable Arguments
204+
175205
```typescript
176206
// Correct pattern: Wrap schemas with completable
177207
argsSchema: {
178-
topic: completable(z.string(), async (value) => suggestions)
208+
topic: completable(z.string(), async (value) => suggestions);
179209
}
180210
```
181211

@@ -184,14 +214,17 @@ argsSchema: {
184214
This repository embodies the principle: **"Learn by building a world-class implementation."**
185215

186216
### What Makes This Special
217+
187218
- **Complete Curriculum**: Not just code, but a full learning experience
188219
- **Community Resource**: Built for the entire MCP development community
189220
- **Progressive Learning**: From basics to advanced patterns with guided exercises
190221
- **Production Quality**: Real-world standards with zero technical debt
191222
- **Best Practices**: Hard-won insights from building world-class MCP servers
192223

193224
### Learning Outcomes
225+
194226
After completing this curriculum, developers will master:
227+
195228
1. All 8 MCP tools with advanced features
196229
2. 4 different resource types with completion support
197230
3. Interactive prompts with completable arguments
@@ -206,7 +239,7 @@ The repository represents the gold standard for MCP education - a complete learn
206239
After completing this curriculum, developers will master:
207240

208241
1. **Direct Zod schema usage** - No JSON Schema conversion needed
209-
2. **Type safety throughout** - Let TypeScript do the work
242+
2. **Type safety throughout** - Let TypeScript do the work
210243
3. **Simple state management** - Circular buffers over complex stores
211244
4. **Protocol compliance** - Always use McpError
212245
5. **Clean architecture** - Single responsibility principle
@@ -222,4 +255,4 @@ After completing this curriculum, developers will master:
222255

223256
**Built with ❤️ as an educational reference for the MCP community**
224257

225-
This repository exists to accelerate MCP adoption by providing a complete, world-class learning experience. It demonstrates that building sophisticated MCP servers is achievable when you trust the SDK, follow best practices, and focus on user experience over complexity.
258+
This repository exists to accelerate MCP adoption by providing a complete, world-class learning experience. It demonstrates that building sophisticated MCP servers is achievable when you trust the SDK, follow best practices, and focus on user experience over complexity.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ COPY --from=builder /app/dist ./dist
4343
USER node
4444

4545
# Define the command to run the application when the container starts.
46-
# This will execute: node dist/server.js --stdio
47-
CMD ["node", "dist/server.js", "--stdio"]
46+
# Smithery will handle the transport protocol (STDIO) as defined in smithery.yaml
47+
CMD ["node", "dist/server.js"]

0 commit comments

Comments
 (0)