Skip to content

Conversation

@theodorosploumis
Copy link
Member

@theodorosploumis theodorosploumis commented Dec 13, 2025

User description

  • feat: Add npm package for MCP server and improve deprecated UI
  • feat: Add workflow to auto-update MCP package when project data changes
  • docs: Add comprehensive npm publishing guide to MCP README
  • Fix critical path issue in npm package distribution
  • Fix hardcoded absolute paths in test.js
  • Fix GitHub Pages CI warning with GitHub Actions
  • Update Jekyll and plugins to latest versions
  • Create dedicated MCP server page without filters

PR Type

Enhancement, Bug fix


Description

  • Fix npm package distribution paths for proper installation

  • Replace hardcoded absolute paths with dynamic relative paths

  • Add GitHub Actions workflow for Jekyll CI/CD

  • Update Jekyll and plugins to latest versions

  • Create dedicated MCP server documentation page


Diagram Walkthrough

flowchart LR
  A["Package Paths"] -->|"Remove dist/ prefix"| B["Correct Entry Points"]
  C["Hardcoded Paths"] -->|"Use __dirname"| D["Dynamic Resolution"]
  E["Jekyll Config"] -->|"Add plugins & workflow"| F["GitHub Pages Ready"]
  G["MCP Server"] -->|"Create docs page"| H["User Documentation"]
Loading

File Walkthrough

Relevant files
Documentation
index.html
Add comprehensive MCP server documentation page                   

mcp-server/index.html

  • New dedicated MCP server documentation page
  • Includes installation, usage, and feature documentation
  • Provides examples for Claude Desktop configuration
  • Documents all three available tools with parameters
+96/-0   
Bug fix
build.js
Fix hardcoded paths in build script                                           

mcp-package/build.js

  • Replace hardcoded absolute paths with dynamic path resolution
  • Use fileURLToPath and dirname for ES module compatibility
  • Update test.js generation to use join(__dirname, 'index.js')
  • Fix package.json main and bin entries to remove dist/ prefix
+14/-2   
test.js
Fix hardcoded paths in test file                                                 

mcp-package/dist/test.js

  • Replace hardcoded absolute paths with dynamic __dirname
  • Use join(__dirname, 'index.js') for portable path resolution
  • Update spawn command to use relative paths
  • Ensure test works correctly after npm install
+7/-2     
package.json
Fix package.json paths for distribution                                   

mcp-package/dist/package.json

  • Update main entry point from dist/index.js to index.js
  • Update bin entry from dist/index.js to index.js
  • Update test script from node dist/test.js to node test.js
  • Align with distribution package structure
+3/-3     
package.json
Fix package.json entry point paths                                             

mcp-package/package.json

  • Update main entry point from dist/index.js to index.js
  • Update bin entry from dist/index.js to index.js
  • Update test script from node dist/test.js to node test.js
  • Ensure proper npm package entry points
+3/-3     
Configuration changes
jekyll.yml
Add GitHub Actions Jekyll CI/CD workflow                                 

.github/workflows/jekyll.yml

  • New GitHub Actions workflow for Jekyll site building
  • Includes Ruby setup with bundler caching
  • Builds Jekyll site and deploys to GitHub Pages
  • Runs on push to main/master and pull requests
+52/-0   
_config.yml
Configure Jekyll plugins and build exclusions                       

_config.yml

  • Add Jekyll plugins configuration for feed, sitemap, and SEO
  • Add exclude list for build optimization
  • Exclude node_modules, vendor, mcp-package, and api directories
  • Configure GitHub Pages compatible settings
+17/-0   
Dependencies
Gemfile
Update Jekyll and add required plugins                                     

Gemfile

  • Update Jekyll to version 4.4.1
  • Add jekyll-feed, jekyll-sitemap, jekyll-seo-tag plugins
  • Add platform-specific gems for Windows and JRuby support
  • Include tzinfo and wdm for performance and compatibility
+20/-1   

theodorosploumis and others added 5 commits December 13, 2025 23:28
- Update package.json paths to point to index.js relative to published root
- Fix main and bin entries to remove dist/ prefix for proper npx usage
- Ensure package works correctly when installed via npm
- Tests pass successfully

This resolves the issue where npm install would fail to find the entry point.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Update test.js to use relative paths with join(__dirname, 'index.js')
- Remove hardcoded absolute paths that would break after npm install
- Use dynamic path resolution for proper package portability

This ensures the test works correctly when the package is installed via npm.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add GitHub Actions workflow for Jekyll builds
- Update Gemfile with Jekyll 4.3.0 and required plugins
- Add jekyll-feed, jekyll-sitemap, and jekyll-seo-tag plugins
- Configure proper exclusions in _config.yml
- Remove dependency on deprecated github-pages gem

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Update Jekyll from 4.3.0 to 4.4.1
- Update jekyll-feed to 0.17
- Update jekyll-sitemap to 1.4
- Update jekyll-seo-tag to 2.8

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add index.html for mcp-server directory
- Remove filters section from MCP server page
- Keep only one "Drupal Tools MCP Server" title as main heading
- Display essential information: features, installation, usage, tools
- Remove duplicate labels and unnecessary UI elements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@qodo-code-review
Copy link

qodo-code-review bot commented Dec 13, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
No audit logs: New scripts and test runner spawn the MCP server without adding any audit logging of
critical actions or outcomes, making auditability unclear.

Referred Code
const testContent = `#!/usr/bin/env node

import { spawn } from 'child_process';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

console.log('Testing @drupaltools/mcp server...');

const server = spawn('node', [join(__dirname, 'index.js')], {
  stdio: ['pipe', 'pipe', 'inherit'],
  cwd: __dirname
});

let responseCount = 0;
const expectedResponses = 2;

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Missing error handling: The test script spawns a Node process without handling spawn errors or non-zero exits,
lacking edge-case management and actionable error messages.

Referred Code
const server = spawn('node', [join(__dirname, 'index.js')], {
  stdio: ['pipe', 'pipe', 'inherit'],
  cwd: __dirname
});

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: build

Failed stage: Setup Ruby [❌]

Failure summary:

The GitHub Action failed during the Bundler install step. Bundler detected that the Gemfile changed
compared to the Gemfile.lock while running in deployment/frozen mode, which disallows changes:
- New
gems were added to Gemfile (e.g., jekyll (~> 4.4.1), jekyll-feed, jekyll-sitemap, jekyll-seo-tag,
tzinfo, tzinfo-data, wdm).
- jekyll was also deleted once, causing a mismatch with the lockfile.
-
In deployment mode, Bundler requires the lockfile to be up-to-date and consistent; otherwise it
exits with error.
This caused Bundler to exit with code 16
(/opt/hostedtoolcache/Ruby/3.1.7/x64/bin/bundle), failing the job. To fix, update and commit
Gemfile.lock or unset deployment mode (bundle config unset deployment) if appropriate.

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

189:  updated Gemfile.lock to version control.
190:  If this is a development machine, remove the
191:  /home/runner/work/drupaltools.github.io/drupaltools.github.io/Gemfile freeze
192:  by running `bundle config unset deployment`.
193:  The dependencies in your gemfile changed
194:  You have added to the Gemfile:
195:  * jekyll (~> 4.4.1)
196:  * jekyll-feed (~> 0.17)
197:  * jekyll-sitemap (~> 1.4)
198:  * jekyll-seo-tag (~> 2.8)
199:  * tzinfo (>= 1, < 3) mingw, x64_mingw, mswin, jruby
200:  * tzinfo-data mingw, x64_mingw, mswin, jruby
201:  * wdm (~> 0.1.1) mingw, x64_mingw, mswin
202:  You have deleted from the Gemfile:
203:  * jekyll
204:  ##[error]The process '/opt/hostedtoolcache/Ruby/3.1.7/x64/bin/bundle' failed with exit code 16
205:  Post job cleanup.

@qodo-code-review
Copy link

qodo-code-review bot commented Dec 13, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Simplify the npm package build
Suggestion Impact:package.json was updated to reference dist/index.js for main and bin and to publish dist/, aligning with publishing from the root. A comment in build.js was adjusted toward publishing from dist, though build.js still modifies package.json. Overall, the change moves toward the suggested approach.

code diff:

# File: mcp-package/package.json
@@ -3,13 +3,12 @@
   "version": "1.0.0",
   "description": "Model Context Protocol (MCP) server for discovering Drupal development tools, utilities, and plugins",
   "type": "module",
-  "main": "index.js",
+  "main": "dist/index.js",
   "bin": {
-    "drupaltools-mcp": "index.js"
+    "drupaltools-mcp": "dist/index.js"
   },
   "files": [
-    "dist/",
-    "README.md"
+    "dist/"
   ],
   "scripts": {
     "build": "node build.js",

Refactor the npm package build process to publish from the mcp-package root
directory. This simplifies the process by removing the need for the build.js
script to generate a separate package.json for the dist directory.

Examples:

mcp-package/build.js [148-161]
// Create package.json for distribution
const packageSrc = join(__dirname, 'package.json');
const packageContent = JSON.parse(readFileSync(packageSrc, 'utf8'));

// Update paths for distribution (remove dist/ prefix since files are at root)
packageContent.main = 'index.js';
packageContent.bin = {
  'drupaltools-mcp': 'index.js'
};


 ... (clipped 4 lines)
mcp-package/package.json [5-13]
  "type": "module",
  "main": "index.js",
  "bin": {
    "drupaltools-mcp": "index.js"
  },
  "files": [
    "dist/",
    "README.md"
  ],

Solution Walkthrough:

Before:

// mcp-package/build.js
...
// Create package.json for distribution
const packageSrc = join(__dirname, 'package.json');
const packageContent = JSON.parse(readFileSync(packageSrc, 'utf8'));

// Update paths for distribution
packageContent.main = 'index.js';
packageContent.bin = { 'drupaltools-mcp': 'index.js' };
packageContent.files = ['*.js', '*.json', '*.md'];
writeFileSync(join(distDir, 'package.json'), JSON.stringify(packageContent, null, 2));
...
// To publish:
// cd mcp-package/dist
// npm publish

After:

// mcp-package/build.js
...
// The build script no longer needs to create or modify package.json.
// It only generates data and copies source files to dist/.

// mcp-package/package.json
{
  "main": "dist/index.js",
  "bin": {
    "drupaltools-mcp": "dist/index.js"
  },
  "files": [
    "dist/",
    "README.md"
  ],
  ...
}
// To publish:
// cd mcp-package
// npm publish
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a design issue with the build process, proposing a standard pattern that improves maintainability by eliminating a generated package.json.

Medium
General
Optimize workflow by canceling outdated deployments
Suggestion Impact:The workflow previously had cancel-in-progress: false under concurrency; the commit removed the entire workflow content, effectively eliminating the previous setting and any outdated run behavior. This change impacts the suggested area, though not by flipping the flag to true.

code diff:

-concurrency:
-  group: "pages"
-  cancel-in-progress: false

Set concurrency.cancel-in-progress to true in the GitHub Actions workflow to
cancel outdated deployments, save resources, and ensure the latest version is
deployed.

.github/workflows/jekyll.yml [14-16]

 concurrency:
   group: "pages"
-  cancel-in-progress: false
+  cancel-in-progress: true

[Suggestion processed]

Suggestion importance[1-10]: 6

__

Why: The suggestion provides a valid best practice for GitHub Actions deployment workflows, which improves efficiency by canceling outdated runs and saving resources.

Low
  • Update

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

theodorosploumis and others added 4 commits December 13, 2025 23:52
- Update source package.json to point to dist/ entries (dist/index.js)
- Keep dist/package.json with root entries (index.js) since it's published from dist/
- This resolves the module not found issue when installing via npm
- The published package will have the correct entry points

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove .github/workflows/jekyll.yml
  - Stop building/deploying Jekyll site via GitHub Pages
  - Keeping publish-npm.yml and update-mcp-package.yml workflows

- Fix mcp-package/dist/package.json
  - Remove build and prepublishOnly scripts that reference non-existent build.js
  - Allows npm publish:npm to succeed without errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@theodorosploumis theodorosploumis merged commit 3d191e8 into master Dec 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants