Add explicit subpath exports for tools, resources, prompts, and utils#66
Merged
mattpodwysocki merged 2 commits intoadd-mcp-apps-supportfrom Feb 9, 2026
Merged
Conversation
Implements explicit, well-documented subpath exports similar to mcp-server
to allow users to import specific components without the full server.
## Changes
### Package Exports (via tshy)
- `@mapbox/mcp-devkit-server/tools` - Tool classes and pre-configured instances
- `@mapbox/mcp-devkit-server/resources` - Resource classes and instances
- `@mapbox/mcp-devkit-server/prompts` - Prompt classes and instances
- `@mapbox/mcp-devkit-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 25 devkit tools
- `src/resources/index.ts` - Barrel export for 8 resources
- `src/prompts/index.ts` - Barrel export for 7 prompts
- `src/utils/index.ts` - Barrel export for HTTP utilities
### Updated Files
- `package.json` - Added tshy exports config
### Usage Examples
Simple - pre-configured instances:
\`\`\`typescript
import { listStyles, createStyle, previewStyle } from '@mapbox/mcp-devkit-server/tools';
\`\`\`
Advanced - custom tool instances:
\`\`\`typescript
import { ListStylesTool } from '@mapbox/mcp-devkit-server/tools';
import { httpRequest } from '@mapbox/mcp-devkit-server/utils';
const tool = new ListStylesTool({ httpRequest });
\`\`\`
Expert - custom HTTP pipeline:
\`\`\`typescript
import { HttpPipeline, UserAgentPolicy } from '@mapbox/mcp-devkit-server/utils';
const pipeline = new HttpPipeline();
pipeline.usePolicy(new UserAgentPolicy('MyApp/1.0'));
\`\`\`
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Create docs/importing-tools.md with detailed guide covering: - Simple usage: pre-configured instances - Advanced usage: tool classes with default httpRequest - Expert usage: custom HTTP pipeline - Registry functions for batch operations - Complete API reference for tools, resources, prompts, utils - Best practices and troubleshooting - Create examples/import-example.ts with working code examples demonstrating all import patterns - Create tsconfig.examples.json for type checking examples - Update package.json scripts to include examples in: - lint/lint:fix - format/format:fix - spellcheck All examples pass linting and type checking. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
ctufts
approved these changes
Feb 9, 2026
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
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
Implements explicit, well-documented subpath exports to allow users to import specific Mapbox MCP Devkit components without the full server. This follows the same pattern established in the main mcp-server package.
Motivation
Users may want to:
Solution
Explicit subpath exports via tshy:
@mapbox/mcp-devkit-server/tools- 25 devkit tool classes and pre-configured instances@mapbox/mcp-devkit-server/resources- 8 resource classes and instances (including UI resources)@mapbox/mcp-devkit-server/prompts- 7 prompt classes and instances@mapbox/mcp-devkit-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/index.ts(7.7KB) - Barrel export for all 25 devkit toolssrc/resources/index.ts(3.7KB) - Barrel export for all 8 resourcessrc/prompts/index.ts(2.9KB) - Barrel export for all 7 promptssrc/utils/index.ts(1.5KB) - Barrel export for HTTP utilitiesUpdated Files
package.json- Added tshy exports configurationBenefits
listStylesinstead oflistStylesTool)Compatibility
Testing
Related
Similar to the implementation in mapbox/mcp-server#111