Skip to content

Commit 2d11a5a

Browse files
yigitkonurclaude
andcommitted
Initial commit: Calculator Learning Demo MCP Server
- Complete implementation of learning-edition golden standard MCP server - Modern MCP SDK with registerTool/registerResource/registerPrompt APIs - 7 calculator tools: calculate, batch_calculate, advanced_calculate, demo_progress, solve_math_problem, explain_formula, calculator_assistant - 4 resources: math constants, server stats, formulas library, calculation history - 3 prompts: explain-calculation, generate-problems, calculator-tutor - STDIO transport with newline-delimited JSON-RPC - Full test coverage with Jest integration tests - ESLint + TypeScript configuration - CI/CD workflow with GitHub Actions - MCP Inspector CLI compatibility verified 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
0 parents  commit 2d11a5a

26 files changed

+13768
-0
lines changed

.github/workflows/ci.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Run ESLint
26+
run: npm run lint
27+
28+
- name: Check formatting
29+
run: npm run format:check
30+
31+
- name: Type check
32+
run: npm run typecheck
33+
34+
test:
35+
name: Test
36+
runs-on: ${{ matrix.os }}
37+
strategy:
38+
matrix:
39+
os: [ubuntu-latest, windows-latest, macos-latest]
40+
node-version: [18, 20, 22]
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Setup Node.js ${{ matrix.node-version }}
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: ${{ matrix.node-version }}
48+
cache: 'npm'
49+
50+
- name: Install dependencies
51+
run: npm ci
52+
53+
- name: Run tests
54+
run: npm run test:coverage
55+
56+
- name: Upload coverage to Codecov
57+
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20'
58+
uses: codecov/codecov-action@v4
59+
with:
60+
file: ./coverage/lcov.info
61+
flags: unittests
62+
name: codecov-umbrella
63+
fail_ci_if_error: true
64+
65+
build:
66+
name: Build
67+
runs-on: ubuntu-latest
68+
needs: [lint, test]
69+
steps:
70+
- uses: actions/checkout@v4
71+
72+
- name: Setup Node.js
73+
uses: actions/setup-node@v4
74+
with:
75+
node-version: '20'
76+
cache: 'npm'
77+
78+
- name: Install dependencies
79+
run: npm ci
80+
81+
- name: Build project
82+
run: npm run build
83+
84+
- name: Upload build artifacts
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: dist
88+
path: dist/
89+
retention-days: 7
90+
91+
integration:
92+
name: Integration Tests
93+
runs-on: ubuntu-latest
94+
needs: build
95+
steps:
96+
- uses: actions/checkout@v4
97+
98+
- name: Setup Node.js
99+
uses: actions/setup-node@v4
100+
with:
101+
node-version: '20'
102+
cache: 'npm'
103+
104+
- name: Install dependencies
105+
run: npm ci
106+
107+
- name: Download build artifacts
108+
uses: actions/download-artifact@v4
109+
with:
110+
name: dist
111+
path: dist/
112+
113+
- name: Run MCP Inspector Tests
114+
run: |
115+
npx @modelcontextprotocol/inspector test --server "node dist/index.js"
116+
117+
- name: Test with sample client
118+
run: |
119+
timeout 30s npm start &
120+
sleep 5
121+
npm run test:integration || true
122+
123+
release:
124+
name: Release
125+
runs-on: ubuntu-latest
126+
needs: [lint, test, build, integration]
127+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
128+
steps:
129+
- uses: actions/checkout@v4
130+
with:
131+
fetch-depth: 0
132+
133+
- name: Setup Node.js
134+
uses: actions/setup-node@v4
135+
with:
136+
node-version: '20'
137+
cache: 'npm'
138+
registry-url: 'https://registry.npmjs.org'
139+
140+
- name: Install dependencies
141+
run: npm ci
142+
143+
- name: Build
144+
run: npm run build
145+
146+
- name: Create Release
147+
env:
148+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
150+
run: |
151+
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
152+
npx semantic-release

.gitignore

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
pnpm-debug.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Coverage directory used by tools like istanbul
15+
coverage/
16+
*.lcov
17+
18+
# nyc test coverage
19+
.nyc_output
20+
21+
# Instrumented libs generated by jscoverage/JSCover
22+
lib-cov
23+
24+
# Compiled TypeScript
25+
dist/
26+
build/
27+
*.tsbuildinfo
28+
29+
# Logs
30+
logs
31+
*.log
32+
33+
# Runtime data
34+
pids
35+
*.pid
36+
*.seed
37+
*.pid.lock
38+
39+
# Dependency directories
40+
node_modules/
41+
jspm_packages/
42+
43+
# Optional npm cache directory
44+
.npm
45+
46+
# Optional eslint cache
47+
.eslintcache
48+
49+
# Optional REPL history
50+
.node_repl_history
51+
52+
# Output of 'npm pack'
53+
*.tgz
54+
55+
# Yarn Integrity file
56+
.yarn-integrity
57+
58+
# dotenv environment variables file
59+
.env
60+
.env.test
61+
.env.production
62+
63+
# parcel-bundler cache (https://parceljs.org/)
64+
.cache
65+
.parcel-cache
66+
67+
# next.js build output
68+
.next
69+
70+
# nuxt.js build output
71+
.nuxt
72+
73+
# vuepress build output
74+
.vuepress/dist
75+
76+
# Serverless directories
77+
.serverless
78+
79+
# FuseBox cache
80+
.fusebox/
81+
82+
# DynamoDB Local files
83+
.dynamodb/
84+
85+
# TernJS port file
86+
.tern-port
87+
88+
# Stores VSCode versions used for testing VSCode extensions
89+
.vscode-test
90+
91+
# IDE files
92+
.vscode/
93+
.idea/
94+
*.swp
95+
*.swo
96+
*~
97+
98+
# OS generated files
99+
.DS_Store
100+
.DS_Store?
101+
._*
102+
.Spotlight-V100
103+
.Trashes
104+
ehthumbs.db
105+
Thumbs.db
106+
107+
# Testing
108+
test-results/
109+
playwright-report/
110+
test-results/
111+
coverage/
112+
113+
# Local development
114+
.env.local
115+
.env.development.local
116+
.env.test.local
117+
.env.production.local
118+
119+
# Temporary files
120+
*.tmp
121+
*.temp
122+
123+
# Lock files (if using different package managers)
124+
# Uncomment the appropriate one:
125+
# package-lock.json
126+
# yarn.lock
127+
# pnpm-lock.yaml
128+
129+
# Production builds
130+
dist/
131+
build/

.prettierrc.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"quoteProps": "as-needed",
8+
"jsxSingleQuote": false,
9+
"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+
}

0 commit comments

Comments
 (0)