Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
## 0.4.0 (Unreleased)
## 0.4.4

### Other

- Add to MCP registry

## 0.4.0

### Features Added

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dxt_version": "0.1",
"name": "@mapbox/mcp-devkit-server",
"display_name": "Mapbox MCP DevKit Server",
"version": "0.4.3",
"version": "0.4.4",
"description": "Mapbox MCP devkit server",
"author": {
"name": "Mapbox, Inc."
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mapbox/mcp-devkit-server",
"version": "0.4.3",
"version": "0.4.4",
"description": "Mapbox MCP devkit server",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
Expand Down
124 changes: 101 additions & 23 deletions scripts/sync-manifest-version.cjs
Original file line number Diff line number Diff line change
@@ -1,36 +1,114 @@
// Sync manifest.json version with package.json
// Sync manifest.json and server.json versions with package.json
const fs = require('node:fs');
const path = require('node:path');

function syncManifestVersion() {
/**
* Pure function that syncs versions across config objects
* @param {Object} packageJson - The package.json object
* @param {Object} manifestJson - The manifest.json object
* @param {Object} serverJson - The server.json object
* @returns {Object} Result containing updated configs and change information
*/
function syncVersionsCore(packageJson, manifestJson, serverJson) {
const packageVersion = packageJson.version;
const result = {
packageVersion,
updatedManifest: null,
updatedServer: null,
changes: {
manifest: false,
server: false,
serverPackage: false
},
oldVersions: {
manifest: manifestJson.version,
server: serverJson.version,
serverPackage: serverJson.packages?.[0]?.version
}
};

// Check and update manifest.json
if (manifestJson.version !== packageVersion) {
result.updatedManifest = { ...manifestJson, version: packageVersion };
result.changes.manifest = true;
}

// Check and update server.json
const serverNeedsUpdate = serverJson.version !== packageVersion;
const packageNeedsUpdate = serverJson.packages?.[0] &&
serverJson.packages[0].version !== packageVersion;

if (serverNeedsUpdate || packageNeedsUpdate) {
result.updatedServer = JSON.parse(JSON.stringify(serverJson)); // Deep clone

if (serverNeedsUpdate) {
result.updatedServer.version = packageVersion;
result.changes.server = true;
}

if (packageNeedsUpdate) {
result.updatedServer.packages[0].version = packageVersion;
result.changes.serverPackage = true;
}
}

return result;
}

function syncVersions() {
const packageJsonPath = path.join(process.cwd(), 'package.json');
const manifestJsonPath = path.join(process.cwd(), 'manifest.json');
const serverJsonPath = path.join(process.cwd(), 'server.json');

// Read package.json
// Read files
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
const packageVersion = packageJson.version;

// Read manifest.json
const manifestJson = JSON.parse(fs.readFileSync(manifestJsonPath, 'utf-8'));
const manifestVersion = manifestJson.version;
const serverJson = JSON.parse(fs.readFileSync(serverJsonPath, 'utf-8'));

// Sync versions using pure function
const result = syncVersionsCore(packageJson, manifestJson, serverJson);

let updatedFiles = [];

// Check if versions are already in sync
if (manifestVersion === packageVersion) {
console.log(`✓ Versions already in sync: ${packageVersion}`);
return;
// Write updated manifest if needed
if (result.updatedManifest) {
fs.writeFileSync(
manifestJsonPath,
JSON.stringify(result.updatedManifest, null, 2) + '\n',
'utf-8'
);
console.log(
`✓ Updated manifest.json version: ${result.oldVersions.manifest} → ${result.packageVersion}`
);
updatedFiles.push('manifest.json');
}

// Update manifest.json version
manifestJson.version = packageVersion;
fs.writeFileSync(
manifestJsonPath,
JSON.stringify(manifestJson, null, 2) + '\n',
'utf-8'
);

console.log(
`✓ Updated manifest.json version: ${manifestVersion} → ${packageVersion}`
);
// Write updated server if needed
if (result.updatedServer) {
fs.writeFileSync(
serverJsonPath,
JSON.stringify(result.updatedServer, null, 2) + '\n',
'utf-8'
);
console.log(
`✓ Updated server.json versions: ${result.oldVersions.server} → ${result.packageVersion}`
);
updatedFiles.push('server.json');
}

if (updatedFiles.length === 0) {
console.log(`✓ All versions already in sync: ${result.packageVersion}`);
} else {
console.log(`✓ Synced ${updatedFiles.join(', ')} with package.json version: ${result.packageVersion}`);
}
}

// Export for testing
if (typeof module !== 'undefined' && module.exports) {
module.exports = { syncVersionsCore, syncVersions };
}

syncManifestVersion();
// Run if called directly
if (require.main === module) {
syncVersions();
}
31 changes: 31 additions & 0 deletions server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-09-16/server.schema.json",
"name": "io.github.mapbox/mcp-devkit-server",
"description": "Provides AI assistants with direct access to Mapbox developer APIs and documentation.",
"repository": {
"url": "https://github.com/mapbox/mcp-devkit-server",
"source": "github"
},
"version": "0.4.4",
"packages": [
{
"registryType": "npm",
"registryBaseUrl": "https://registry.npmjs.org",
"runtimeHint": "npx",
"version": "0.4.4",
"identifier": "@mapbox/mcp-devkit-server",
"transport": {
"type": "stdio"
},
"environmentVariables": [
{
"description": "Your Mapbox access token. See docs for required scopes.",
"format": "string",
"isRequired": true,
"isSecret": true,
"name": "MAPBOX_ACCESS_TOKEN"
}
]
}
]
}
9 changes: 9 additions & 0 deletions test/project/fixtures/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"dxt_version": "0.1",
"name": "test-manifest",
"version": "1.0.0",
"description": "Test manifest",
"author": {
"name": "Test Author"
}
}
5 changes: 5 additions & 0 deletions test/project/fixtures/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "test-package",
"version": "2.0.0",
"description": "Test package for sync script"
}
12 changes: 12 additions & 0 deletions test/project/fixtures/server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "test-schema",
"name": "test-server",
"version": "1.5.0",
"packages": [
{
"identifier": "test-package",
"version": "1.2.0",
"registryType": "npm"
}
]
}
Loading
Loading