-
Notifications
You must be signed in to change notification settings - Fork 31
Add explicit subpath exports (alternative to #110) #111
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
Open
mattpodwysocki
wants to merge
9
commits into
main
Choose a base branch
from
feature/explicit-subpath-exports
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
Implements MCP server icons at the correct architectural level (server initialization) instead of at the tool level. Adds both light and dark theme variants of the Mapbox logo using base64-encoded SVG data URIs. - Add mapbox-logo-black.svg for light theme backgrounds - Add mapbox-logo-white.svg for dark theme backgrounds - Update server initialization to include icons array with theme property - Use 800x180 SVG logos embedded as base64 data URIs This replaces the previous incorrect approach of adding icons to individual tools, which was not aligned with the MCP specification. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Updates the MCP SDK from 1.25.1 to 1.25.2 and recreates the output validation patch for the new version. The patch continues to convert strict output schema validation errors to warnings, allowing tools to gracefully handle schema mismatches. Changes: - Update @modelcontextprotocol/sdk from ^1.25.1 to ^1.25.2 - Recreate SDK patch for version 1.25.2 - Remove obsolete 1.25.1 patch file - All 397 tests pass with new SDK version Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This PR provides an alternative to #110's wildcard export approach by implementing explicit, well-documented subpath exports that give users direct access to Mapbox MCP components. ## Changes ### Package Exports (via tshy) - `@mapbox/mcp-server/tools` - Tool classes and pre-configured instances - `@mapbox/mcp-server/resources` - Resource classes and instances - `@mapbox/mcp-server/prompts` - Prompt classes and instances - `@mapbox/mcp-server/utils` - HTTP pipeline utilities All exports support both ESM and CommonJS via tshy dual builds. ### New Files - `src/tools/index.ts` - Barrel export for tools with clean instance names - `src/resources/index.ts` - Barrel export for resources - `src/prompts/index.ts` - Barrel export for prompts - `src/utils/index.ts` - Barrel export for HTTP utilities - `docs/importing-tools.md` - Comprehensive usage guide - `examples/import-example.ts` - Working code examples - `test/exports.test.ts` - Test suite validating all exports - `tsconfig.examples.json` - TypeScript config for examples ### Updated Files - `package.json` - Added tshy exports config, updated lint/format scripts - `tsconfig.json` - Added examples reference - `README.md` - Added link to importing guide - `CLAUDE.md` - Documented package exports ### Usage Examples Simple - pre-configured instances: ```typescript import { directions, searchAndGeocode } from '@mapbox/mcp-server/tools'; ``` Advanced - custom tool instances: ```typescript import { DirectionsTool } from '@mapbox/mcp-server/tools'; import { httpRequest } from '@mapbox/mcp-server/utils'; const tool = new DirectionsTool({ httpRequest }); ``` Expert - custom HTTP pipeline: ```typescript import { HttpPipeline, UserAgentPolicy } from '@mapbox/mcp-server/utils'; const pipeline = new HttpPipeline(); pipeline.usePolicy(new UserAgentPolicy('MyApp/1.0')); ``` ## Benefits Over Wildcard Approach 1. **Explicit API surface** - Only exports intended public APIs 2. **Better discoverability** - Clear, documented entry points 3. **Type safety** - Full TypeScript support for all exports 4. **Tree-shaking friendly** - Bundlers can optimize better 5. **Future-proof** - Easy to evolve without breaking changes ## Testing - All 611 existing tests pass - New test suite validates all subpath exports - Examples included in lint/format/type checking - Documentation with working examples Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
87b9488 to
9b5e832
Compare
ctufts
previously approved these changes
Feb 9, 2026
Resolved conflicts by combining: - examples paths in format/lint/spellcheck scripts (from feature branch) - changelog:prepare-release script (from main)
ctufts
approved these changes
Feb 9, 2026
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.
Summary
This PR provides a better alternative to #110's wildcard export approach. Instead of
"./*": "./*"which exposes the entire internal structure, this implements explicit, well-documented subpath exports.Motivation
Addresses the need from #110 where users want to import parts of this package without the entire server. The wildcard approach in #110 has several drawbacks:
Solution
Explicit subpath exports via tshy:
@mapbox/mcp-server/tools- Tool classes and pre-configured instances@mapbox/mcp-server/resources- Resource classes and instances@mapbox/mcp-server/prompts- Prompt classes and instances@mapbox/mcp-server/utils- HTTP pipeline utilitiesAll exports support both ESM and CommonJS automatically via tshy dual builds.
Usage Examples
Simple: Pre-configured instances
Advanced: Custom HTTP pipeline
Expert: Full customization
Changes
New Files
src/{tools,resources,prompts,utils}/index.ts) - Clean public APIsdocs/importing-tools.md) - Comprehensive usage guide with examplesexamples/import-example.ts) - Working code demonstrating all patternstest/exports.test.ts) - Validates all subpath exports work correctlytsconfig.examples.json) - Type checking for examplesUpdated Files
package.json- Added tshy exports config, updated lint/format scripts to include examplesREADME.md- Added link to importing guideCLAUDE.md- Documented package exportsBenefits Over Wildcard Approach
directionsinstead ofdirectionsTool)Testing
test/exports.test.ts) validates all subpath exportsDocumentation
Comprehensive documentation added in
docs/importing-tools.mdcovering:Compatibility
Related
Closes #110 (provides better alternative to wildcard exports)
@vincent-lecrubier-skydio This provides what you need from #110 but with a cleaner, more maintainable approach. You can now import just the tools you need:
Let me know if this works for your use case!