Skip to content

Repository files navigation

Kaspersky Security Center (KSC) MCP Server

This is a Model Context Protocol (MCP) server that exposes the Kaspersky Security Center Web API as tools for LLMs.

Features

  • Async Architecture: Uses anyio to wrap the synchronous KlAkOAPI library.
  • Tools:
    • ksc_ping: Check connection.
    • ksc_list_hosts: Find managed devices.
    • ksc_get_host_details: Get device info.
    • ksc_list_tasks: Enum tasks.
    • ksc_run_task: Execute tasks.
    • ksc_get_task_state: Check task status.

Installation

Prerequisites

  • Python 3.12+
  • uv (recommended)
  • KSC Server Credentials
  • KlAkOAPI 15.1 package (included in packages/)

Setup

  1. Clone the repository.
  2. Create a .env file in the root directory:
    KSC_HOST=https://your-ksc-server.com:13299
    KSC_USERNAME=your_username
    KSC_PASSWORD=your_password
    KSC_VERIFY_SSL=false
  3. Install dependencies:
    uv sync

Usage

Running the Server

uv run ksc-mcp

Or directly:

uv run app/main.py

Using with Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "ksc": {
      "command": "uv",
      "args": [
        "--directory",
        "C:\\path\\to\\ksc-mcp",
        "run",
        "ksc-mcp"
      ],
      "env": {
        "KSC_HOST": "https://your-ksc-server:13299",
        "KSC_USERNAME": "user",
        "KSC_PASSWORD": "password",
        "KSC_VERIFY_SSL": "false"
      }
    }
  }
}

Using with Claude Code

To add this server to the claude CLI:

claude mcp add ksc -- uv --directory C:\path\to\ksc-mcp run ksc-mcp

Note: Ensure environment variables are set in your shell or the .env file is present in the working directory.

Using with Other Tools (Cursor/Windsurf in Agent Mode)

For tools that support MCP via command configuration:

Command: uv Arguments:

  • --directory
  • C:\path\to\ksc-mcp
  • run
  • ksc-mcp

Development Workflow

This project uses uv for dependency management and ruff for linting.

Common Commands

  • Install Dependencies: uv sync
    • Note: This only installs packages. It does not run tests or linters.
  • Run Server: uv run ksc-mcp (or make dev)
  • Run Tests: uv run pytest (or make test)
  • Lint & Fix: uv run ruff check --fix . (or make lint)
  • Format Code: uv run ruff format . (or make format)

Makefile

For convenience, a Makefile is included:

make install
make dev
make test
make lint    # Runs ruff check
make format  # Runs ruff format

Project Structure (Refactored)

  • src/server/main.py: Entry point with tool auto-discovery.
  • src/server/models.py: Pydantic models for strict schemas.
  • src/server/ksc/: Core service logic (KscService) wrapping KlAkOAPI.
  • src/server/tools/: Modular tool implementations (hosts.py, tasks.py).
  • tests/: pytest suite.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages