Skip to content

Commit b7baf99

Browse files
Merge pull request #34 from mapbox/devkit_resources
[resources] Add new resources to server with fallback tool
2 parents eea8f82 + 56b9f90 commit b7baf99

File tree

18 files changed

+2939
-20
lines changed

18 files changed

+2939
-20
lines changed

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ https://github.com/user-attachments/assets/8b1b8ef2-9fba-4951-bc9a-beaed4f6aff6
1616
- [Getting Your Mapbox Access Token](#getting-your-mapbox-access-token)
1717
- [Tools](#tools)
1818
- [Documentation Tools](#documentation-tools)
19+
- [Reference Tools](#reference-tools)
1920
- [Style Management Tools](#style-management-tools)
2021
- [Token Management Tools](#token-management-tools)
2122
- [create-token](#create-token)
@@ -24,6 +25,7 @@ https://github.com/user-attachments/assets/8b1b8ef2-9fba-4951-bc9a-beaed4f6aff6
2425
- [GeoJSON Preview tool (Beta)](#geojson-preview-tool-beta)
2526
- [Coordinate Conversion tool](#coordinate-conversion-tool)
2627
- [Bounding Box tool](#bounding-box-tool)
28+
- [Resources](#resources)
2729
- [Development](#development)
2830
- [Testing](#testing)
2931
- [Tool Snapshot Tests](#tool-snapshot-tests)
@@ -116,6 +118,27 @@ The `MAPBOX_ACCESS_TOKEN` environment variable is required. **Each tool requires
116118

117119
📖 **[See more examples and interactive demo →](./docs/mapbox-docs-tool-demo.md)**
118120

121+
### Reference Tools
122+
123+
**get_reference_tool** - Access static Mapbox reference documentation and schemas. This tool provides essential reference information that helps AI assistants understand Mapbox concepts and build correct styles and tokens.
124+
125+
> **Note:** This tool exists as a workaround for Claude Desktop's current limitation with MCP resources. Claude Desktop can see resources (via `resources/list`) but doesn't automatically call `resources/read` to fetch their content. This tool provides the same reference data through the tool interface, which Claude Desktop does support. Other MCP clients that fully support the resources protocol can access this data directly as MCP Resources (see [Resources](#resources) section below).
126+
127+
**Available References:**
128+
129+
- **`resource://mapbox-style-layers`** - Mapbox GL JS style specification reference guide covering all layer types (fill, line, symbol, circle, fill-extrusion) and their properties
130+
- **`resource://mapbox-streets-v8-fields`** - Complete field definitions for all Mapbox Streets v8 source layers, including enumerated values for each field (useful for building filters)
131+
- **`resource://mapbox-token-scopes`** - Comprehensive token scope reference explaining what each scope allows and which scopes are needed for different operations
132+
- **`resource://mapbox-layer-type-mapping`** - Mapping of Mapbox Streets v8 source layers to compatible GL JS layer types, with common usage patterns
133+
134+
**Example prompts:**
135+
136+
- "What fields are available for the landuse layer?"
137+
- "Show me the token scopes reference"
138+
- "What layer type should I use for roads?"
139+
- "Get the Streets v8 fields reference"
140+
- "What scopes do I need to display a map?"
141+
119142
### Style Management Tools
120143

121144
Complete set of tools for managing Mapbox styles via the Styles API:
@@ -374,6 +397,42 @@ An array of four numbers representing the bounding box: `[minX, minY, maxX, maxY
374397
- "Calculate the bounding box of this GeoJSON file" (then upload a .geojson file)
375398
- "What's the bounding box for the coordinates in the uploaded parks.geojson file?"
376399

400+
## Resources
401+
402+
This server exposes static reference documentation as MCP Resources. While these are primarily accessed through the `get_reference_tool`, MCP clients that fully support the resources protocol can access them directly.
403+
404+
**Available Resources:**
405+
406+
1. **Mapbox Style Specification Guide** (`resource://mapbox-style-layers`)
407+
- Complete reference for Mapbox GL JS layer types and properties
408+
- Covers fill, line, symbol, circle, and fill-extrusion layers
409+
- Includes paint and layout properties for each layer type
410+
411+
2. **Mapbox Streets v8 Fields Reference** (`resource://mapbox-streets-v8-fields`)
412+
- Field definitions for all Streets v8 source layers
413+
- Enumerated values for filterable fields
414+
- Essential for building accurate style filters
415+
- Example: `landuse` layer has `class` field with values like `park`, `cemetery`, `hospital`, etc.
416+
417+
3. **Mapbox Token Scopes Reference** (`resource://mapbox-token-scopes`)
418+
- Comprehensive documentation of token scopes
419+
- Explains public vs. secret token scopes
420+
- Common scope combinations for different use cases
421+
- Best practices for token management
422+
423+
4. **Mapbox Layer Type Mapping** (`resource://mapbox-layer-type-mapping`)
424+
- Maps Streets v8 source layers to compatible GL JS layer types
425+
- Organized by geometry type (polygon, line, point)
426+
- Includes common usage patterns and examples
427+
- Helps avoid incompatible layer type/source layer combinations
428+
429+
**Accessing Resources:**
430+
431+
- **Claude Desktop & Most MCP Clients**: Use the `get_reference_tool` to access these references
432+
- **Future MCP Clients**: May support direct resource access via the MCP resources protocol
433+
434+
**Note:** Resources provide static reference data that doesn't change frequently, while tools provide dynamic, user-specific data (like listing your styles or tokens) and perform actions (like creating styles or tokens).
435+
377436
## Development
378437

379438
### Testing

eslint.config.mjs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,43 @@ export default defineConfig(
1313
{
1414
plugins: {
1515
n: nPlugin,
16-
'unused-imports': unusedImports,
16+
'unused-imports': unusedImports
1717
},
1818
languageOptions: {
1919
ecmaVersion: 'latest',
2020
sourceType: 'module',
2121
globals: {
22-
...globals.node,
22+
...globals.node
2323
}
2424
},
2525
rules: {
2626
'@typescript-eslint/no-explicit-any': 'warn',
27+
'@typescript-eslint/no-unused-vars': [
28+
'error',
29+
{
30+
vars: 'all',
31+
varsIgnorePattern: '^_',
32+
args: 'after-used',
33+
argsIgnorePattern: '^_'
34+
}
35+
],
2736
'n/prefer-node-protocol': 'warn',
2837
'unused-imports/no-unused-imports': 'error',
2938
'unused-imports/no-unused-vars': [
3039
'warn',
3140
{
32-
'vars': 'all',
33-
'varsIgnorePattern': '^_',
34-
'args': 'after-used',
35-
'argsIgnorePattern': '^_',
36-
},
41+
vars: 'all',
42+
varsIgnorePattern: '^_',
43+
args: 'after-used',
44+
argsIgnorePattern: '^_'
45+
}
3746
]
38-
}
47+
}
3948
},
4049
{
41-
files: ['test/**/*.ts'],
50+
files: ['test/**/*.ts'],
4251
rules: {
43-
'@typescript-eslint/no-unused-vars': 'off',
52+
'@typescript-eslint/no-unused-vars': 'off'
4453
}
4554
}
4655
);

0 commit comments

Comments
 (0)