I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

mcp-ble-server
3 years
Works with Finder
1
Github Watches
1
Github Forks
0
Github Stars
MCP BLE Server
A Model Context Protocol (MCP) server implementation that provides BLE (Bluetooth Low Energy) capabilities to AI assistants. It enables AI models to discover, connect to, and communicate with BLE devices through a standardized protocol interface.
Features
- Reliable BLE device discovery and connection
- Robust error handling and recovery
- Comprehensive documentation
- High test coverage (>92%)
- MCP Protocol Implementation
- AI Assistant Integration
- Performance optimization
- Memory pooling
- Garbage collection tuning
- Memory metrics tracking
- Connection pooling
- Message batching
- Priority-based processing
- Security hardening (In Progress)
- Production deployment readiness (Planned)
Technical Stack
- Node.js >= 14.x
- CommonJS modules
- Jest for testing
- Winston for logging
- Prometheus for metrics
- PM2 for process management
- WebSocket for MCP communication
- Protocol Buffers for message serialization
Memory Management
The server implements advanced memory management features to optimize performance and resource usage:
Memory Pooling
- Object pooling for frequently allocated types (buffers, strings, objects)
- Automatic pool size management based on usage patterns
- Priority-based pool allocation
- Memory reuse to reduce garbage collection pressure
Garbage Collection Optimization
- Automatic garbage collection tuning
- Periodic memory usage monitoring
- Warning and critical thresholds for memory usage
- Proactive memory cleanup when thresholds are exceeded
- Memory usage metrics and analytics
Memory Monitoring
- Real-time memory usage tracking
- Heap size monitoring
- Pool utilization metrics
- Garbage collection statistics
- Memory leak detection
- Resource usage alerts
Project Structure
mcp-ble-server/
├── src/
│ ├── ble/ # BLE core functionality
│ ├── mcp/ # MCP protocol implementation
│ ├── config/ # Configuration management
│ ├── utils/ # Utility functions
│ └── index.js # Application entry point
├── tests/
│ ├── unit/ # Unit tests
│ └── integration/ # Integration tests
├── docs/ # Documentation
└── config/ # Configuration files
Configuration
Memory Management Configuration
{
memoryMonitoring: {
enabled: true,
checkIntervalMS: 60000, // Check memory usage every minute
warningThresholdMB: 100, // Warning at 100MB usage
maxMemoryMB: 200, // Maximum allowed memory usage
},
invalidationStrategy: {
maxAge: 3600000, // 1 hour
maxSize: 1000, // Maximum number of cached items
priorityLevels: ['low', 'medium', 'high'],
getPriorityValue: (priority) => {
const values = { low: 0, medium: 1, high: 2 };
return values[priority] || 0;
}
}
}
Metrics
The server exposes various metrics for monitoring memory usage and performance:
-
memory_heap_size
: Current heap size in bytes -
memory_heap_used
: Current heap usage in bytes -
memory_heap_limit
: Heap size limit in bytes -
memory_pool_size
: Current size of memory pools -
memory_gc_count
: Number of garbage collections -
memory_gc_duration
: Duration of garbage collections -
memory_pool_hits
: Number of successful pool allocations -
memory_pool_misses
: Number of failed pool allocations -
cache_memory_usage
: Current cache memory usage -
cache_memory_evictions
: Number of cache entries evicted
Development
Prerequisites
- Node.js >= 14.x
- npm or yarn
- Bluetooth adapter (for BLE functionality)
Installation
# Clone the repository
git clone https://github.com/yourusername/mcp-ble-server.git
# Install dependencies
npm install
# Run tests
npm test
# Start the server
npm start
Running with Memory Management
To enable memory management features, start the server with the --expose-gc
flag:
node --expose-gc src/index.js
Development Guidelines
- Follow the CommonJS module format
- Write comprehensive tests for new features
- Update documentation for significant changes
- Monitor memory usage during development
- Use memory pooling for frequently allocated objects
- Implement proper cleanup in error cases
Testing
Test Categories
-
Unit Tests
- Located in
tests/unit/
- Test individual components in isolation
- Use Jest for testing framework
- Mock external dependencies
- Located in
-
Integration Tests
- Located in
tests/integration/
- Test component interactions
- Test system behavior
- Located in
-
Performance Tests
- Located in
tests/performance/
- Test system under load
- Measure response times
- Monitor resource usage
- Located in
-
Security Tests
- Located in
tests/security/
- Test authentication
- Test authorization
- Test encryption
- Located in
Running Tests
# Run all tests
npm test
# Run specific test file
npm test -- tests/unit/utils/Base64Utils.test.js
# Run tests with coverage
npm test -- --coverage
# Run tests in watch mode
npm test -- --watch
# Run tests with verbose output
npm test -- --verbose
Test Coverage
Current test coverage status:
- Base64Utils: 100% (22 passing tests)
- Hardware acceleration tests
- Encoding/decoding tests
- Validation tests
- Stream operation tests
Memory Management Tests
# Run memory management tests
npm test -- tests/unit/utils/MemoryManager.test.js
# Run cache layer tests with memory management
npm test -- tests/unit/mcp/server/CachingLayer.test.js
CI/CD Pipeline
The project uses GitHub Actions for continuous integration and deployment:
-
Test Job
- Runs on Ubuntu
- Installs Node.js
- Runs all tests
- Uploads coverage reports
-
Lint Job
- Runs ESLint
- Enforces code style
- Checks for common issues
-
Security Job
- Runs security audit
- Checks dependencies
- Generates security reports
-
Build Job
- Builds the project
- Verifies build output
- Creates artifacts
-
Deploy Job
- Deploys to staging
- Requires approval
- Monitors deployment
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
MIT License - see LICENSE file for details
相关推荐
Confidential guide on numerology and astrology, based of GG33 Public information
Converts Figma frames into front-end code for various mobile frameworks.
Advanced software engineer GPT that excels through nailing the basics.
A medical specialist offering assistance grounded in clinical guidelines. Disclaimer: This is intended for research and is NOT safe for clinical use!
A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.
Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.
Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx
Una puerta de enlace de API unificada para integrar múltiples API de explorador de blockchain similar a Esterscan con soporte de protocolo de contexto modelo (MCP) para asistentes de IA.
Espejo de https: //github.com/suhail-ak-s/mcp-typesense-server
本项目是一个钉钉 MCP (Protocolo del conector de mensajes )服务 , 提供了与钉钉企业应用交互的 API 接口。项目基于 Go 语言开发 支持员工信息查询和消息发送等功能。 支持员工信息查询和消息发送等功能。
Reviews

user_hUMZ81Ha
I've been using MCP-Memos by huhu415 for a while now and it's been fantastic! The simplicity and efficiency of this tool make it ideal for jotting down quick notes and ideas. The user interface is intuitive and easy to navigate. Highly recommend it to anyone looking to streamline their note-taking process. Check it out at https://mcp.so/server/mcp-memos/huhu415!