You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`src/utils/` - HTTP pipeline, JWT parsing, tracing, and version utilities
23
24
24
25
## Key Architectural Patterns
25
26
26
27
**Tool Architecture:** All tools extend `BaseTool<InputSchema, OutputSchema>`. Tools auto-validate inputs using Zod schemas. Each tool lives in `src/tools/tool-name-tool/` with separate `*.schema.ts` and `*.tool.ts` files.
27
28
29
+
**Prompt Architecture:** All prompts extend `BasePrompt` abstract class. Prompts orchestrate multi-step workflows, guiding AI assistants through complex tasks with best practices built-in. Each prompt lives in `src/prompts/` with separate files per prompt (e.g., `CreateAndPreviewStylePrompt.ts`). Prompts use kebab-case naming (e.g., `create-and-preview-style`).
30
+
28
31
**HTTP Pipeline System:** "Never patch global.fetch—use HttpPipeline with dependency injection instead." The `HttpPipeline` class applies policies (User-Agent, retry logic) via a chain-of-responsibility pattern. See `src/utils/httpPipeline.ts:20`.
29
32
30
33
**Resource System:** Static reference data exposed as MCP resources using URI pattern `resource://mapbox-*`, including style layer specs, Streets v8 field definitions, and token scope documentation.
31
34
32
35
**Token Management:** Tools receive `MAPBOX_ACCESS_TOKEN` via `extra.authInfo.token` or environment variable. Token scope validation is critical—most tool failures stem from insufficient scopes (see `README.md` for per-tool requirements).
33
36
34
-
**Tool Registry:** Tools are auto-discovered via `src/tools/index.ts` exports. No manual registration required—just export from index.
37
+
**Tool Registry:** Tools are auto-discovered via `src/tools/toolRegistry.ts` exports. No manual registration required—just export from registry.
38
+
39
+
**Prompt Registry:** Prompts are registered in `src/prompts/promptRegistry.ts`. To add a new prompt, create the prompt class and add it to the `ALL_PROMPTS` array. The main server automatically registers all prompts with proper Zod schema conversion.
@@ -453,6 +454,192 @@ An array of four numbers representing the bounding box: `[minX, minY, maxX, maxY
453
454
- "Calculate the bounding box of this GeoJSON file" (then upload a .geojson file)
454
455
- "What's the bounding box for the coordinates in the uploaded parks.geojson file?"
455
456
457
+
## Prompts
458
+
459
+
MCP Prompts are pre-built workflow templates that guide AI assistants through multi-step tasks. They orchestrate multiple tools in the correct sequence, providing best practices and error handling built-in.
460
+
461
+
**Available Prompts:**
462
+
463
+
### create-and-preview-style
464
+
465
+
Create a new Mapbox map style and generate a shareable preview link with automatic token management.
466
+
467
+
**Arguments:**
468
+
469
+
-`style_name` (required): Name for the new map style
470
+
-`style_description` (optional): Description of the style theme or purpose
471
+
-`base_style` (optional): Base style to start from (e.g., "streets-v12", "dark-v11")
472
+
-`preview_location` (optional): Location to center the preview map
473
+
-`preview_zoom` (optional): Zoom level for the preview (0-22, default: 12)
474
+
475
+
**What it does:**
476
+
477
+
1. Checks for an existing public token with `styles:read` scope
478
+
2. Creates a new public token if needed
479
+
3. Creates the map style
480
+
4. Generates a preview link
481
+
482
+
**Example usage:**
483
+
484
+
```
485
+
Use prompt: create-and-preview-style
486
+
Arguments:
487
+
style_name: "My Custom Map"
488
+
style_description: "A dark-themed map for nighttime navigation"
489
+
base_style: "dark-v11"
490
+
preview_location: "San Francisco"
491
+
preview_zoom: "13"
492
+
```
493
+
494
+
### build-custom-map
495
+
496
+
Use conversational AI to build a custom styled map based on a theme description.
1. Creates development token with localhost URL restrictions
563
+
2. Creates production token with domain URL restrictions (if provided)
564
+
3. Creates backend secret token for server-side operations (if needed)
565
+
4. Creates an initial map style using the specified theme
566
+
5. Generates preview link and provides integration guidance
567
+
568
+
**Example usage:**
569
+
570
+
```
571
+
Use prompt: setup-mapbox-project
572
+
Arguments:
573
+
project_name: "Restaurant Finder"
574
+
project_type: "fullstack"
575
+
production_domain: "restaurantfinder.com"
576
+
style_theme: "light"
577
+
```
578
+
579
+
### debug-mapbox-integration
580
+
581
+
Systematic troubleshooting workflow for diagnosing and fixing Mapbox integration issues.
582
+
583
+
**Arguments:**
584
+
585
+
-`issue_description` (required): Description of the problem (e.g., "map not loading", "401 error")
586
+
-`error_message` (optional): Exact error message from console or logs
587
+
-`style_id` (optional): Mapbox style ID being used, if applicable
588
+
-`environment` (optional): Where the issue occurs: "development", "production", "staging"
589
+
590
+
**What it does:**
591
+
592
+
1. Verifies token validity and required scopes
593
+
2. Checks style configuration and existence
594
+
3. Analyzes error messages and provides specific solutions
595
+
4. Tests API endpoints to isolate the problem
596
+
5. Provides step-by-step fix instructions
597
+
6. Offers prevention strategies
598
+
599
+
**Example usage:**
600
+
601
+
```
602
+
Use prompt: debug-mapbox-integration
603
+
Arguments:
604
+
issue_description: "Getting 401 errors when map loads"
605
+
error_message: "401 Unauthorized"
606
+
style_id: "my-style-id"
607
+
environment: "production"
608
+
```
609
+
610
+
### design-data-driven-style
611
+
612
+
Create a map style with data-driven properties that respond dynamically to feature data using expressions.
613
+
614
+
**Arguments:**
615
+
616
+
-`style_name` (required): Name for the data-driven style
617
+
-`data_description` (required): Description of the data (e.g., "population by city", "earthquake magnitudes")
618
+
-`property_name` (required): Name of the data property to visualize (e.g., "population", "magnitude")
619
+
-`visualization_type` (optional): How to visualize: "color", "size", "both", "heatmap" (default: "color")
620
+
-`color_scheme` (optional): Color scheme: "sequential", "diverging", "categorical" (default: "sequential")
621
+
622
+
**What it does:**
623
+
624
+
1. Explains data-driven styling concepts and expressions
625
+
2. Provides appropriate expression templates for your use case
626
+
3. Offers color scales and size ranges based on visualization type
627
+
4. Creates the style with data-driven layers
628
+
5. Includes advanced expression examples (zoom-based, conditional)
629
+
6. Provides best practices for accessibility and performance
630
+
631
+
**Example usage:**
632
+
633
+
```
634
+
Use prompt: design-data-driven-style
635
+
Arguments:
636
+
style_name: "Population Density Map"
637
+
data_description: "City population data"
638
+
property_name: "population"
639
+
visualization_type: "both"
640
+
color_scheme: "sequential"
641
+
```
642
+
456
643
## Resources
457
644
458
645
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.
0 commit comments