About Utils
Utils is an MCP server published by pdas9647 in the Developer Tools category: π οΈ Essential TypeScript utility library for Model Context Protocol (MCP) server development with Claude Desktop integration π€ Powers GitHub-MCP, Google-Workspace-MCP & FS-MCP with MongoDB connectivity, AES-256-GCM encryption, cross-platform config management & more π.
The repository has 2 stars and 0 forks, with the last commit 9 days ago. Recent commit activity is the strongest signal that reported issues will get attention.
Install
git clone https://github.com/pdas9647/MCP-UtilsThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Utils
Powered by Claude · Grounded in docs
Security checks
Static checks derived from the repository 7 days ago. Heuristics on the source, not an audit.
- βREADME presentThe repository ships documentation.
- !License declaredNo license file. Legally you have no right to use it in a product.
- !Tests presentNo tests found. Behaviour changes may go unnoticed between versions.
- !Dependencies pinnedNo lockfile. Installs can pull different code over time.
- βNo dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
- !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.
README
MCP-Utils π οΈ
Essential TypeScript utility library for Model Context Protocol (MCP) server development with Claude Desktop integration. This production-ready utility package provides comprehensive tools for building robust MCP servers with MongoDB connectivity, encryption, cross-platform configuration management, and more.
π Features
- π§ MCP Server Utilities: Core utilities for building Model Context Protocol servers
- ποΈ MongoDB Integration: Simplified database connectivity with error handling
- π AES-256-GCM Encryption: Secure token encryption and decryption
- βοΈ Claude Configuration: Automatic Claude Desktop config updates across platforms
- π Port Management: Smart port killing and process management
- π Logging & Error Handling: Structured console logging and error reporting
- π Cross-Platform: Full support for macOS, Windows, and Linux
- π¦ TypeScript Ready: Full TypeScript support with type definitions
π¦ Installation
# Install from GitHub
npm install github:pdas9647/MCP-Utils#master
# Or add to package.json
"mcp-utils": "github:pdas9647/MCP-Utils#master"
π― Usage
Import Utilities
import {
connect, // MongoDB connection
encryptToken, decryptToken, // Encryption utilities
addOrUpdateMCPServer, // Claude config management
killPortOnLaunch, // Port management
printInConsole, // Console logging
sendError // Error handling
} from 'mcp-utils/utils';
MongoDB Connection
import {connect} from 'mcp-utils/utils';
import {StdioServerTransport} from "@modelcontextprotocol/sdk/server/stdio.js";
const transport = new StdioServerTransport();
const MONGODB_URI = process.env.MONGODB_URI;
const db = await connect(transport, MONGODB_URI, 'your-database-name');
Encryption & Decryption
import {encryptToken, decryptToken} from 'mcp-utils/utils';
const TOKEN_SECRET = 'your-32-byte-hex-secret';
const plainText = 'sensitive-data';
// Encrypt
const encrypted = encryptToken(TOKEN_SECRET, plainText);
console.log(encrypted); // { iv: '...', content: '...', tag: '...' }
// Decrypt
const decrypted = decryptToken(TOKEN_SECRET, encrypted);
console.log(decrypted); // 'sensitive-data'
Claude Desktop Configuration
import {addOrUpdateMCPServer, setEntry} from 'mcp-utils/utils';
// Create server entry
const {entry} = setEntry('your-project-name');
// Add/update MCP server in Claude Desktop config
await addOrUpdateMCPServer('server-name', entry);
Port Management
import {killPortOnLaunch, freezePortOnQuit} from 'mcp-utils/utils';
// Kill processes using a specific port
await killPortOnLaunch(3000);
// Monitor parent process and exit when it dies
freezePortOnQuit();
Console Logging & Error Handling
import {printInConsole, sendError} from 'mcp-utils/utils';
import {StdioServerTransport} from "@modelcontextprotocol/sdk/server/stdio.js";
const transport = new StdioServerTransport();
// Log messages to console
await printInConsole(transport, 'Server started successfully');
// Send structured errors
try {
// Some operation
} catch (error) {
sendError(transport, error instanceof Error ? error : new Error(String(error)), 'operation-context');
}
ποΈ Architecture
Core Utilities
| Utility | Purpose | Key Features |
|---|---|---|
db.ts |
MongoDB connectivity | Connection management, error handling |
encryption.ts |
Token security | AES-256-GCM encryption/decryption |
updateClaudeConfig.ts |
Claude integration | Cross-platform config management |
killPortOnLaunch.ts |
Process management | Port killing, process monitoring |
printInConsole.ts |
Logging | Structured console output |
sendError.ts |
Error handling | JSON-RPC error reporting |
directory.ts |
Path utilities | Cross-platform directory resolution |
Cross-Platform Support
The library provides full cross-platform support for:
- macOS:
~/Library/Application Support/Claude/ - Windows:
%APPDATA%\Claude\ - Linux:
~/.config/Claude/
π¨ Used By
This utility library powers several production MCP servers:
1. GitHub-MCP
Complete GitHub integration with repository management, issue tracking, and collaboration features.
// Usage example from GitHub-MCP
import {addOrUpdateMCPServer, freezePortOnQuit, killPortOnLaunch, printInConsole, setEntry} from "mcp-utils/utils";
await killPortOnLaunch(PORT);
const {entry} = setEntry('') as any;
await addOrUpdateMCPServer('github', entry);
2. Google-Workspace-MCP
Google Drive, Sheets, and Docs integration for comprehensive workspace management.
3. FS-MCP
Local file system operations with cross-platform support for macOS, Windows & Linux.
π‘οΈ Security Features
- AES-256-GCM Encryption: Industry-standard encryption for sensitive data
- Secure Token Management: Proper IV generation and authentication tags
- Error Context Isolation: Structured error handling without exposing sensitive information
- Development/Production Modes: Stack traces only in development environment
π§ Development
Prerequisites
- Node.js 18+
- TypeScript 5.8+
- MongoDB (for database utilities)
Build
npm run build # Compile TypeScript
npm run dev # Development mode
Project Structure
mcp-utils/
βββ src/
β βββ server.ts # Example server
βββ utils/
β βββ tool.ts # Main exports
β βββ db.ts # MongoDB utilities
β βββ encryption.ts # Crypto utilities
β βββ updateClaudeConfig.ts # Claude config
β βββ killPortOnLaunch.ts # Port management
β βββ printInConsole.ts # Logging
β βββ sendError.ts # Error handling
β βββ directory.ts # Path utilities
βββ package.json
βββ tsconfig.json
π License
MIT License - see LICENSE file for details.
π€ Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
π Related Projects
- Model Context Protocol - Official MCP documentation
- Claude Desktop - Anthropic's Claude Desktop application
- @modelcontextprotocol/sdk - Official MCP SDK
π Stats
- Language: TypeScript
- Dependencies: 2 (crypto-js, mongodb)
- Zero Runtime Dependencies: Core utilities with minimal footprint
- Cross-Platform: macOS, Windows, Linux support
- Production Ready: Used in multiple production MCP servers
Built with β€οΈ for the MCP ecosystem
README fetched from the repository 7 days ago. The original is authoritative.