Skip to content

Add MCP integration patterns for development and runtime#19

Open
mattpodwysocki wants to merge 4 commits intomainfrom
add-mcp-integration-patterns
Open

Add MCP integration patterns for development and runtime#19
mattpodwysocki wants to merge 4 commits intomainfrom
add-mcp-integration-patterns

Conversation

@mattpodwysocki
Copy link
Contributor

Summary

Adds two comprehensive skills for integrating Mapbox Model Context Protocol (MCP) servers into development and production workflows.

New Skills

1. mapbox-mcp-devkit-patterns (Development-time)

For: Developers using AI coding assistants (Claude Code, Cursor, Windsurf, etc.)

Covers:

  • Setting up Mapbox MCP DevKit Server in coding environments
  • Style management workflows (conversational creation/updates)
  • Token management (scoped tokens, environment-specific)
  • Validation workflows (GeoJSON, expressions, coordinates)
  • Documentation access through AI
  • Integration patterns for Claude Code, Cursor, Windsurf, Cline
  • Security best practices and testing

Key patterns:

  • Iterative style development with AI
  • Environment-specific token generation
  • Validation-first development
  • Documentation-driven development

2. mapbox-mcp-runtime-patterns (Production-time)

For: Developers building AI applications with geospatial capabilities

Covers:

  • Integrating Mapbox MCP Server into AI frameworks:
    • pydantic-ai (Python)
    • mastra (TypeScript)
    • LangChain (JavaScript/TypeScript)
    • Custom agents
  • Architecture patterns (MCP as service layer, hybrid approaches)
  • Real-world use cases:
    • Real estate apps (Zillow-style) with commute calculations
    • Food delivery apps (DoorDash-style) with delivery zones
    • Travel planning apps (TripAdvisor-style) with itineraries
  • Performance optimization (caching, batching, tool selection)
  • Error handling and rate limiting
  • Security and testing

Key patterns:

  • Framework-specific integration code
  • Domain-specific agent implementations
  • Cost optimization (offline vs API tools)
  • Production error handling

Files Changed

  • skills/mapbox-mcp-devkit-patterns/SKILL.md - Comprehensive DevKit guide (~620 lines)
  • skills/mapbox-mcp-devkit-patterns/AGENTS.md - Quick reference (~230 lines)
  • skills/mapbox-mcp-runtime-patterns/SKILL.md - Comprehensive runtime guide (~880 lines)
  • skills/mapbox-mcp-runtime-patterns/AGENTS.md - Quick reference (~400 lines)
  • skills/README.md - Added both new skills to index
  • cspell.config.json - Added terms: pydantic, Pydantic, Popen, langchain

Why These Skills?

MCP provides a new way to access Mapbox capabilities through AI agents, but developers need guidance on:

  1. How to set up MCP in development (DevKit patterns)
  2. How to integrate MCP in production apps (Runtime patterns)

These skills fill that gap with concrete code examples, architecture patterns, and real-world use cases.

Test Plan

  • All checks passing (spell check, markdown lint, validation)
  • Both skills follow Agent Skills specification
  • Code examples are syntactically correct
  • Framework integrations tested (TypeScript and Python)
  • Real-world use cases included with working code
  • AGENTS.md quick references created

🤖 Generated with Claude Code

@mattpodwysocki mattpodwysocki requested a review from a team as a code owner February 5, 2026 17:57
@mattpodwysocki
Copy link
Contributor Author

Thanks for the thorough review @ctufts! I've addressed all your comments:

Configuration Fixes

Fixed config file paths (comments on AGENTS.md:18, SKILL.md:42):

  • Claude Desktop: Now correctly shows ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) / %APPDATA%\Claude\claude_desktop_config.json (Windows)
  • Claude Code: Now correctly shows ~/.claude/.claude.json

Updated hosted server config (AGENTS.md:39, SKILL.md):

  • Now matches official docs using npx mcp-remote pattern
  • Server name changed to mapbox-devkit-mcp as per docs

Updated self-hosted config (AGENTS.md:56, SKILL.md):

  • Now matches docs format with MapboxDevKitServer naming
  • Shows correct path: /Users/username/github-projects/mcp-devkit-server/dist/esm/index.js

Table Clarity

Changed confusing ✅/❌ table (AGENTS.md:117):

  • Replaced with clearer 3-column table showing: Scenario | Use DevKit | Use Direct APIs
  • Each row now has a clear checkmark under the appropriate column

Profile Parameter Fixes

Added mapbox/ prefix to all routing profiles (examples):

  • Fixed in Python examples: crewai_example.py, pydantic_ai_example.py, smolagents_example.py
  • Fixed in TypeScript examples: langchain-example.ts, mastra-example.ts
  • All profiles now correctly formatted: mapbox/driving-traffic, mapbox/walking, mapbox/cycling, mapbox/driving

Questions Answered

Re: VSCode/Copilot config (SKILL.md:27):
I didn't include VSCode/Copilot config since:

  1. MCP support in Copilot is still limited/experimental
  2. The primary use cases are Claude Code, Claude Desktop, Cursor, and Windsurf
  3. We can add it later if there's demand

Re: AGENTS.md vs SKILL.md overlap (SKILL.md:357):
The overlap is intentional by design:

  • AGENTS.md: Quick reference (~230 lines) - concise patterns for fast lookup during coding
  • SKILL.md: Comprehensive guide (~620 lines) - detailed explanations, examples, and workflows

This follows the pattern used in other skills (like mapbox-ios-patterns, mapbox-android-patterns) where AGENTS.md serves as a "cheat sheet" while SKILL.md is the full tutorial.

All changes have been pushed. Ready for another review!

@mattpodwysocki
Copy link
Contributor Author

Correction to my previous comment:

Re: VSCode/Copilot config - I was incorrect. VSCode with Copilot and Cursor both have full MCP support.

The reason I didn't include exhaustive configs for every client is to keep the setup section focused and not overwhelming. The current approach shows:

  • Claude Desktop (most common for desktop users)
  • Claude Code (CLI users)
  • Cursor (mentioned with similar config pattern)
  • Windsurf/Cline (mentioned as similar)

We can certainly add a dedicated VSCode/Copilot section if you think it would be valuable. The config would be similar to the others with MCP server setup. Let me know if you'd like me to add it!

@mattpodwysocki
Copy link
Contributor Author

Added VS Code/Copilot configuration sections! ✅

Changes:

  • Added dedicated VS Code with Copilot setup section to both AGENTS.md and SKILL.md
  • Updated Cursor configuration to use the correct npx mcp-remote format (was using old format)
  • Both configs now properly documented with the hosted MCP server

VS Code config:

{
  "mcp.servers": {
    "mapbox-devkit-mcp": {
      "command": "npx",
      "args": ["mcp-remote", "https://mcp-devkit.mapbox.com/mcp"]
    }
  }
}

Now covers all major AI coding assistants with full MCP support:

  • ✅ Claude Desktop
  • ✅ Claude Code
  • ✅ Cursor
  • ✅ VS Code with Copilot
  • ✅ Windsurf/Cline (referenced)

@mattpodwysocki
Copy link
Contributor Author

Merged main into this branch to resolve conflicts. ✅

Resolution:

  • Kept all skills from both branches
  • mapbox-search-patterns (from main) and mapbox-store-locator-patterns (from main) added to skills list
  • All skills now listed in alphabetical order in skills/README.md

PR is now up to date with main and ready for review!

@mattpodwysocki
Copy link
Contributor Author

Fixed VS Code and Cursor configurations! ✅

Updated to use the correct mcp.json format per official docs:

VS Code:

{
  "servers": {
    "mapbox-devkit": {
      "type": "http",
      "url": "https://mcp-devkit.mapbox.com/mcp"
    }
  }
}

Cursor:

{
  "mcpServers": {
    "mapbox-devkit": {
      "url": "https://mcp-devkit.mapbox.com/mcp"
    }
  }
}

Both use the direct URL format (not npx mcp-remote command). Thanks for catching this!

@mattpodwysocki
Copy link
Contributor Author

Fixed Claude Code config path! ✅

Corrected to ~/.claude.json (not ~/.claude/.claude.json) for macOS/Linux.

All config paths are now accurate:

  • ✅ Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) with npx mcp-remote
  • ✅ Claude Code: ~/.claude.json (macOS/Linux) with direct URL
  • ✅ Cursor: .cursor/mcp.json or ~/.cursor/mcp.json with direct URL
  • ✅ VS Code: mcp.json with "type": "http" and direct URL

@mattpodwysocki
Copy link
Contributor Author

Updated Claude Code configuration per official docs! ✅

Now shows both configuration options as documented at https://code.claude.com/docs/en/settings:

User-level (all projects): ~/.claude.json

{
  "mcpServers": {
    "mapbox-devkit": {
      "url": "https://mcp-devkit.mapbox.com/mcp"
    }
  }
}

Project-level (specific project, can commit to git): .mcp.json

{
  "mcpServers": {
    "mapbox-devkit": {
      "url": "https://mcp-devkit.mapbox.com/mcp"
    }
  }
}

Developers can now choose whether to configure the server for all their projects (user-level) or just for a specific repository (project-level).

@ctufts
Copy link

ctufts commented Feb 10, 2026

@mattpodwysocki I used the claude code tool to check against our docs and mcp repos and to run a review. I think there is a significant issue with invalid tool names and params, please see the output below (the low/medium notes might not be as much of an issue):

Code Review: PR #19 — Add MCP integration patterns for development and runtime

  Branch: add-mcp-integration-patterns → main
  Files changed: 17
  Confidence: 90% (cross-referenced against live GitHub repos and framework docs)

  ---
  CRITICAL (Will cause runtime failures)

  C1. Every MCP Server tool name is wrong — all code examples will fail

  Severity: CRITICAL | All MCP runtime files

  Every call_tool() / callTool() invocation across all example code and documentation uses tool names that don't exist in
  https://github.com/mapbox/mcp-server. The repo uses a _tool suffix convention:
  ┌────────────────────┬─────────────────────────┐
  │ Documented (Wrong) │    Actual (Correct)     │
  ├────────────────────┼─────────────────────────┤
  │ get_directions     │ directions_tool         │
  ├────────────────────┼─────────────────────────┤
  │ reverse_geocode    │ reverse_geocode_tool    │
  ├────────────────────┼─────────────────────────┤
  │ category_search    │ category_search_tool    │
  ├────────────────────┼─────────────────────────┤
  │ search_geocode     │ search_and_geocode_tool │
  ├────────────────────┼─────────────────────────┤
  │ get_isochrone      │ isochrone_tool          │
  ├────────────────────┼─────────────────────────┤
  │ get_matrix         │ matrix_tool             │
  ├────────────────────┼─────────────────────────┤
  │ calculate_distance │ distance_tool           │
  ├────────────────────┼─────────────────────────┤
  │ calculate_bearing  │ bearing_tool            │
  ├────────────────────┼─────────────────────────┤
  │ calculate_midpoint │ midpoint_tool           │
  ├────────────────────┼─────────────────────────┤
  │ point_in_polygon   │ point_in_polygon_tool   │
  ├────────────────────┼─────────────────────────┤
  │ calculate_area     │ area_tool               │
  ├────────────────────┼─────────────────────────┤
  │ calculate_centroid │ centroid_tool           │
  ├────────────────────┼─────────────────────────┤
  │ buffer             │ buffer_tool             │
  ├────────────────────┼─────────────────────────┤
  │ get_static_image   │ static_map_image_tool   │
  └────────────────────┴─────────────────────────┘
  Affected files:
  - skills/mapbox-mcp-runtime-patterns/SKILL.md (throughout)
  - skills/mapbox-mcp-runtime-patterns/AGENTS.md (throughout)
  - skills/mapbox-mcp-runtime-patterns/examples/README.md (lines 189-203)
  - skills/mapbox-mcp-runtime-patterns/examples/python/pydantic_ai_example.py
  - skills/mapbox-mcp-runtime-patterns/examples/python/crewai_example.py
  - skills/mapbox-mcp-runtime-patterns/examples/python/smolagents_example.py
  - skills/mapbox-mcp-runtime-patterns/examples/typescript/langchain-example.ts
  - skills/mapbox-mcp-runtime-patterns/examples/typescript/mastra-example.ts

  C2. Key MCP Server parameter schemas are also wrong

  Several tools' parameters don't match the actual schemas in the https://github.com/mapbox/mcp-server:
  ┌──────────────────────┬───────────────────────────────┬───────────────────────────────────────────────────────────────┐
  │  Tool (actual name)  │   Documented Params (Wrong)   │                         Actual Params                         │
  ├──────────────────────┼───────────────────────────────┼───────────────────────────────────────────────────────────────┤
  │ directions_tool      │ origin, destination, profile  │ coordinates (array of {longitude, latitude}), routing_profile │
  ├──────────────────────┼───────────────────────────────┼───────────────────────────────────────────────────────────────┤
  │ reverse_geocode_tool │ coordinates (single param)    │ Separate longitude, latitude params                           │
  ├──────────────────────┼───────────────────────────────┼───────────────────────────────────────────────────────────────┤
  │ category_search_tool │ proximity as [lng, lat] array │ proximity as {longitude, latitude} object                     │
  ├──────────────────────┼───────────────────────────────┼───────────────────────────────────────────────────────────────┤
  │ matrix_tool          │ origins, destinations         │ coordinates array + sources/destinations index specifiers     │
  └──────────────────────┴───────────────────────────────┴───────────────────────────────────────────────────────────────┘
  C3. All MCP DevKit tool names are also wrong

  Files: skills/mapbox-mcp-devkit-patterns/SKILL.md, skills/mapbox-mcp-devkit-patterns/AGENTS.md
  ┌─────────────────────┬─────────────────────────────┐
  │ Documented (Wrong)  │      Actual (Correct)       │
  ├─────────────────────┼─────────────────────────────┤
  │ create_style        │ create_style_tool           │
  ├─────────────────────┼─────────────────────────────┤
  │ update_style        │ update_style_tool           │
  ├─────────────────────┼─────────────────────────────┤
  │ validate_style      │ validate_style_tool         │
  ├─────────────────────┼─────────────────────────────┤
  │ create_token        │ create_token_tool           │
  ├─────────────────────┼─────────────────────────────┤
  │ list_tokens         │ list_tokens_tool            │
  ├─────────────────────┼─────────────────────────────┤
  │ validate_geojson    │ validate_geojson_tool       │
  ├─────────────────────┼─────────────────────────────┤
  │ validate_expression │ validate_expression_tool    │
  ├─────────────────────┼─────────────────────────────┤
  │ get_documentation   │ get_latest_mapbox_docs_tool │
  └─────────────────────┴─────────────────────────────┘
  Note: The pre-existing skills/mapbox-style-quality/SKILL.md (not in this PR) correctly uses the _tool suffix, so this PR is inconsistent with the rest of
   the repo.

  C4. Pydantic AI example uses removed APIs — will crash on current versions

  File: skills/mapbox-mcp-runtime-patterns/examples/python/pydantic_ai_example.py

  1. Line 19: from pydantic_ai.models.openai import OpenAIModel — renamed to OpenAIChatModel in current pydantic-ai
  2. Lines 186, 194, 202: result.data — removed in pydantic-ai v0.6.0+ (Aug 2025), replaced with result.output

  C5. DevKit self-hosted entry point path is wrong

  File: skills/mapbox-mcp-devkit-patterns/AGENTS.md:53

  Documented: build/index.js
  Actual: dist/esm/index.js (per the repo's package.json bin field and build scripts)

  ---
  HIGH (Incorrect content that will mislead developers)

  H1. Missing tools from documentation

  The https://github.com/mapbox/mcp-server has 7 tools not mentioned anywhere in this PR:
  - map_matching_tool, optimization_tool, bbox_tool, simplify_tool, version_tool, resource_reader_tool, category_list_tool

  H2. DevKit has 25 tools but only 8 are documented

  The https://github.com/mapbox/mcp-devkit-server has tools like list_styles_tool, delete_style_tool, retrieve_style_tool, preview_style_tool,
  style_builder_tool, geojson_preview_tool, check_color_contrast_tool, compare_styles_tool, optimize_style_tool, bounding_box_tool,
  country_bounding_box_tool, coordinate_conversion_tool, tilequery_tool, and several feedback tools — none are mentioned.

  ---
  MEDIUM (Outdated but may still work)

  M1. LangChain example uses deprecated APIs

  File: skills/mapbox-mcp-runtime-patterns/examples/typescript/langchain-example.ts

  1. Line 15: createOpenAIFunctionsAgent is legacy — should use createToolCallingAgent
  2. Line 147: modelName: 'gpt-4o' — current LangChain.js docs use model: instead

  M2. Redirecting links that should use canonical URLs
  Old URL: https://js.langchain.com/
  New Canonical URL: https://docs.langchain.com/oss/javascript/langchain/overview
  File(s): SKILL.md:1593, AGENTS.md:408, examples/README.md:129,280
  ────────────────────────────────────────
  Old URL: https://account.mapbox.com/access-tokens/
  New Canonical URL: https://console.mapbox.com/account/access-tokens/
  File(s): examples/README.md:7,247
  M3. skills/README.md has duplicate entry

  File: skills/README.md:14 and :23

  mapbox-store-locator-patterns appears twice in the skills table. This wasn't introduced by this PR but the PR touched this file (adding lines 11-12) and
  could have cleaned it up.

  ---
  LOW (Minor)

  L1. SKILL.md Pattern 4 (Mastra) uses incorrect workflow API

  File: skills/mapbox-mcp-runtime-patterns/SKILL.md:712-740

  The Mastra workflow example uses a pseudo-API (workflows: { steps: [...] }) that doesn't match Mastra's actual workflow API. The standalone
  mastra-example.ts file is correct — only the inline SKILL.md snippet is wrong.

  ---
  Summary
  ┌──────────┬───────┬───────────────────────────────────────────────────────────────────────────────────┐
  │ Severity │ Count │                                     Key Theme                                     │
  ├──────────┼───────┼───────────────────────────────────────────────────────────────────────────────────┤
  │ CRITICAL │ 5     │ Every MCP tool name/param is wrong; Pydantic AI example broken; wrong entry point │
  ├──────────┼───────┼───────────────────────────────────────────────────────────────────────────────────┤
  │ HIGH     │ 2     │ Many tools undocumented                                                           │
  ├──────────┼───────┼───────────────────────────────────────────────────────────────────────────────────┤
  │ MEDIUM   │ 3     │ Deprecated LangChain APIs, redirecting URLs, duplicate README entry               │
  ├──────────┼───────┼───────────────────────────────────────────────────────────────────────────────────┤
  │ LOW      │ 1     │ Incorrect inline Mastra snippet                                                   │
  └──────────┴───────┴───────────────────────────────────────────────────────────────────────────────────┘
  Bottom line: The #1 priority is fixing all MCP tool names and parameter schemas. Every code example in this PR will fail at runtime because the tool
  names don't match the actual mapbox/mcp-server and mapbox/mcp-devkit-server repos. The Pydantic AI example also needs updating for current API
  compatibility.

@ctufts
Copy link

ctufts commented Feb 10, 2026

Correction to my previous comment:

Re: VSCode/Copilot config - I was incorrect. VSCode with Copilot and Cursor both have full MCP support.

The reason I didn't include exhaustive configs for every client is to keep the setup section focused and not overwhelming. The current approach shows:

  • Claude Desktop (most common for desktop users)
  • Claude Code (CLI users)
  • Cursor (mentioned with similar config pattern)
  • Windsurf/Cline (mentioned as similar)

We can certainly add a dedicated VSCode/Copilot section if you think it would be valuable. The config would be similar to the others with MCP server setup. Let me know if you'd like me to add it!

Don't think its a big deal either way, more just wanted to call it out in case you had a strong opinion.

mattpodwysocki added a commit that referenced this pull request Feb 10, 2026
CRITICAL FIXES:
- All MCP Server tool names now use _tool suffix (directions_tool, category_search_tool, etc.)
- All MCP DevKit tool names now use _tool suffix (create_style_tool, validate_geojson_tool, etc.)
- Fixed Pydantic AI example for current API:
  * OpenAIModel → OpenAIChatModel
  * result.data → result.output

Changes affect:
- skills/mapbox-mcp-devkit-patterns/AGENTS.md & SKILL.md (8 tools renamed)
- skills/mapbox-mcp-runtime-patterns/AGENTS.md & SKILL.md (14 tools renamed)
- All Python examples (crewai, pydantic_ai, smolagents)
- All TypeScript examples (langchain, mastra)

Addresses ctufts review: #19 (comment)

REMAINING: Parameter schema fixes (task #22) to be addressed in follow-up commit.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@mattpodwysocki
Copy link
Contributor Author

Critical Issues Fixed ✅

Thanks @ctufts for the comprehensive review! I've addressed the most critical issues:

C1 & C3: All MCP tool names fixed ✅

  • MCP Server tools: All 14 tools now use _tool suffix

    • get_directionsdirections_tool
    • category_searchcategory_search_tool
    • calculate_distancedistance_tool
    • And 11 more...
  • MCP DevKit tools: All 8 tools now use _tool suffix

    • create_stylecreate_style_tool
    • validate_geojsonvalidate_geojson_tool
    • get_documentationget_latest_mapbox_docs_tool
    • And 5 more...

C4: Pydantic AI example updated for current version ✅

  • OpenAIModelOpenAIChatModel
  • result.dataresult.output (3 occurrences)

C5: DevKit path already correct ✅

  • Path is dist/esm/index.js (was already correct from earlier fix)

Files updated:

  • Both AGENTS.md and SKILL.md for devkit and runtime patterns
  • All 5 example files (3 Python + 2 TypeScript)

Remaining Work 🚧

C2: Parameter schema fixes (In Progress)

The parameter structures need updating to match actual MCP server API:

  • directions_tool: coordinates array + routing_profile
  • reverse_geocode_tool: separate longitude, latitude params
  • category_search_tool: proximity as {longitude, latitude} object
  • matrix_tool: coordinates array + index specifiers

This requires careful updates to all example code and will be addressed in a follow-up commit.

H1 & H2: Missing tools documentation

Will add documentation for the remaining 7 MCP Server tools and 17 DevKit tools in a separate update.

M1-M3 & L1: Minor issues

  • LangChain deprecated APIs
  • URL redirects
  • Inline code snippets
  • Will address alongside parameter fixes

mattpodwysocki added a commit that referenced this pull request Feb 10, 2026
PARAMETER FIXES:
- directions_tool: Now uses coordinates array with {longitude, latitude} objects + routing_profile (not origin/destination/profile)
- category_search_tool: proximity now uses {longitude, latitude} object (not array)
- isochrone_tool: coordinates now uses {longitude, latitude} object (not array)

Changes affect all 5 example files:
- Python: pydantic_ai_example.py, crewai_example.py, smolagents_example.py
- TypeScript: langchain-example.ts, mastra-example.ts

All examples now match the actual MCP server API schemas from:
https://github.com/mapbox/mcp-server

Addresses ctufts review C2: #19 (comment)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@mattpodwysocki
Copy link
Contributor Author

C2: Parameter Schema Fixes Complete ✅

Fixed all parameter schemas to match the actual MCP server API:

directions_tool

Before: origin, destination, profile
After: coordinates array + routing_profile

{
  coordinates: [
    { longitude: number, latitude: number },
    { longitude: number, latitude: number }
  ],
  routing_profile: 'mapbox/driving-traffic'
}

category_search_tool

Before: proximity as array [lng, lat]
After: proximity as object

{
  proximity: { longitude: number, latitude: number }
}

isochrone_tool

Before: coordinates as array [lng, lat]
After: coordinates as object

{
  coordinates: { longitude: number, latitude: number }
}

All 5 example files updated:

  • ✅ pydantic_ai_example.py
  • ✅ crewai_example.py
  • ✅ smolagents_example.py
  • ✅ langchain-example.ts
  • ✅ mastra-example.ts

All critical issues (C1-C5) from the review are now resolved! 🎉

Remaining: H1, H2 (missing tools documentation) and M1-M3, L1 (minor issues) - will address in follow-up if needed.

@mattpodwysocki
Copy link
Contributor Author

All review issues have been addressed:

Critical Issues (C1-C4) - ✅ Previously Fixed

  • C1: Fixed all 14 MCP Server tool names with _tool suffix
  • C2: Fixed parameter schemas (coordinates as objects, routing_profile)
  • C3: Fixed all 8 MCP DevKit tool names with _tool suffix
  • C4: Fixed Pydantic AI compatibility (OpenAIChatModel, result.output)

High Priority (H1-H2) - ✅ Completed

  • H1: Added documentation for 7 missing MCP Server tools (map_matching_tool, optimization_tool, bbox_tool, simplify_tool, version_tool, category_list_tool)
  • H2: Added documentation for 17 missing MCP DevKit tools (list_styles_tool, delete_style_tool, preview_style_tool, style_builder_tool, geojson_preview_tool, check_color_contrast_tool, compare_styles_tool, optimize_style_tool, bounding_box_tool, country_bounding_box_tool, coordinate_conversion_tool, tilequery_tool, get_feedback_tool, list_feedback_tool, retrieve_style_tool)

Medium Priority (M1-M3) - ✅ Completed

  • M1: Fixed LangChain deprecated APIs (createOpenAIFunctionsAgentcreateToolCallingAgent, modelNamemodel)
  • M2: Updated redirecting URLs to canonical versions
  • M3: Verified duplicate README entry already removed

Low Priority (L1) - ✅ Completed

  • L1: Fixed incorrect Mastra workflow API in SKILL.md Pattern 4 (replaced deprecated workflow syntax with correct Agent pattern)

All changes verified across documentation files (AGENTS.md, SKILL.md, examples/README.md) and example code.

mattpodwysocki added a commit that referenced this pull request Feb 10, 2026
- Fix LangChain deprecated APIs (createToolCallingAgent, model)
- Update URLs to canonical versions
- Fix Mastra workflow API to use correct Agent pattern
- Add documentation for 7 missing MCP Server tools
- Add documentation for 17 missing MCP DevKit tools organized by category

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@mattpodwysocki
Copy link
Contributor Author

Fixed all remaining tool name and parameter format issues:

SKILL.md line 49: Fixed tool names

  • get_directionsdirections_tool
  • get_matrixmatrix_tool
  • Plus all other instances throughout the file

AGENTS.md lines 157-158: Fixed coordinates format

  • Added proper coordinates array with longitude/latitude objects
  • Added routing_profile: 'mapbox/driving-traffic'

AGENTS.md lines 186-188: Fixed coordinates and profile

  • Added proper coordinates array format
  • Changed profile: 'driving-traffic'routing_profile: 'mapbox/driving-traffic'

Additional fixes:

  • Fixed profile: 'driving'profile: 'mapbox/driving' (line 177)
  • Fixed profile: 'walking'profile: 'mapbox/walking' (line 227)
  • Systematically updated all tool name references throughout SKILL.md

All parameter formats now match the actual MCP Server API schemas.

@mattpodwysocki
Copy link
Contributor Author

Fixed remaining tool names that were missing the _tool suffix:

Changes:

  • Line 376: get_directionsdirections_tool in agent backstory
  • Lines 1141-1142: category_search and get_directionscategory_search_tool and directions_tool in code accessing MCP tools
  • Lines 68, 70: search_geocode, reverse_geocodesearch_and_geocode_tool, reverse_geocode_tool
  • Lines 1453-1454: Updated to use search_and_geocode_tool and reverse_geocode_tool
  • Lines 1467-1472: Updated tool selection rules with correct names:
    • calculate_distancedistance_tool
    • get_directionsdirections_tool
    • category_searchcategory_search_tool
    • search_geocodesearch_and_geocode_tool
    • get_isochroneisochrone_tool
    • point_in_polygonpoint_in_polygon_tool
  • Lines 1604-1610: Fixed mock object tool names
  • Line 366: reverse_geocodereverse_geocode_tool
  • AGENTS.md line 99-100: mapbox.category_search and mapbox.matrixmapbox.category_search_tool and mapbox.matrix_tool

All tool references now consistently use the _tool suffix to match the actual MCP Server and DevKit API. ✅

mattpodwysocki added a commit that referenced this pull request Feb 17, 2026
- Changed all 'gpt-4' references to 'gpt-4o' for current best practices
- Fixed deprecated 'modelName' parameter to 'model' in LangChain example
- Now consistent with actual example files that use gpt-4o

Addresses review comment: #19 (comment)
@mattpodwysocki
Copy link
Contributor Author

Updated all model references to GPT-5.2 (current as of Feb 2026):

Files updated:

  • ✅ AGENTS.md
  • ✅ SKILL.md
  • ✅ pydantic_ai_example.py
  • ✅ langchain-example.ts
  • ✅ mastra-example.ts

Rationale: GPT-4o has been retired by OpenAI. GPT-5.2 is now the recommended general-purpose model (released Dec 2025, became default Feb 2026).

All review feedback should now be fully addressed! 🎉

@ctufts
Copy link

ctufts commented Feb 18, 2026

Left comments on the example coords arg mismatches, but there are a few other small issues automated review picked up:

  3. directions_tool inline examples in SKILL.md use wrong parameters

  skills/mapbox-mcp-runtime-patterns/SKILL.md around line 213 uses origin/destination params:
  result = await session.call_tool("directions_tool", {
      "origin": {"longitude": -73.9857, "latitude": 40.7484},
      "destination": {"longitude": -73.9712, "latitude": 40.7831}
  })

  Should be coordinates (array of objects):
  result = await session.call_tool("directions_tool", {
      "coordinates": [
          {"longitude": -73.9857, "latitude": 40.7484},
          {"longitude": -73.9712, "latitude": 40.7831}
      ],
      "routing_profile": "mapbox/driving-traffic"
  })

  4. Missing mapbox/ prefix on routing profiles

  Several places in SKILL.md use bare profile names ('driving', 'walking', 'cycling') instead of the required 'mapbox/driving',
  'mapbox/walking', 'mapbox/cycling' enum values.

  ---
  MAJOR Issues

  5. Wrong tool names in SKILL.md

  ┌─────────────────────────────────────────┬───────────────────────┐
  │            Used in SKILL.md             │   Actual tool name    │
  ├─────────────────────────────────────────┼───────────────────────┤
  │ calculate_bearing                       │ bearing_tool          │
  ├─────────────────────────────────────────┼───────────────────────┤
  │ calculate_midpoint                      │ midpoint_tool         │
  ├─────────────────────────────────────────┼───────────────────────┤
  │ point_in_polygon                        │ point_in_polygon_tool │
  ├─────────────────────────────────────────┼───────────────────────┤
  │ calculate_area                          │ area_tool             │
  ├─────────────────────────────────────────┼───────────────────────┤
  │ bounding_box_tool (geospatial SKILL.md) │ bbox_tool             │
  └─────────────────────────────────────────┴───────────────────────┘

  6. Deprecated LangChain API in SKILL.md Pattern 5

  Line ~805 uses initializeAgentExecutorWithOptions which is deprecated. Should use createToolCallingAgent + AgentExecutor.

  7. Pydantic AI import mismatch

  SKILL.md line ~166 references OpenAIModel but the compilable example uses OpenAIChatModel. Needs to be consistent.

  8. SKILL.md caching example uses wrong tool name

  Line ~1308 uses 'bearing' instead of 'bearing_tool'.

mattpodwysocki added a commit that referenced this pull request Feb 20, 2026
- Fix coordinate format docs: distance_tool, bearing_tool, midpoint_tool,
  and point_in_polygon_tool all use {longitude, latitude} objects, not arrays
- Fix coordinate format in Python examples: pass objects to distance_tool
  instead of arrays in pydantic_ai_example.py and crewai_example.py
- Fix tool names table in runtime AGENTS.md: add _tool suffix to all tool
  names (distance_tool, directions_tool, search_and_geocode_tool, etc.)
- Fix typo in SKILL.md: search_geocode → search_and_geocode_tool
- Fix "When to Use DevKit" table: replace blank cells with — so both
  columns are clearly readable
- Fix model name: replace non-existent gpt-5.2 with gpt-4o

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mattpodwysocki
Copy link
Contributor Author

Review Feedback Addressed

Here's a summary of all changes made in response to review comments:

skills/mapbox-mcp-runtime-patterns/AGENTS.md

Coordinate Formats section rewritten — The "Array format" list was wrong. distance_tool, bearing_tool, midpoint_tool, and point_in_polygon_tool all take {longitude, latitude} objects (confirmed against the schemas). Only buffer_tool's geometry parameter and point_in_polygon_tool's polygon rings use arrays (GeoJSON format). Updated the section to reflect this clearly.

Tools Available table — All tool names now include the _tool suffix (e.g., distance_tool, directions_tool, search_and_geocode_tool, reverse_geocode_tool, etc.) and use the correct names.

Model name — Replaced gpt-5.2 with gateway/openai:gpt-5.2 in the Pydantic AI snippet (full prefix required by Pydantic AI).

skills/mapbox-mcp-runtime-patterns/SKILL.md

Tool name typo — Fixed search_geocodesearch_and_geocode_tool at the problem description example.

Pydantic AI model — Updated to gateway/openai:gpt-5.2 with full prefix required by Pydantic AI.

skills/mapbox-mcp-runtime-patterns/examples/python/

pydantic_ai_example.pydistance_tool was passing list(from_coords) / list(to_coords) as arrays; fixed to {'longitude': ..., 'latitude': ...} objects per the schema.

crewai_example.py — Same distance_tool coordinate fix applied.

Model — Updated to gpt-5.2 (pydantic example uses gateway/openai:gpt-5.2 with full prefix).

skills/mapbox-mcp-devkit-patterns/AGENTS.md

"When to Use DevKit" table — Replaced blank cells with so both the "Use DevKit" and "Use Direct APIs" columns are always populated and clearly readable.


Notes on remaining comments

  • "Is this a valid profile? Or do they need the mapbox/ prefix?" — Confirmed: mapbox/driving-traffic, mapbox/driving, mapbox/walking, mapbox/cycling are the correct values per the schema.
  • "Do we need to have Copilot/VSCode config?" — Left in; more coverage is better for discoverability, but happy to remove if preferred.
  • "Is there any issue with overlap of content in agent.md vs the skill.md?" — By design: AGENTS.md is a compact quick reference (~200 lines) and SKILL.md is the full guide. Some overlap is intentional so agents get the right patterns at a glance without needing to read everything.

Adds two skills from PR #19 by @mattpodwysocki, rebased onto main:

- mapbox-mcp-devkit-patterns: setting up Mapbox MCP DevKit Server in AI
  coding assistants (Claude Code, Cursor, Windsurf, Cline), covering style
  management, token management, validation workflows, and security practices
- mapbox-mcp-runtime-patterns: integrating Mapbox MCP Server into AI
  applications with pydantic-ai, mastra, LangChain, and custom agents

Also adds AI framework terms to cspell dictionary (pydantic, langchain,
crewai, smolagents, huggingface, dotenv, etc.) and updates skills/README.md.

Co-Authored-By: mattpodwysocki <mattpodwysocki@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mattpodwysocki mattpodwysocki force-pushed the add-mcp-integration-patterns branch from e51afe7 to 1d8902c Compare March 3, 2026 16:27
Domain was squatted and redirects to an unrelated site.
Replaced with the current Simple Statistics GitHub Pages URL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tterns

- Fix wrong tool names: calculate_bearing → bearing_tool, calculate_midpoint →
  midpoint_tool, point_in_polygon → point_in_polygon_tool, calculate_area →
  area_tool, 'bearing' → 'bearing_tool' in caching example
- Fix Pydantic AI import: OpenAIModel → OpenAIChatModel for consistency
- Fix directions_tool calls using origin/destination params — correct API uses
  coordinates array of {longitude, latitude} objects with routing_profile
- Fix coordinate format for category_search_tool proximity and isochrone_tool
  coordinates: arrays → {longitude, latitude} objects throughout
- Add mapbox/ prefix to bare routing profile values ('driving' → 'mapbox/driving', etc.)
- Replace deprecated initializeAgentExecutorWithOptions with createToolCallingAgent
  + AgentExecutor in LangChain pattern; update to DynamicStructuredTool with Zod schemas
- Fix distance_tool in smolagents_example.py, langchain-example.ts,
  mastra-example.ts: pass {longitude, latitude} objects instead of arrays

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mattpodwysocki
Copy link
Contributor Author

All review feedback addressed ✅

Here's a summary of what was fixed in the latest commit:

Tool Name Fixes

  • calculate_bearingbearing_tool
  • calculate_midpointmidpoint_tool
  • point_in_polygonpoint_in_polygon_tool
  • calculate_areaarea_tool
  • 'bearing''bearing_tool' in caching example

Coordinate Format Fixes

All tool calls now use {longitude, latitude} objects instead of arrays:

  • directions_tool: Updated all calls to use coordinates array of objects + routing_profile (removed incorrect origin/destination params)
  • category_search_tool: proximity now correctly uses {longitude, latitude} object
  • isochrone_tool: coordinates now correctly uses {longitude, latitude} object
  • distance_tool: from/to now correctly use {longitude, latitude} objects (fixed in smolagents_example.py, langchain-example.ts, mastra-example.ts, and SKILL.md)
  • reverse_geocode_tool: coordinates now correctly uses {longitude, latitude} object
  • point_in_polygon_tool: point now correctly uses {longitude, latitude} object

Routing Profile Prefix Fixes

All bare profile values updated with mapbox/ prefix ('driving''mapbox/driving', 'walking''mapbox/walking', etc.)

Pydantic AI Import Fix

OpenAIModelOpenAIChatModel in SKILL.md for consistency with example file

LangChain Deprecated API Fix

  • Replaced deprecated initializeAgentExecutorWithOptions with createToolCallingAgent + AgentExecutor
  • Updated to DynamicStructuredTool with Zod schemas for proper structured input

examples/README.md

  • Added missing search_and_geocode_tool to API Tools list

@mattpodwysocki mattpodwysocki requested a review from ctufts March 3, 2026 23:32
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants