Skip to content

Commit b1f2566

Browse files
Merge pull request #16 from mapbox/feat/mcp-vitest-tshy
[chore] Update MCP DevKit server to use ESM/vitest
2 parents f2b81a4 + 3a946c0 commit b1f2566

62 files changed

Lines changed: 3426 additions & 4578 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_size = 2
5+
indent_style = space
6+
end_of_line = lf
7+
insert_final_newline = true
8+
charset = utf-8

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ dist/
55
.env
66
.env.local
77
.env.*.local
8+
9+
# tshy
10+
.tshy/
11+
.tshy-build/
12+
13+
# Test results
14+
test-results.xml

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## 0.4.0 (Unreleased)
2+
3+
### Features Added
4+
5+
- New fetch pipeline with automatic retry behavior
6+
7+
### Bug Fixes
8+
9+
- Dual emits ESM and CommonJS bundles with types per target
10+
11+
### Other Features
12+
13+
- Migrated from Jest to vitest
14+
- Added EditorConfig support for development work

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ COPY . .
1616
RUN mkdir -p dist && echo '{"sha":"unknown","tag":"unknown","branch":"docker","version":"0.0.1"}' > dist/version.json
1717

1818
# Build the application, overriding the git commands to avoid errors
19-
RUN npm run build:esm && npm run build:cjs
19+
RUN npx tshy
2020

2121
# Command to run the server
22-
CMD ["node", "dist/index.js"]
22+
CMD ["node", "dist/esm/index.js"]

README.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,32 @@ A Model Context Protocol (MCP) server that provides AI assistants with direct ac
66

77
## Table of Contents
88

9-
- [Quick Start](#quick-start)
10-
- [Integration with Developer Tools](#integration-with-developer-tools)
11-
- [DXT Package Distribution](#dxt-package-distribution)
12-
- [Getting Your Mapbox Access Token](#getting-your-mapbox-access-token)
13-
- [Tools](#tools)
14-
- [Documentation Tools](#documentation-tools)
15-
- [Style Management Tools](#style-management-tools)
16-
- [Token Management Tools](#token-management-tools)
17-
- [Local Processing Tools](#local-processing-tools)
18-
- [Development](#development)
19-
- [Testing](#testing)
20-
- [Inspecting Server](#inspecting-server)
21-
- [Creating New Tools](#creating-new-tools)
22-
- [Environment Variables](#environment-variables)
9+
- [Mapbox Developer MCP Server](#mapbox-developer-mcp-server)
10+
- [Table of Contents](#table-of-contents)
11+
- [Quick Start](#quick-start)
12+
- [Integration with Developer Tools](#integration-with-developer-tools)
13+
- [DXT Package Distribution](#dxt-package-distribution)
14+
- [Creating the DXT Package](#creating-the-dxt-package)
15+
- [Getting Your Mapbox Access Token](#getting-your-mapbox-access-token)
16+
- [Tools](#tools)
17+
- [Documentation Tools](#documentation-tools)
18+
- [Style Management Tools](#style-management-tools)
19+
- [Token Management Tools](#token-management-tools)
20+
- [create-token](#create-token)
21+
- [list-tokens](#list-tokens)
22+
- [Local Processing Tools](#local-processing-tools)
23+
- [GeoJSON Preview tool (Beta)](#geojson-preview-tool-beta)
24+
- [Coordinate Conversion tool](#coordinate-conversion-tool)
25+
- [Bounding Box tool](#bounding-box-tool)
26+
- [Development](#development)
27+
- [Testing](#testing)
28+
- [Tool Snapshot Tests](#tool-snapshot-tests)
29+
- [Inspecting Server](#inspecting-server)
30+
- [Using Node.js](#using-nodejs)
31+
- [Using Docker](#using-docker)
32+
- [Creating New Tools](#creating-new-tools)
33+
- [Environment Variables](#environment-variables)
34+
- [VERBOSE_ERRORS](#verbose_errors)
2335

2436
## Quick Start
2537

@@ -53,7 +65,7 @@ This will generate `mcp-devkit-server.dxt` using the configuration in `manifest.
5365

5466
The DXT package includes:
5567

56-
- Pre-built server code (`dist/index.js`)
68+
- Pre-built server code (`dist/esm/index.js`)
5769
- Server metadata and configuration
5870
- User configuration schema for the Mapbox access token
5971
- Automatic environment variable setup
@@ -375,7 +387,7 @@ The project includes snapshot tests to ensure tool integrity and prevent acciden
375387
1. **Adding a new tool**: After creating a new tool, run the test with snapshot update flag:
376388

377389
```sh
378-
npm test -- src/tools/tool-naming-convention.test.ts --updateSnapshot
390+
npm test -- test/tools/tool-naming-convention.test.ts --updateSnapshot
379391
```
380392

381393
2. **Removing a tool**: After removing a tool, update the snapshot:
@@ -410,7 +422,7 @@ npm test -- --updateSnapshot
410422
npm run build
411423

412424
# Inspect
413-
npx @modelcontextprotocol/inspector node dist/index.js
425+
npx @modelcontextprotocol/inspector node dist/esm/index.js
414426
```
415427

416428
#### Using Docker

TOOL_CONFIGURATION.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The following tools are available in the Mapbox MCP Devkit Server:
5353
### Node.js
5454

5555
```bash
56-
node dist/index.js --enable-tools list_styles_tool,create_style_tool,preview_style_tool
56+
node dist/esm/index.js --enable-tools list_styles_tool,create_style_tool,preview_style_tool
5757
```
5858

5959
### NPX
@@ -78,7 +78,7 @@ In your Claude Desktop configuration file:
7878
"mapbox-devkit": {
7979
"command": "node",
8080
"args": [
81-
"/path/to/mcp-devkit-server/dist/index.js",
81+
"/path/to/mcp-devkit-server/dist/esm/index.js",
8282
"--enable-tools",
8383
"list_styles_tool,create_style_tool,preview_style_tool"
8484
],
@@ -95,19 +95,19 @@ In your Claude Desktop configuration file:
9595
### Enable only read-only tools (safe mode)
9696

9797
```bash
98-
node dist/index.js --enable-tools list_styles_tool,retrieve_style_tool,list_tokens_tool,preview_style_tool
98+
node dist/esm/index.js --enable-tools list_styles_tool,retrieve_style_tool,list_tokens_tool,preview_style_tool
9999
```
100100

101101
### Enable only style management tools
102102

103103
```bash
104-
node dist/index.js --enable-tools list_styles_tool,create_style_tool,retrieve_style_tool,update_style_tool,delete_style_tool,preview_style_tool
104+
node dist/esm/index.js --enable-tools list_styles_tool,create_style_tool,retrieve_style_tool,update_style_tool,delete_style_tool,preview_style_tool
105105
```
106106

107107
### Disable dangerous operations
108108

109109
```bash
110-
node dist/index.js --disable-tools delete_style_tool,create_token_tool
110+
node dist/esm/index.js --disable-tools delete_style_tool,create_token_tool
111111
```
112112

113113
## Notes

docs/claude-code-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ If you want to use a local version (need to clone and build from this repo):
9696
"mcpServers": {
9797
"mapbox-devkit": {
9898
"command": "/path/to/your/node",
99-
"args": ["/path/to/mapbox-mcp-devkit/dist/index.js"],
99+
"args": ["/path/to/mapbox-mcp-devkit/dist/esm/index.js"],
100100
"env": {
101101
"MAPBOX_ACCESS_TOKEN": "your_token_here"
102102
}

docs/claude-desktop-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ If you want to use a local version (need to clone and build from this repo):
107107
"mcpServers": {
108108
"mapbox-devkit": {
109109
"command": "/path/to/your/node",
110-
"args": ["/path/to/mapbox-mcp-devkit/dist/index.js"],
110+
"args": ["/path/to/mapbox-mcp-devkit/dist/esm/index.js"],
111111
"env": {
112112
"MAPBOX_ACCESS_TOKEN": "your_token_here"
113113
}

eslint.config.mjs

Lines changed: 15 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,25 @@
1-
import js from '@eslint/js';
2-
import typescript from '@typescript-eslint/eslint-plugin';
3-
import typescriptParser from '@typescript-eslint/parser';
4-
import prettier from 'eslint-config-prettier';
5-
import importPlugin from 'eslint-plugin-import';
6-
import unusedImports from 'eslint-plugin-unused-imports';
1+
import eslint from '@eslint/js';
2+
import { defineConfig } from 'eslint/config';
3+
import tseslint from 'typescript-eslint';
4+
import globals from 'globals';
75

8-
export default [
6+
export default defineConfig(
7+
eslint.configs.recommended,
8+
tseslint.configs.recommended,
99
{
10-
ignores: ['dist/**', 'node_modules/**', '*.js', '*.cjs', '*.mjs']
11-
},
12-
{
13-
files: ['**/*.test.ts', '**/*.spec.ts', '**/*.test-helpers.ts'],
1410
languageOptions: {
1511
globals: {
16-
describe: 'readonly',
17-
test: 'readonly',
18-
it: 'readonly',
19-
expect: 'readonly',
20-
beforeEach: 'readonly',
21-
afterEach: 'readonly',
22-
jest: 'readonly',
23-
fetch: 'readonly',
24-
global: 'readonly'
25-
},
12+
...globals.node,
13+
}
2614
},
2715
rules: {
28-
'no-undef': 'off',
29-
'@typescript-eslint/no-unused-vars': 'off',
30-
'unused-imports/no-unused-imports': 'off',
31-
'import/order': 'off',
32-
},
16+
"@typescript-eslint/no-explicit-any": "warn",
17+
}
3318
},
34-
js.configs.recommended,
3519
{
36-
files: ['src/**/*.ts', 'src/**/*.tsx'],
37-
languageOptions: {
38-
parser: typescriptParser,
39-
parserOptions: {
40-
ecmaVersion: 'latest',
41-
sourceType: 'module',
42-
project: './tsconfig.json'
43-
},
44-
globals: {
45-
fetch: 'readonly',
46-
process: 'readonly',
47-
global: 'readonly',
48-
globalThis: 'readonly',
49-
URL: 'readonly',
50-
Request: 'readonly',
51-
RequestInit: 'readonly',
52-
Response: 'readonly',
53-
Buffer: 'readonly',
54-
console: 'readonly',
55-
require: 'readonly',
56-
__dirname: 'readonly',
57-
__filename: 'readonly',
58-
},
59-
},
60-
plugins: {
61-
'@typescript-eslint': typescript,
62-
'import': importPlugin,
63-
'unused-imports': unusedImports
64-
},
20+
files: ["test/**/*.ts"],
6521
rules: {
66-
...typescript.configs.recommended.rules,
67-
'@typescript-eslint/no-unused-vars': 'off',
68-
'unused-imports/no-unused-imports': 'error',
69-
'unused-imports/no-unused-vars': [
70-
'warn',
71-
{
72-
vars: 'all',
73-
varsIgnorePattern: '^_',
74-
args: 'after-used',
75-
argsIgnorePattern: '^_'
76-
}
77-
],
78-
'import/order': [
79-
'error',
80-
{
81-
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
82-
'newlines-between': 'never',
83-
alphabetize: {
84-
order: 'asc'
85-
}
86-
}
87-
],
88-
'no-console': 'warn',
89-
'@typescript-eslint/explicit-function-return-type': 'off',
90-
'@typescript-eslint/no-explicit-any': 'warn',
91-
'@typescript-eslint/no-non-null-assertion': 'warn',
92-
'@typescript-eslint/no-require-imports': 'off',
93-
'no-undef': 'off' // TypeScript handles this
22+
"@typescript-eslint/no-unused-vars": "off",
9423
}
95-
},
96-
prettier
97-
];
24+
}
25+
);

jest.config.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)