cucumberstudio-mcp 1.1.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/.env.example +36 -0
- package/.github/workflows/pr-checks.yml +41 -0
- package/.github/workflows/release.yml +194 -0
- package/.prettierignore +26 -0
- package/.prettierrc +14 -0
- package/CLAUDE.md +140 -0
- package/Dockerfile +50 -0
- package/Dockerfile.dev +31 -0
- package/LICENSE +21 -0
- package/README.md +395 -0
- package/build/api/client.d.ts +49 -0
- package/build/api/client.d.ts.map +1 -0
- package/build/api/client.js +204 -0
- package/build/api/client.js.map +1 -0
- package/build/api/types.d.ts +113 -0
- package/build/api/types.d.ts.map +1 -0
- package/build/api/types.js +2 -0
- package/build/api/types.js.map +1 -0
- package/build/config/settings.d.ts +123 -0
- package/build/config/settings.d.ts.map +1 -0
- package/build/config/settings.js +97 -0
- package/build/config/settings.js.map +1 -0
- package/build/constants.d.ts +16 -0
- package/build/constants.d.ts.map +1 -0
- package/build/constants.js +24 -0
- package/build/constants.js.map +1 -0
- package/build/generated/version.d.ts +3 -0
- package/build/generated/version.d.ts.map +1 -0
- package/build/generated/version.js +5 -0
- package/build/generated/version.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +81 -0
- package/build/index.js.map +1 -0
- package/build/mcp-server.d.ts +6 -0
- package/build/mcp-server.d.ts.map +1 -0
- package/build/mcp-server.js +263 -0
- package/build/mcp-server.js.map +1 -0
- package/build/tools/action-words.d.ts +18 -0
- package/build/tools/action-words.d.ts.map +1 -0
- package/build/tools/action-words.js +191 -0
- package/build/tools/action-words.js.map +1 -0
- package/build/tools/projects.d.ts +19 -0
- package/build/tools/projects.d.ts.map +1 -0
- package/build/tools/projects.js +123 -0
- package/build/tools/projects.js.map +1 -0
- package/build/tools/scenarios.d.ts +18 -0
- package/build/tools/scenarios.d.ts.map +1 -0
- package/build/tools/scenarios.js +194 -0
- package/build/tools/scenarios.js.map +1 -0
- package/build/tools/test-runs.d.ts +21 -0
- package/build/tools/test-runs.d.ts.map +1 -0
- package/build/tools/test-runs.js +324 -0
- package/build/tools/test-runs.js.map +1 -0
- package/build/transports/http.d.ts +38 -0
- package/build/transports/http.d.ts.map +1 -0
- package/build/transports/http.js +381 -0
- package/build/transports/http.js.map +1 -0
- package/build/transports/index.d.ts +22 -0
- package/build/transports/index.d.ts.map +1 -0
- package/build/transports/index.js +10 -0
- package/build/transports/index.js.map +1 -0
- package/build/transports/stdio.d.ts +13 -0
- package/build/transports/stdio.d.ts.map +1 -0
- package/build/transports/stdio.js +24 -0
- package/build/transports/stdio.js.map +1 -0
- package/build/utils/errors.d.ts +10 -0
- package/build/utils/errors.d.ts.map +1 -0
- package/build/utils/errors.js +35 -0
- package/build/utils/errors.js.map +1 -0
- package/build/utils/logger-constants.d.ts +15 -0
- package/build/utils/logger-constants.d.ts.map +1 -0
- package/build/utils/logger-constants.js +16 -0
- package/build/utils/logger-constants.js.map +1 -0
- package/build/utils/logger.d.ts +55 -0
- package/build/utils/logger.d.ts.map +1 -0
- package/build/utils/logger.js +113 -0
- package/build/utils/logger.js.map +1 -0
- package/build/utils/validation.d.ts +89 -0
- package/build/utils/validation.d.ts.map +1 -0
- package/build/utils/validation.js +78 -0
- package/build/utils/validation.js.map +1 -0
- package/docker-compose.yml +20 -0
- package/eslint.config.js +97 -0
- package/package.json +92 -0
- package/scripts/generate-version.js +31 -0
- package/src/api/client.ts +286 -0
- package/src/api/types.ts +137 -0
- package/src/config/settings.ts +113 -0
- package/src/constants.ts +29 -0
- package/src/index.ts +99 -0
- package/src/mcp-server.ts +342 -0
- package/src/tools/action-words.ts +240 -0
- package/src/tools/projects.ts +144 -0
- package/src/tools/scenarios.ts +231 -0
- package/src/tools/test-runs.ts +400 -0
- package/src/transports/http.ts +467 -0
- package/src/transports/index.ts +26 -0
- package/src/transports/stdio.ts +28 -0
- package/src/utils/errors.ts +45 -0
- package/src/utils/logger-constants.ts +18 -0
- package/src/utils/logger.ts +150 -0
- package/src/utils/validation.ts +94 -0
- package/test/api/client-with-msw.test.ts +122 -0
- package/test/api/client.test.ts +326 -0
- package/test/api/types.test.ts +88 -0
- package/test/config/settings.test.ts +204 -0
- package/test/mocks/data/action-words.ts +40 -0
- package/test/mocks/data/index.ts +13 -0
- package/test/mocks/data/projects.ts +38 -0
- package/test/mocks/data/scenarios.ts +53 -0
- package/test/mocks/data/test-runs.ts +101 -0
- package/test/mocks/handlers/action-words.ts +52 -0
- package/test/mocks/handlers/index.ts +10 -0
- package/test/mocks/handlers/projects.ts +45 -0
- package/test/mocks/handlers/scenarios.ts +72 -0
- package/test/mocks/handlers/test-runs.ts +106 -0
- package/test/mocks/server.ts +26 -0
- package/test/setup/vitest.setup.ts +18 -0
- package/test/tools/coverage-boost.test.ts +252 -0
- package/test/tools/projects.test.ts +290 -0
- package/test/tools/tools-basic.test.ts +146 -0
- package/test/transports/http-basic.test.ts +87 -0
- package/test/transports/http-simple.test.ts +33 -0
- package/test/transports/stdio.test.ts +73 -0
- package/test/utils/errors.test.ts +117 -0
- package/test/utils/validation.test.ts +261 -0
- package/tsconfig.build.json +8 -0
- package/tsconfig.json +27 -0
- package/vitest.config.ts +43 -0
package/.env.example
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Cucumber Studio API Configuration
|
|
2
|
+
# Get these values from your Cucumber Studio account settings
|
|
3
|
+
|
|
4
|
+
# Your Cucumber Studio access token
|
|
5
|
+
CUCUMBERSTUDIO_ACCESS_TOKEN=your_access_token_here
|
|
6
|
+
|
|
7
|
+
# Your Cucumber Studio client ID
|
|
8
|
+
CUCUMBERSTUDIO_CLIENT_ID=your_client_id_here
|
|
9
|
+
|
|
10
|
+
# Your Cucumber Studio UID
|
|
11
|
+
CUCUMBERSTUDIO_UID=your_uid_here
|
|
12
|
+
|
|
13
|
+
# Optional: Custom base URL (defaults to https://studio.cucumberstudio.com/api)
|
|
14
|
+
# CUCUMBERSTUDIO_BASE_URL=https://studio.cucumberstudio.com/api
|
|
15
|
+
|
|
16
|
+
# Optional: MCP Server Configuration
|
|
17
|
+
# MCP_SERVER_NAME=cucumberstudio-mcp
|
|
18
|
+
# MCP_SERVER_VERSION=1.0.0
|
|
19
|
+
|
|
20
|
+
# Transport Configuration
|
|
21
|
+
# MCP_TRANSPORT=stdio # Options: stdio, http, streamable-http
|
|
22
|
+
# MCP_PORT=3000 # Port for HTTP transport
|
|
23
|
+
# MCP_HOST=127.0.0.1 # Host for HTTP transport
|
|
24
|
+
# MCP_CORS_ORIGIN=true # CORS origin setting for HTTP transport
|
|
25
|
+
|
|
26
|
+
# Logging Configuration
|
|
27
|
+
# LOG_LEVEL=info # Options: error, warn, info, debug, trace
|
|
28
|
+
# LOG_API_RESPONSES=false # Log Cucumber Studio API responses
|
|
29
|
+
# LOG_REQUEST_BODIES=false # Log API request bodies (for debugging)
|
|
30
|
+
# LOG_RESPONSE_BODIES=false # Log API response bodies (for debugging)
|
|
31
|
+
|
|
32
|
+
# Optional: Performance and Limits Configuration
|
|
33
|
+
# API_TIMEOUT=30000 # API request timeout in milliseconds (default: 30000)
|
|
34
|
+
# MAX_PAGE_SIZE=100 # Maximum items per page for list operations (default: 100)
|
|
35
|
+
# JSON_BODY_LIMIT=10mb # Maximum JSON body size for HTTP transport (default: 10mb)
|
|
36
|
+
# CORS_ORIGINS=localhost,127.0.0.1,0.0.0.0 # Comma-separated list of allowed CORS origins
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: PR Checks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [ master, main ]
|
|
6
|
+
push:
|
|
7
|
+
branches: [ master, main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
quality-checks:
|
|
11
|
+
name: Quality Checks
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
node-version: [20.x, 22.x]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout code
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Setup Node.js ${{ matrix.node-version }}
|
|
23
|
+
uses: actions/setup-node@v4
|
|
24
|
+
with:
|
|
25
|
+
node-version: ${{ matrix.node-version }}
|
|
26
|
+
cache: 'npm'
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: npm ci
|
|
30
|
+
|
|
31
|
+
- name: Run TypeScript type checking
|
|
32
|
+
run: npm run typecheck
|
|
33
|
+
|
|
34
|
+
- name: Run ESLint
|
|
35
|
+
run: npm run lint
|
|
36
|
+
|
|
37
|
+
- name: Run tests
|
|
38
|
+
run: npm test
|
|
39
|
+
|
|
40
|
+
- name: Run build check
|
|
41
|
+
run: npm run build
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*' # Trigger on version tags like v1.0.0, v1.2.3, etc.
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
packages: write
|
|
11
|
+
actions: read
|
|
12
|
+
pull-requests: write
|
|
13
|
+
issues: write
|
|
14
|
+
repository-projects: write
|
|
15
|
+
|
|
16
|
+
env:
|
|
17
|
+
NODE_VERSION: '20'
|
|
18
|
+
REGISTRY: docker.io
|
|
19
|
+
IMAGE_NAME: herosizy/cucumberstudio-mcp
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
test:
|
|
23
|
+
name: Test and Build
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- name: Checkout code
|
|
27
|
+
uses: actions/checkout@v4
|
|
28
|
+
|
|
29
|
+
- name: Setup Node.js
|
|
30
|
+
uses: actions/setup-node@v4
|
|
31
|
+
with:
|
|
32
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
33
|
+
cache: 'npm'
|
|
34
|
+
|
|
35
|
+
- name: Install dependencies
|
|
36
|
+
run: npm ci
|
|
37
|
+
|
|
38
|
+
- name: Run type checking
|
|
39
|
+
run: npm run typecheck
|
|
40
|
+
|
|
41
|
+
- name: Run linting
|
|
42
|
+
run: npm run lint
|
|
43
|
+
|
|
44
|
+
- name: Run tests
|
|
45
|
+
run: npm run test:coverage
|
|
46
|
+
|
|
47
|
+
- name: Build project
|
|
48
|
+
run: npm run build
|
|
49
|
+
|
|
50
|
+
- name: Upload build artifacts
|
|
51
|
+
uses: actions/upload-artifact@v4
|
|
52
|
+
with:
|
|
53
|
+
name: build-artifacts
|
|
54
|
+
path: build/
|
|
55
|
+
retention-days: 1
|
|
56
|
+
|
|
57
|
+
publish-npm:
|
|
58
|
+
name: Publish to NPM
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
needs: test
|
|
61
|
+
steps:
|
|
62
|
+
- name: Checkout code
|
|
63
|
+
uses: actions/checkout@v4
|
|
64
|
+
|
|
65
|
+
- name: Setup Node.js
|
|
66
|
+
uses: actions/setup-node@v4
|
|
67
|
+
with:
|
|
68
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
69
|
+
cache: 'npm'
|
|
70
|
+
registry-url: 'https://registry.npmjs.org'
|
|
71
|
+
|
|
72
|
+
- name: Install dependencies
|
|
73
|
+
run: npm ci
|
|
74
|
+
|
|
75
|
+
- name: Download build artifacts
|
|
76
|
+
uses: actions/download-artifact@v4
|
|
77
|
+
with:
|
|
78
|
+
name: build-artifacts
|
|
79
|
+
path: build/
|
|
80
|
+
|
|
81
|
+
- name: Extract version from tag
|
|
82
|
+
id: get_version
|
|
83
|
+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
84
|
+
|
|
85
|
+
- name: Update package.json version
|
|
86
|
+
run: |
|
|
87
|
+
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
88
|
+
TARGET_VERSION=${{ steps.get_version.outputs.VERSION }}
|
|
89
|
+
if [ "$CURRENT_VERSION" != "$TARGET_VERSION" ]; then
|
|
90
|
+
echo "Updating version from $CURRENT_VERSION to $TARGET_VERSION"
|
|
91
|
+
npm version $TARGET_VERSION --no-git-tag-version
|
|
92
|
+
else
|
|
93
|
+
echo "Version $TARGET_VERSION already matches package.json, skipping update"
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
- name: Publish to NPM
|
|
97
|
+
run: npm publish --access public
|
|
98
|
+
env:
|
|
99
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
100
|
+
|
|
101
|
+
publish-docker:
|
|
102
|
+
name: Publish to Docker Hub
|
|
103
|
+
runs-on: ubuntu-latest
|
|
104
|
+
needs: test
|
|
105
|
+
steps:
|
|
106
|
+
- name: Checkout code
|
|
107
|
+
uses: actions/checkout@v4
|
|
108
|
+
|
|
109
|
+
- name: Extract version from tag
|
|
110
|
+
id: get_version
|
|
111
|
+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
112
|
+
|
|
113
|
+
- name: Set up Docker Buildx
|
|
114
|
+
uses: docker/setup-buildx-action@v3
|
|
115
|
+
|
|
116
|
+
- name: Log in to Docker Hub
|
|
117
|
+
uses: docker/login-action@v3
|
|
118
|
+
with:
|
|
119
|
+
registry: ${{ env.REGISTRY }}
|
|
120
|
+
username: ${{ secrets.DOCKER_USERNAME }}
|
|
121
|
+
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
122
|
+
|
|
123
|
+
- name: Extract metadata
|
|
124
|
+
id: meta
|
|
125
|
+
uses: docker/metadata-action@v5
|
|
126
|
+
with:
|
|
127
|
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
128
|
+
tags: |
|
|
129
|
+
type=ref,event=tag
|
|
130
|
+
type=semver,pattern={{version}}
|
|
131
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
132
|
+
type=semver,pattern={{major}}
|
|
133
|
+
type=raw,value=latest
|
|
134
|
+
|
|
135
|
+
- name: Build and push Docker image
|
|
136
|
+
uses: docker/build-push-action@v5
|
|
137
|
+
with:
|
|
138
|
+
context: .
|
|
139
|
+
platforms: linux/amd64,linux/arm64
|
|
140
|
+
push: true
|
|
141
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
142
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
143
|
+
cache-from: type=gha
|
|
144
|
+
cache-to: type=gha,mode=max
|
|
145
|
+
|
|
146
|
+
create-release:
|
|
147
|
+
name: Create GitHub Release
|
|
148
|
+
runs-on: ubuntu-latest
|
|
149
|
+
needs: [publish-npm, publish-docker]
|
|
150
|
+
steps:
|
|
151
|
+
- name: Checkout code
|
|
152
|
+
uses: actions/checkout@v4
|
|
153
|
+
|
|
154
|
+
- name: Extract version from tag
|
|
155
|
+
id: get_version
|
|
156
|
+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
157
|
+
|
|
158
|
+
- name: Generate changelog
|
|
159
|
+
id: changelog
|
|
160
|
+
run: |
|
|
161
|
+
if [ -f CHANGELOG.md ]; then
|
|
162
|
+
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
|
|
163
|
+
sed -n "/## \[${{ steps.get_version.outputs.VERSION }}\]/,/## \[/p" CHANGELOG.md | head -n -1 >> $GITHUB_OUTPUT
|
|
164
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
165
|
+
else
|
|
166
|
+
echo "CHANGELOG=Release ${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_OUTPUT
|
|
167
|
+
fi
|
|
168
|
+
|
|
169
|
+
- name: Create GitHub Release
|
|
170
|
+
uses: softprops/action-gh-release@v1
|
|
171
|
+
with:
|
|
172
|
+
name: Release ${{ steps.get_version.outputs.VERSION }}
|
|
173
|
+
body: |
|
|
174
|
+
## Changes in v${{ steps.get_version.outputs.VERSION }}
|
|
175
|
+
|
|
176
|
+
${{ steps.changelog.outputs.CHANGELOG }}
|
|
177
|
+
|
|
178
|
+
## Installation
|
|
179
|
+
|
|
180
|
+
### NPM
|
|
181
|
+
```bash
|
|
182
|
+
npx cucumberstudio-mcp
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Docker
|
|
186
|
+
```bash
|
|
187
|
+
docker run --env-file .env ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get_version.outputs.VERSION }}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Links
|
|
191
|
+
- [NPM Package](https://www.npmjs.com/package/cucumberstudio-mcp)
|
|
192
|
+
- [Docker Image](https://hub.docker.com/r/${{ env.IMAGE_NAME }})
|
|
193
|
+
draft: false
|
|
194
|
+
prerelease: false
|
package/.prettierignore
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Build outputs
|
|
5
|
+
build/
|
|
6
|
+
dist/
|
|
7
|
+
|
|
8
|
+
# Coverage
|
|
9
|
+
coverage/
|
|
10
|
+
|
|
11
|
+
# Config files
|
|
12
|
+
package-lock.json
|
|
13
|
+
*.md
|
|
14
|
+
*.json
|
|
15
|
+
|
|
16
|
+
# Docker
|
|
17
|
+
Dockerfile*
|
|
18
|
+
docker-compose*.yml
|
|
19
|
+
|
|
20
|
+
# Git
|
|
21
|
+
.git/
|
|
22
|
+
.gitignore
|
|
23
|
+
|
|
24
|
+
# IDE
|
|
25
|
+
.vscode/
|
|
26
|
+
.idea/
|
package/.prettierrc
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"semi": false,
|
|
3
|
+
"singleQuote": true,
|
|
4
|
+
"quoteProps": "as-needed",
|
|
5
|
+
"trailingComma": "all",
|
|
6
|
+
"tabWidth": 2,
|
|
7
|
+
"useTabs": false,
|
|
8
|
+
"printWidth": 120,
|
|
9
|
+
"bracketSpacing": true,
|
|
10
|
+
"bracketSameLine": false,
|
|
11
|
+
"arrowParens": "always",
|
|
12
|
+
"endOfLine": "lf",
|
|
13
|
+
"embeddedLanguageFormatting": "auto"
|
|
14
|
+
}
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
This is a CucumberStudio MCP (Model Context Protocol) project. MCP servers provide standardized interfaces for AI assistants to interact with external systems and data sources.
|
|
8
|
+
|
|
9
|
+
## Development Commands
|
|
10
|
+
|
|
11
|
+
- `npm install` - Install dependencies
|
|
12
|
+
- `npm run build` - Build TypeScript to JavaScript
|
|
13
|
+
- `npm run dev` - Run the server in development mode with tsx
|
|
14
|
+
- `npm start` - Run the built server
|
|
15
|
+
- `npm run lint` - Run ESLint
|
|
16
|
+
- `npm run typecheck` - Run TypeScript type checking
|
|
17
|
+
- `npm test` - Run tests once
|
|
18
|
+
- `npm run test:watch` - Run tests in watch mode
|
|
19
|
+
- `npm run test:coverage` - Run tests with coverage report
|
|
20
|
+
|
|
21
|
+
### Docker Commands
|
|
22
|
+
- `npm run docker:build` - Build production Docker image
|
|
23
|
+
- `npm run docker:build:dev` - Build development Docker image
|
|
24
|
+
- `npm run docker:run` - Run production container
|
|
25
|
+
- `npm run docker:run:dev` - Run development container with hot reload
|
|
26
|
+
- `npm run docker:compose:up` - Start with docker-compose
|
|
27
|
+
- `npm run docker:compose:up:dev` - Start development environment
|
|
28
|
+
- `npm run docker:compose:down` - Stop docker-compose services
|
|
29
|
+
|
|
30
|
+
### Transport Options
|
|
31
|
+
- **STDIO** (default): `npm start` or `MCP_TRANSPORT=stdio npm start`
|
|
32
|
+
- **HTTP/Streamable HTTP**: `npm run start:http` or `MCP_TRANSPORT=http npm start`
|
|
33
|
+
- **Development HTTP**: `npm run dev:http` or `MCP_TRANSPORT=http npm run dev`
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
The MCP server is built with TypeScript and follows a clean, modular architecture:
|
|
38
|
+
|
|
39
|
+
- **Entry Point**: `src/index.ts` - Main entry point with transport selection using enum-based switch cases
|
|
40
|
+
- **Server Factory**: `src/mcp-server.ts` - Direct McpServer creation with tool registration
|
|
41
|
+
- **Configuration**: `src/config/settings.ts` - Environment-based configuration management
|
|
42
|
+
- **Transports**: `src/transports/` - Transport layer implementations
|
|
43
|
+
- `stdio.ts` - Standard input/output transport (default)
|
|
44
|
+
- `http.ts` - Streamable HTTP transport with session management
|
|
45
|
+
- `index.ts` - Transport exports, types, and enums
|
|
46
|
+
- **API Client**: `src/api/client.ts` - Cucumber Studio API client with authentication
|
|
47
|
+
- **Tool Modules**: `src/tools/` - MCP tool implementations organized by feature
|
|
48
|
+
- `projects.ts` - Project management tools
|
|
49
|
+
- `scenarios.ts` - Scenario retrieval tools
|
|
50
|
+
- `action-words.ts` - Action word (reusable steps) tools
|
|
51
|
+
- `test-runs.ts` - Test execution and build tools
|
|
52
|
+
- **Utilities**: `src/utils/` - Error handling and validation utilities
|
|
53
|
+
|
|
54
|
+
## MCP Server Development Notes
|
|
55
|
+
|
|
56
|
+
- MCP servers implement the Model Context Protocol specification
|
|
57
|
+
- Servers typically expose tools, resources, and prompts to MCP clients
|
|
58
|
+
- Common patterns include resource discovery, tool execution, and state management
|
|
59
|
+
- Follow MCP specification for proper server implementation
|
|
60
|
+
- **SDK Version**: Uses MCP TypeScript SDK v1.12.3+ with modern `McpServer` class and `registerTool` pattern
|
|
61
|
+
- **Implementation**: Uses modern `McpServer.registerTool()` method for clean tool registration with Zod validation
|
|
62
|
+
- **Architecture**: Direct McpServer usage without unnecessary wrapper classes
|
|
63
|
+
|
|
64
|
+
## Key Resources
|
|
65
|
+
|
|
66
|
+
- MCP TypeScript SDK: https://github.com/modelcontextprotocol/typescript-sdk
|
|
67
|
+
- MCP Specifications for LLMs: https://modelcontextprotocol.io/llms.txt
|
|
68
|
+
- Cucumber Studio API Documentation: https://studio-api.cucumberstudio.com/#introduction
|
|
69
|
+
- Cucumber Studio API Reference (GitHub): https://github.com/SmartBear/cucumberstudio-api-documentation/tree/master/source/includes
|
|
70
|
+
|
|
71
|
+
## Technical Implementation
|
|
72
|
+
|
|
73
|
+
### MCP SDK Integration
|
|
74
|
+
- **Server Class**: Uses `Server` from `@modelcontextprotocol/sdk/server/index.js`
|
|
75
|
+
- **Transport**: Uses `StdioServerTransport` from `@modelcontextprotocol/sdk/server/stdio.js`
|
|
76
|
+
- **Request Handlers**: Implements `ListToolsRequestSchema` and `CallToolRequestSchema` handlers
|
|
77
|
+
- **Tool Registration**: Tools are registered through request handlers, not direct registration
|
|
78
|
+
- **Capabilities**: Server declares `tools: {}` capability to MCP clients
|
|
79
|
+
|
|
80
|
+
## Project Structure
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
src/
|
|
84
|
+
├── index.ts # Main entry point with transport selection
|
|
85
|
+
├── server.ts # MCP server class and tool handler setup
|
|
86
|
+
├── config/
|
|
87
|
+
│ └── settings.ts # Configuration management with Zod validation
|
|
88
|
+
├── transports/
|
|
89
|
+
│ ├── index.ts # Transport exports and types
|
|
90
|
+
│ ├── stdio.ts # Standard input/output transport
|
|
91
|
+
│ └── http.ts # Streamable HTTP transport with session management
|
|
92
|
+
├── api/
|
|
93
|
+
│ ├── client.ts # Cucumber Studio API client with authentication
|
|
94
|
+
│ └── types.ts # TypeScript types for API responses
|
|
95
|
+
├── tools/
|
|
96
|
+
│ ├── projects.ts # Project retrieval tools
|
|
97
|
+
│ ├── scenarios.ts # Scenario and folder tools
|
|
98
|
+
│ ├── action-words.ts # Action word (reusable steps) tools
|
|
99
|
+
│ └── test-runs.ts # Test run, execution, and build tools
|
|
100
|
+
└── utils/
|
|
101
|
+
├── errors.ts # MCP error handling utilities
|
|
102
|
+
└── validation.ts # Input validation with Zod schemas
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Available MCP Tools
|
|
106
|
+
|
|
107
|
+
### Project Tools
|
|
108
|
+
- `cucumberstudio_list_projects` - List all accessible projects
|
|
109
|
+
- `cucumberstudio_get_project` - Get detailed project information
|
|
110
|
+
|
|
111
|
+
### Scenario Tools
|
|
112
|
+
- `cucumberstudio_list_scenarios` - List scenarios in a project
|
|
113
|
+
- `cucumberstudio_get_scenario` - Get detailed scenario information
|
|
114
|
+
- `cucumberstudio_find_scenarios_by_tags` - Find scenarios by tags
|
|
115
|
+
|
|
116
|
+
### Action Word Tools
|
|
117
|
+
- `cucumberstudio_list_action_words` - List reusable action words
|
|
118
|
+
- `cucumberstudio_get_action_word` - Get detailed action word information
|
|
119
|
+
- `cucumberstudio_find_action_words_by_tags` - Find action words by tags
|
|
120
|
+
|
|
121
|
+
### Test Execution Tools
|
|
122
|
+
- `cucumberstudio_list_test_runs` - List test runs
|
|
123
|
+
- `cucumberstudio_get_test_run` - Get detailed test run information
|
|
124
|
+
- `cucumberstudio_get_test_executions` - Get individual test results
|
|
125
|
+
- `cucumberstudio_list_builds` - List builds
|
|
126
|
+
- `cucumberstudio_get_build` - Get build details
|
|
127
|
+
- `cucumberstudio_list_execution_environments` - List execution environments
|
|
128
|
+
|
|
129
|
+
## Environment Setup
|
|
130
|
+
|
|
131
|
+
Copy `.env.example` to `.env` and configure your Cucumber Studio API credentials:
|
|
132
|
+
- `CUCUMBERSTUDIO_ACCESS_TOKEN` - Your API access token
|
|
133
|
+
- `CUCUMBERSTUDIO_CLIENT_ID` - Your client ID
|
|
134
|
+
- `CUCUMBERSTUDIO_UID` - Your user ID
|
|
135
|
+
|
|
136
|
+
### Transport Configuration
|
|
137
|
+
- `MCP_TRANSPORT` - Transport type: `stdio` (default), `http`, or `streamable-http`
|
|
138
|
+
- `MCP_PORT` - HTTP transport port (default: 3000)
|
|
139
|
+
- `MCP_HOST` - HTTP transport host (default: 127.0.0.1)
|
|
140
|
+
- `MCP_CORS_ORIGIN` - CORS origin setting (default: true)
|
package/Dockerfile
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Stage 1: Build stage
|
|
2
|
+
FROM node:20-alpine AS builder
|
|
3
|
+
|
|
4
|
+
# Set working directory
|
|
5
|
+
WORKDIR /app
|
|
6
|
+
|
|
7
|
+
# Copy package files and scripts
|
|
8
|
+
COPY package*.json ./
|
|
9
|
+
COPY scripts/ ./scripts/
|
|
10
|
+
|
|
11
|
+
# Install all dependencies (including dev dependencies for build)
|
|
12
|
+
RUN npm ci
|
|
13
|
+
|
|
14
|
+
# Copy source code
|
|
15
|
+
COPY . .
|
|
16
|
+
|
|
17
|
+
# Build the application
|
|
18
|
+
RUN npm run build
|
|
19
|
+
|
|
20
|
+
# Stage 2: Production stage
|
|
21
|
+
FROM node:20-alpine AS production
|
|
22
|
+
|
|
23
|
+
# Install dumb-init for proper signal handling
|
|
24
|
+
RUN apk add --no-cache dumb-init
|
|
25
|
+
|
|
26
|
+
# Create non-root user
|
|
27
|
+
RUN addgroup -g 1001 -S nodejs && \
|
|
28
|
+
adduser -S mcpserver -u 1001
|
|
29
|
+
|
|
30
|
+
# Set working directory
|
|
31
|
+
WORKDIR /app
|
|
32
|
+
|
|
33
|
+
# Copy built application from builder stage
|
|
34
|
+
COPY --from=builder --chown=mcpserver:nodejs /app/build ./build
|
|
35
|
+
|
|
36
|
+
# Switch to non-root user
|
|
37
|
+
USER mcpserver
|
|
38
|
+
|
|
39
|
+
# Expose port for HTTP transport
|
|
40
|
+
EXPOSE 3000
|
|
41
|
+
|
|
42
|
+
# Health check
|
|
43
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
44
|
+
CMD node -e "console.log('MCP Server is healthy')" || exit 1
|
|
45
|
+
|
|
46
|
+
# Use dumb-init to handle signals properly
|
|
47
|
+
ENTRYPOINT ["dumb-init", "--"]
|
|
48
|
+
|
|
49
|
+
# Start the server
|
|
50
|
+
CMD ["node", "build/index.js"]
|
package/Dockerfile.dev
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Development Dockerfile with hot reload
|
|
2
|
+
FROM node:20-alpine
|
|
3
|
+
|
|
4
|
+
# Set working directory
|
|
5
|
+
WORKDIR /app
|
|
6
|
+
|
|
7
|
+
# Install global dependencies for development
|
|
8
|
+
RUN npm install -g tsx nodemon
|
|
9
|
+
|
|
10
|
+
# Copy package files
|
|
11
|
+
COPY package*.json ./
|
|
12
|
+
|
|
13
|
+
# Install all dependencies (including dev dependencies)
|
|
14
|
+
RUN npm install
|
|
15
|
+
|
|
16
|
+
# Copy source code
|
|
17
|
+
COPY . .
|
|
18
|
+
|
|
19
|
+
# Create non-root user
|
|
20
|
+
RUN addgroup -g 1001 -S nodejs
|
|
21
|
+
RUN adduser -S mcpserver -u 1001
|
|
22
|
+
|
|
23
|
+
# Change ownership of the app directory
|
|
24
|
+
RUN chown -R mcpserver:nodejs /app
|
|
25
|
+
USER mcpserver
|
|
26
|
+
|
|
27
|
+
# Expose port for development/debugging
|
|
28
|
+
EXPOSE 3000
|
|
29
|
+
|
|
30
|
+
# Development command with hot reload
|
|
31
|
+
CMD ["npm", "run", "dev"]
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Cucumber Studio MCP Server
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|