-
Notifications
You must be signed in to change notification settings - Fork 29
Add metadata field to SearchAndGeocodeTool schema #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The Mapbox Search Box API can return metadata (including primary_photo and Japanese reading information) for various feature types in forward geocoding results. Currently, SearchAndGeocodeTool.output.schema.ts doesn't include a metadata field, which could lead to validation errors when the API returns this data. This fix adds the metadata field with the same structure used in CategorySearchTool (fixed in PR #77): - primary_photo: Accepts both string and array of strings - reading: Optional Japanese reading information (ja_kana, ja_latin) This prevents validation failures when the API returns metadata fields. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Valiunia
approved these changes
Jan 5, 2026
mattpodwysocki
added a commit
that referenced
this pull request
Jan 5, 2026
This commit resolves critical installation failures that prevented users from running the package via `npx @mapbox/mcp-server`. ## Issues Fixed When users ran `npx @mapbox/mcp-server`, they encountered: ``` sh: mcp-server: command not found ``` This was caused by multiple installation script failures that prevented npm from properly setting up the binary. ## Changes ### 1. Fixed patch-package Dependency Issue **Problem:** The postinstall script runs patch-package, but it was only in devDependencies. End users don't get dev dependencies, causing postinstall to fail. **Solution:** - Moved patch-package from devDependencies to dependencies - Added patches/ directory to files array in package.json - Ensures patches are included in published package ### 2. Updated MCP SDK and Regenerated Patches **Problem:** Patch was for @modelcontextprotocol/[email protected], but the ^ version allowed 1.25.1 to be installed, causing patch failures. **Solution:** - Updated SDK dependency to ^1.25.1 - Regenerated patches for new SDK version - Removed old 1.21.1 patch file - Updated src/tools/BaseTool.ts with type annotations required by new SDK ### 3. Fixed prepare Script for End Users **Problem:** The prepare script checked for .git directory, but when users installed the package in THEIR git repo, it found their .git and tried to run husky (which wasn't installed), causing failures. **Solution:** Changed check from .git to .husky/setup-hooks.js: ```javascript // Before: Checks .git (exists in any git repo) "prepare": "... require('fs').accessSync('.git') ..." // After: Checks for actual setup file (only in dev environment) "prepare": "... require('fs').accessSync('.husky/setup-hooks.js') ..." ``` This ensures prepare only runs in the development environment of this package, not when installed as a dependency. ## Testing Verified the package works correctly: ```bash # Clean install test cd /tmp npx --yes "@mapbox/[email protected]" # ✅ Server starts successfully ``` Integration tests confirm: - ✅ All dependencies install correctly - ✅ MCP SDK patches apply successfully - ✅ mcp-server binary created and executable - ✅ Server runs without errors - ✅ All tools (SearchAndGeocode, CategorySearch, ReverseGeocode) working - ✅ Schema validation working with metadata fields (PR #86) - ✅ Non-fatal validation working (PR #73) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
mattpodwysocki
added a commit
that referenced
this pull request
Jan 5, 2026
This commit resolves critical installation failures that prevented users from running the package via `npx @mapbox/mcp-server`. When users ran `npx @mapbox/mcp-server`, they encountered: ``` sh: mcp-server: command not found ``` This was caused by multiple installation script failures that prevented npm from properly setting up the binary. **Problem:** The postinstall script runs patch-package, but it was only in devDependencies. End users don't get dev dependencies, causing postinstall to fail. **Solution:** - Moved patch-package from devDependencies to dependencies - Added patches/ directory to files array in package.json - Ensures patches are included in published package **Problem:** Patch was for @modelcontextprotocol/[email protected], but the ^ version allowed 1.25.1 to be installed, causing patch failures. **Solution:** - Updated SDK dependency to ^1.25.1 - Regenerated patches for new SDK version - Removed old 1.21.1 patch file - Updated src/tools/BaseTool.ts with type annotations required by new SDK **Problem:** The prepare script checked for .git directory, but when users installed the package in THEIR git repo, it found their .git and tried to run husky (which wasn't installed), causing failures. **Solution:** Changed check from .git to .husky/setup-hooks.js: ```javascript // Before: Checks .git (exists in any git repo) "prepare": "... require('fs').accessSync('.git') ..." // After: Checks for actual setup file (only in dev environment) "prepare": "... require('fs').accessSync('.husky/setup-hooks.js') ..." ``` This ensures prepare only runs in the development environment of this package, not when installed as a dependency. Verified the package works correctly: ```bash cd /tmp npx --yes "@mapbox/[email protected]" ``` Integration tests confirm: - ✅ All dependencies install correctly - ✅ MCP SDK patches apply successfully - ✅ mcp-server binary created and executable - ✅ Server runs without errors - ✅ All tools (SearchAndGeocode, CategorySearch, ReverseGeocode) working - ✅ Schema validation working with metadata fields (PR #86) - ✅ Non-fatal validation working (PR #73) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
mattpodwysocki
added a commit
that referenced
this pull request
Jan 5, 2026
This commit resolves critical installation failures that prevented users from running the package via `npx @mapbox/mcp-server`. When users ran `npx @mapbox/mcp-server`, they encountered: ``` sh: mcp-server: command not found ``` This was caused by multiple installation script failures that prevented npm from properly setting up the binary. **Problem:** The postinstall script runs patch-package, but it was only in devDependencies. End users don't get dev dependencies, causing postinstall to fail. **Solution:** - Moved patch-package from devDependencies to dependencies - Removed duplicate patch-package entry in devDependencies (caused by rebase) - Added patches/ directory to files array in package.json - Ensures patches are included in published package **Problem:** Patch was for @modelcontextprotocol/[email protected], but the ^ version allowed 1.25.1 to be installed, causing patch failures. **Solution:** - Updated SDK dependency to ^1.25.1 - Regenerated patches for new SDK version - Removed old 1.21.1 patch file - Updated src/tools/BaseTool.ts with type annotations required by new SDK **Problem:** The prepare script checked for .git directory, but when users installed the package in THEIR git repo, it found their .git and tried to run husky (which wasn't installed), causing failures. **Solution:** Changed check from .git to .husky/setup-hooks.js: ```javascript // Before: Checks .git (exists in any git repo) "prepare": "... require('fs').accessSync('.git') ..." // After: Checks for actual setup file (only in dev environment) "prepare": "... require('fs').accessSync('.husky/setup-hooks.js') ..." ``` This ensures prepare only runs in the development environment of this package, not when installed as a dependency. **Problem:** TypeScript "Type instantiation is excessively deep" errors after rebasing onto PR #73 with SDK 1.25.1. **Solution:** Added type assertions (`as any`) to break complex type inference chains in: - src/tools/BaseTool.ts (registerTool call) - src/index.ts (setRequestHandler call) These assertions are necessary workarounds for TypeScript's limitations with deeply nested generic types in the MCP SDK. Verified the package works correctly: ```bash cd /tmp npx --yes "@mapbox/[email protected]" ``` Integration tests confirm: - ✅ All dependencies install correctly - ✅ MCP SDK patches apply successfully - ✅ mcp-server binary created and executable - ✅ Server runs without errors - ✅ All tools (SearchAndGeocode, CategorySearch, ReverseGeocode) working - ✅ Schema validation working with metadata fields (PR #86) - ✅ Non-fatal validation working (PR #73) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
mattpodwysocki
added a commit
that referenced
this pull request
Jan 5, 2026
This commit resolves critical installation failures that prevented users from running the package via `npx @mapbox/mcp-server`. When users ran `npx @mapbox/mcp-server`, they encountered: ``` sh: mcp-server: command not found ``` This was caused by multiple installation script failures that prevented npm from properly setting up the binary. **Problem:** The postinstall script runs patch-package, but it was only in devDependencies. End users don't get dev dependencies, causing postinstall to fail. **Solution:** - Moved patch-package from devDependencies to dependencies - Removed duplicate patch-package entry in devDependencies (caused by rebase) - Added patches/ directory to files array in package.json - Ensures patches are included in published package **Problem:** Patch was for @modelcontextprotocol/[email protected], but the ^ version allowed 1.25.1 to be installed, causing patch failures. **Solution:** - Updated SDK dependency to ^1.25.1 - Regenerated patches for new SDK version - Removed old 1.21.1 patch file - Updated src/tools/BaseTool.ts with type annotations required by new SDK **Problem:** The prepare script checked for .git directory, but when users installed the package in THEIR git repo, it found their .git and tried to run husky (which wasn't installed), causing failures. **Solution:** Changed check from .git to .husky/setup-hooks.js: ```javascript // Before: Checks .git (exists in any git repo) "prepare": "... require('fs').accessSync('.git') ..." // After: Checks for actual setup file (only in dev environment) "prepare": "... require('fs').accessSync('.husky/setup-hooks.js') ..." ``` This ensures prepare only runs in the development environment of this package, not when installed as a dependency. **Problem:** TypeScript "Type instantiation is excessively deep" errors after rebasing onto PR #73 with SDK 1.25.1. **Solution:** Added type assertions (`as any`) to break complex type inference chains in: - src/tools/BaseTool.ts (registerTool call) - src/index.ts (setRequestHandler call) These assertions are necessary workarounds for TypeScript's limitations with deeply nested generic types in the MCP SDK. Verified the package works correctly: ```bash cd /tmp npx --yes "@mapbox/[email protected]" ``` Integration tests confirm: - ✅ All dependencies install correctly - ✅ MCP SDK patches apply successfully - ✅ mcp-server binary created and executable - ✅ Server runs without errors - ✅ All tools (SearchAndGeocode, CategorySearch, ReverseGeocode) working - ✅ Schema validation working with metadata fields (PR #86) - ✅ Non-fatal validation working (PR #73) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The Mapbox Search Box API can return
metadatafields (includingprimary_photoand Japanese reading information) for various feature types in forward geocoding results. Currently,SearchAndGeocodeTool.output.schema.tsdoesn't include ametadatafield, which could lead to validation errors when the API returns this data.Solution
Added the
metadatafield toSearchBoxFeaturePropertiesSchemawith the same structure used inCategorySearchTool(fixed in PR #77):This prevents validation failures when the Mapbox API returns metadata for POIs and other features.
Testing
primary_photoRelated
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 [email protected]