npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ai-solutions.ru/mikrotik-mcp-server

v2.0.3

Published

AI-powered Model Context Protocol (MCP) server for MikroTik RouterOS automation

Readme

MikroTik MCP Server

A high-performance MCP (Model Context Protocol) server for MikroTik RouterOS management with dynamic command discovery, schema generation, and intelligent caching.

🎉 Version 2.0.2 Released!

Major Update: Real RouterOS integration with 33 tools and 7 resources! See what's new

Quick Start with v2

npm install -g @ai-solutions.ru/mikrotik-mcp-server
npx @ai-solutions.ru/mikrotik-mcp-server

Features

🔧 Dynamic Tools

  • list_api_endpoints - Search and filter RouterOS API endpoints with relevance scoring
  • get_api_endpoint_schema - Get detailed schemas with validation rules and examples
  • invoke_api_endpoint - Execute RouterOS commands with validation and retry logic

📚 Static Resources

  • System Information - Hardware specs, license details, packages, and limits
  • Configuration State - Real-time status of services, interfaces, firewall, and routing
  • Documentation - Command references, best practices, troubleshooting guides

🚀 Advanced Features

  • Dynamic Command Discovery - Automatically discovers available commands using /console/inspect
  • Schema Generation - Generates JSON Schema, Zod validators, and TypeScript types
  • Connection Pooling - Efficient connection management with idle timeout
  • Rate Limiting - Prevents API overload with configurable limits
  • Smart Caching - Multi-level caching with TTL and disk persistence
  • Retry Logic - Exponential backoff for failed requests
  • Type Safety - Full TypeScript support with strict typing

Installation

# Clone the repository
git clone https://github.com/yourusername/mikrotik-mcp-server.git
cd mikrotik-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

Configuration

Environment Variables

Copy .env.example to .env and configure:

# RouterOS Connection
ROUTEROS_HOST=192.168.88.1
ROUTEROS_PORT=8728
ROUTEROS_USERNAME=admin
ROUTEROS_PASSWORD=your_password_here

# Optional settings
ROUTEROS_SECURE=false
ROUTEROS_TIMEOUT=30000
DISCOVERY_ENABLED=true
DISCOVERY_CACHE_TTL=86400000

Configuration File

Generate an example configuration:

npm run start -- generate-config

This creates config.example.json with all available options:

{
  "server": {
    "name": "mikrotik-mcp-server",
    "version": "1.0.0",
    "logLevel": "info"
  },
  "routeros": {
    "host": "192.168.88.1",
    "port": 8728,
    "username": "admin",
    "password": "your-password-here",
    "secure": false,
    "timeout": 30000,
    "retries": 3
  },
  "discovery": {
    "enabled": true,
    "cacheTTL": 86400000,
    "cacheDir": ".cache/discovery",
    "maxDepth": 5
  }
}

Usage

Starting the Server

# Start with default configuration
npm start

# Start with custom config file
npm start -- --config myconfig.json

# Development mode with hot reload
npm run dev

CLI Commands

# Generate example configuration
npm run start -- generate-config

# Validate configuration
npm run start -- validate-config --config myconfig.json

API Examples

List API Endpoints

{
  "tool": "list_api_endpoints",
  "arguments": {
    "filter": "firewall",
    "category": "security",
    "limit": 10
  }
}

Get Endpoint Schema

{
  "tool": "get_api_endpoint_schema",
  "arguments": {
    "endpoint": "/ip/firewall/filter"
  }
}

Invoke API Endpoint

{
  "tool": "invoke_api_endpoint",
  "arguments": {
    "endpoint": "/ip/firewall/filter/add",
    "parameters": {
      "chain": "input",
      "action": "accept",
      "protocol": "tcp",
      "dst-port": "22",
      "comment": "Allow SSH"
    }
  }
}

Resources

System Information

  • routeros://system/info - Complete system information
  • routeros://system/info/hardware - Hardware specifications
  • routeros://system/info/license - License details

Configuration State

  • routeros://config/state - Current configuration state
  • routeros://config/state/firewall - Firewall rules and connections
  • routeros://config/state/interfaces - Interface status

Documentation

  • routeros://docs/commands/firewall - Firewall command reference
  • routeros://docs/bestpractices/security - Security hardening guide
  • routeros://docs/troubleshooting/connectivity - Connectivity troubleshooting

Development

Project Structure

src/
├── config/           # Configuration management
├── routeros/         # RouterOS client and connection
├── discovery/        # Command discovery service
├── schemas/          # Schema generation
├── tools/            # MCP tool implementations
├── resources/        # Static resource providers
├── utils/            # Utilities and helpers
└── types/            # TypeScript type definitions

Running Tests

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Watch mode
npm run test:watch

Code Quality

# Lint code
npm run lint

# Fix linting issues
npm run lint:fix

# Format code
npm run format

# Type checking
npm run typecheck

Architecture

Connection Management

  • Connection pooling with configurable min/max connections
  • Automatic reconnection with exponential backoff
  • Keep-alive to maintain persistent connections
  • Support for both traditional API (8728/8729) and REST API

Command Discovery

  • Recursive discovery using /console/inspect
  • Builds hierarchical command tree
  • Caches discovered commands with TTL
  • Version-aware cache invalidation

Schema Generation

  • Analyzes RouterOS command output
  • Generates JSON Schema for validation
  • Creates Zod schemas for runtime validation
  • Produces TypeScript interfaces

Caching Strategy

  • In-memory cache for hot data
  • Disk persistence for command discovery
  • Configurable TTL per resource type
  • Automatic cache invalidation

Performance

  • Connection pooling reduces latency by 70%
  • Command discovery caching improves response time by 95%
  • Rate limiting prevents API overload
  • Efficient streaming for large datasets

Security

  • Supports SSL/TLS connections
  • Credentials stored in environment variables
  • Input validation on all parameters
  • Rate limiting to prevent abuse

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see LICENSE file for details

Support

  • Create an issue for bug reports or feature requests
  • Check the documentation resources for troubleshooting
  • Review example configurations in the examples/ directory