
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@stellarwp/mcp-api-fetch
Advanced tools
@stellarwp/mcp-api-fetch
)A Node.js compatible implementation of WordPress's @wordpress/api-fetch
with built-in middleware for MCP server environments.
This package provides a drop-in replacement for @wordpress/api-fetch
that works seamlessly in Node.js environments while maintaining full API compatibility. It's specifically designed for MCP servers that need to interact with WordPress REST APIs, with automatic authentication and URL handling.
@wordpress/api-fetch
# Install the package
bun add @stellarwp/mcp-api-fetch
# Or with npm
npm install @stellarwp/mcp-api-fetch
This package works with the Node Config package for environment variable management. Create a .env
file in your project root:
WP_REST_URL=https://your-site.com/wp-json/wp/v2/
WP_USERNAME=your_username
WP_APP_PASSWORD=your_application_password
💡 Local Development Tip: When developing on a local environment where SSL certificates wouldn't validate (e.g., localhost with self-signed certs), you can set
NODE_TLS_REJECT_UNAUTHORIZED=0
in your environment variables. Note: This should only be used in development environments, never in production.
import apiFetch from '@stellarwp/mcp-api-fetch';
// Simple GET request
const posts = await apiFetch({ path: '/wp/v2/posts' });
The package provides a middleware-based architecture that extends the standard @wordpress/api-fetch
functionality:
The authentication approach depends on your deployment environment:
When running as a Node.js-based MCP server, the package automatically adds WordPress authentication using WordPress Application Passwords:
// Middleware automatically adds these headers:
// Authorization: Basic base64(username:password)
// Uses WP_USERNAME and WP_APP_PASSWORD environment variables
When the package is used in a browser environment, it integrates with WordPress's built-in authentication system. The package must be bundled with your project's webpack configuration to include the @wordpress/api-fetch
version provided by WordPress, which automatically handles authentication using the current user's WordPress session.
Handles WordPress URL construction and normalization:
WP_REST_URL
to all relative paths@wordpress/api-fetch
to be provided by WordPresswp-api-fetch
to be enqueued by WordPressWhen using this package in a browser environment:
// In your WordPress theme or plugin
wp_enqueue_script('wp-api-fetch');
wp_enqueue_script('mcp-api-fetch', 'path/to/browser.js', ['wp-api-fetch']);
You can extend the functionality by adding custom middleware:
import { use } from '@stellarwp/mcp-api-fetch';
// Custom middleware for logging
use(async (options, next) => {
console.log('Request:', options);
const response = await next(options);
console.log('Response:', response);
return response;
});
The package provides different builds for different environments:
index.js
- Full middleware support with custom fetch implementationbrowser.js
- WordPress integration with external @wordpress/api-fetch
dependencyindex.d.ts
- TypeScript definitionsFAQs
A compatible interface with @wordpress/api-fetch
The npm package @stellarwp/mcp-api-fetch receives a total of 440 weekly downloads. As such, @stellarwp/mcp-api-fetch popularity was classified as not popular.
We found that @stellarwp/mcp-api-fetch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.