Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_size = 2
indent_style = space
end_of_line = lf
insert_final_newline = true
charset = utf-8
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ dist/
.env
.env.local
.env.*.local

# tshy
.tshy/
.tshy-build/

# Test results
test-results.xml
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## 0.4.0 (Unreleased)

### Features Added

- New fetch pipeline with automatic retry behavior

### Bug Fixes

- Dual emits ESM and CommonJS bundles with types per target

### Other Features

- Migrated from Jest to vitest
- Added EditorConfig support for development work
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY . .
RUN mkdir -p dist && echo '{"sha":"unknown","tag":"unknown","branch":"docker","version":"0.0.1"}' > dist/version.json

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

# Command to run the server
CMD ["node", "dist/index.js"]
CMD ["node", "dist/esm/index.js"]
47 changes: 29 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,32 @@ A Model Context Protocol (MCP) server that provides AI assistants with direct ac

## Table of Contents

- [Quick Start](#quick-start)
- [Integration with Developer Tools](#integration-with-developer-tools)
- [DXT Package Distribution](#dxt-package-distribution)
- [Getting Your Mapbox Access Token](#getting-your-mapbox-access-token)
- [Tools](#tools)
- [Documentation Tools](#documentation-tools)
- [Style Management Tools](#style-management-tools)
- [Token Management Tools](#token-management-tools)
- [Local Processing Tools](#local-processing-tools)
- [Development](#development)
- [Testing](#testing)
- [Inspecting Server](#inspecting-server)
- [Creating New Tools](#creating-new-tools)
- [Environment Variables](#environment-variables)
- [Mapbox Developer MCP Server](#mapbox-developer-mcp-server)
- [Table of Contents](#table-of-contents)
- [Quick Start](#quick-start)
- [Integration with Developer Tools](#integration-with-developer-tools)
- [DXT Package Distribution](#dxt-package-distribution)
- [Creating the DXT Package](#creating-the-dxt-package)
- [Getting Your Mapbox Access Token](#getting-your-mapbox-access-token)
- [Tools](#tools)
- [Documentation Tools](#documentation-tools)
- [Style Management Tools](#style-management-tools)
- [Token Management Tools](#token-management-tools)
- [create-token](#create-token)
- [list-tokens](#list-tokens)
- [Local Processing Tools](#local-processing-tools)
- [GeoJSON Preview tool (Beta)](#geojson-preview-tool-beta)
- [Coordinate Conversion tool](#coordinate-conversion-tool)
- [Bounding Box tool](#bounding-box-tool)
- [Development](#development)
- [Testing](#testing)
- [Tool Snapshot Tests](#tool-snapshot-tests)
- [Inspecting Server](#inspecting-server)
- [Using Node.js](#using-nodejs)
- [Using Docker](#using-docker)
- [Creating New Tools](#creating-new-tools)
- [Environment Variables](#environment-variables)
- [VERBOSE_ERRORS](#verbose_errors)

## Quick Start

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

The DXT package includes:

- Pre-built server code (`dist/index.js`)
- Pre-built server code (`dist/esm/index.js`)
- Server metadata and configuration
- User configuration schema for the Mapbox access token
- Automatic environment variable setup
Expand Down Expand Up @@ -82,7 +94,6 @@ The `MAPBOX_ACCESS_TOKEN` environment variable is required. **Each tool requires

**get_latest_mapbox_docs_tool** - Access the latest official Mapbox documentation directly from the source. This tool fetches comprehensive, up-to-date information about all Mapbox APIs, SDKs, and developer resources from docs.mapbox.com/llms.txt.


**Example prompts:**

- "What are the latest Mapbox APIs available for developers?"
Expand Down Expand Up @@ -368,7 +379,7 @@ The project includes snapshot tests to ensure tool integrity and prevent acciden
1. **Adding a new tool**: After creating a new tool, run the test with snapshot update flag:

```sh
npm test -- src/tools/tool-naming-convention.test.ts --updateSnapshot
npm test -- test/tools/tool-naming-convention.test.ts --updateSnapshot
```

2. **Removing a tool**: After removing a tool, update the snapshot:
Expand Down Expand Up @@ -403,7 +414,7 @@ npm test -- --updateSnapshot
npm run build

# Inspect
npx @modelcontextprotocol/inspector node dist/index.js
npx @modelcontextprotocol/inspector node dist/esm/index.js
```

#### Using Docker
Expand Down
10 changes: 5 additions & 5 deletions TOOL_CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The following tools are available in the Mapbox MCP Devkit Server:
### Node.js

```bash
node dist/index.js --enable-tools list_styles_tool,create_style_tool,preview_style_tool
node dist/esm/index.js --enable-tools list_styles_tool,create_style_tool,preview_style_tool
```

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

```bash
node dist/index.js --enable-tools list_styles_tool,retrieve_style_tool,list_tokens_tool,preview_style_tool
node dist/esm/index.js --enable-tools list_styles_tool,retrieve_style_tool,list_tokens_tool,preview_style_tool
```

### Enable only style management tools

```bash
node dist/index.js --enable-tools list_styles_tool,create_style_tool,retrieve_style_tool,update_style_tool,delete_style_tool,preview_style_tool
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
```

### Disable dangerous operations

```bash
node dist/index.js --disable-tools delete_style_tool,create_token_tool
node dist/esm/index.js --disable-tools delete_style_tool,create_token_tool
```

## Notes
Expand Down
2 changes: 1 addition & 1 deletion docs/claude-code-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ If you want to use a local version (need to clone and build from this repo):
"mcpServers": {
"mapbox-devkit": {
"command": "/path/to/your/node",
"args": ["/path/to/mapbox-mcp-devkit/dist/index.js"],
"args": ["/path/to/mapbox-mcp-devkit/dist/esm/index.js"],
"env": {
"MAPBOX_ACCESS_TOKEN": "your_token_here"
}
Expand Down
2 changes: 1 addition & 1 deletion docs/claude-desktop-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ If you want to use a local version (need to clone and build from this repo):
"mcpServers": {
"mapbox-devkit": {
"command": "/path/to/your/node",
"args": ["/path/to/mapbox-mcp-devkit/dist/index.js"],
"args": ["/path/to/mapbox-mcp-devkit/dist/esm/index.js"],
"env": {
"MAPBOX_ACCESS_TOKEN": "your_token_here"
}
Expand Down
102 changes: 15 additions & 87 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,97 +1,25 @@
import js from '@eslint/js';
import typescript from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import prettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import unusedImports from 'eslint-plugin-unused-imports';
import eslint from '@eslint/js';
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';
import globals from 'globals';

export default [
export default defineConfig(
eslint.configs.recommended,
tseslint.configs.recommended,
{
ignores: ['dist/**', 'node_modules/**', '*.js', '*.cjs', '*.mjs']
},
{
files: ['**/*.test.ts', '**/*.spec.ts', '**/*.test-helpers.ts'],
languageOptions: {
globals: {
describe: 'readonly',
test: 'readonly',
it: 'readonly',
expect: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
jest: 'readonly',
fetch: 'readonly',
global: 'readonly'
},
...globals.node,
}
},
rules: {
'no-undef': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'off',
'import/order': 'off',
},
"@typescript-eslint/no-explicit-any": "warn",
}
},
js.configs.recommended,
{
files: ['src/**/*.ts', 'src/**/*.tsx'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json'
},
globals: {
fetch: 'readonly',
process: 'readonly',
global: 'readonly',
globalThis: 'readonly',
URL: 'readonly',
Request: 'readonly',
RequestInit: 'readonly',
Response: 'readonly',
Buffer: 'readonly',
console: 'readonly',
require: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
},
},
plugins: {
'@typescript-eslint': typescript,
'import': importPlugin,
'unused-imports': unusedImports
},
files: ["test/**/*.ts"],
rules: {
...typescript.configs.recommended.rules,
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_'
}
],
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'never',
alphabetize: {
order: 'asc'
}
}
],
'no-console': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-require-imports': 'off',
'no-undef': 'off' // TypeScript handles this
"@typescript-eslint/no-unused-vars": "off",
}
},
prettier
];
}
);
24 changes: 0 additions & 24 deletions jest.config.js

This file was deleted.

6 changes: 3 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
"dxt_version": "0.1",
"name": "@mapbox/mcp-devkit-server",
"display_name": "Mapbox MCP DevKit Server",
"version": "0.3.1",
"version": "0.4.0",
"description": "Mapbox MCP devkit server",
"author": {
"name": "Mapbox, Inc."
},
"server": {
"type": "node",
"entry_point": "dist/index.js",
"entry_point": "dist/esm/index.js",
"mcp_config": {
"command": "node",
"args": [
"${__dirname}/dist/index.js"
"${__dirname}/dist/esm/index.js"
],
"env": {
"MAPBOX_ACCESS_TOKEN": "${user_config.MAPBOX_ACCESS_TOKEN}"
Expand Down
Loading