Skip to main content

Kasra Lite Attendance & Personnel MCP Server

PyPI Version Python Version MCP License: MIT

A Model Context Protocol (MCP) server for the Kasra Lite Attendance, Personnel, Cartable, and Leave Management System (app.kasralite.com).

Connect your AI agents (Claude Desktop, OpenCode, Cursor, Windsurf, etc.) directly to Kasra Lite to view attendance, punches, leaves, cardex, cartable requests, work periods, and submit leave/mission requests autonomously.

🚀 Published on PyPI & 100% Pure HTTP / Async API — No Headless Browser Required! Runs via standard HTTP/2 APIs and AES-128-CBC encryption without downloading Chromium or running Playwright/Puppeteer. Automatically detects and routes Iranian enterprise traffic even when a foreign VPN (like Surfshark/v2ray) is active. Works on Linux, Docker, macOS, and Windows.


⚡ Quick Start (Zero-Install with uvx)

You don't need to clone this repository or install Python dependencies manually. Just configure your agent:

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "kasra": {
      "command": "uvx",
      "args": ["kasra-mcp-server@latest"],
      "env": {
        "KASRA_BASE_URL": "https://app.kasralite.com",
        "KASRA_USERNAME": "your_username",
        "KASRA_PASSWORD": "your_password"
      }
    }
  }
}

OpenCode (~/.config/opencode/opencode.jsonc or opencode.json)

{
  "mcp": {
    "kasra": {
      "type": "local",
      "command": [
        "uvx",
        "kasra-mcp-server@latest"
      ],
      "environment": {
        "KASRA_BASE_URL": "https://app.kasralite.com",
        "KASRA_USERNAME": "your_username",
        "KASRA_PASSWORD": "your_password"
      },
      "enabled": true
    }
  }
}

Cursor (.cursor/mcp.json)

{
  "mcpServers": {
    "kasra": {
      "command": "uvx kasra-mcp-server@latest",
      "env": {
        "KASRA_BASE_URL": "https://app.kasralite.com",
        "KASRA_USERNAME": "your_username",
        "KASRA_PASSWORD": "your_password"
      }
    }
  }
}

📦 Traditional Installation (pip)

pip install kasra-mcp-server

Then configure your agent using kasra-mcp-server:

{
  "mcpServers": {
    "kasra": {
      "command": "kasra-mcp-server",
      "env": {
        "KASRA_BASE_URL": "https://app.kasralite.com",
        "KASRA_USERNAME": "your_username",
        "KASRA_PASSWORD": "your_password"
      }
    }
  }
}

Option C: From Local Source

git clone https://github.com/razavioo/kasra-mcp-server.git
cd kasra-mcp-server
pip install -r requirements.txt
{
  "mcpServers": {
    "kasra": {
      "command": "python3",
      "args": [
        "/path/to/kasra-mcp-server/main.py"
      ],
      "env": {
        "KASRA_BASE_URL": "https://app.kasralite.com",
        "KASRA_USERNAME": "your_username",
        "KASRA_PASSWORD": "your_password"
      }
    }
  }
}

🧪 Testing

Test all tools directly in python:

python3 test_tools.py

📄 License

This project is licensed under the MIT License.

Manager and personal tools

Six managerial tools and four isolated self-service tools extend the same FastMCP server:

Tool Behavior
kasra_manager_get_profile Verify the authenticated account's identity
kasra_manager_get_monthly_report All accessible employees; page/search; preserve source time/day units
kasra_manager_get_cartable Pending/approved/rejected requests; document ID and stable version fingerprint
kasra_manager_get_daily_report Selected employee and Jalali date; verify returned employee code
kasra_manager_get_sync_snapshot Complete current monthly report and all cartables; fail if any page fails
kasra_manager_decide_request One explicitly human-authorized decision; fresh version check, durable duplicate protection, readback

| kasra_personal_get_profile | Verify a separately connected personal account before the user confirms linking | | kasra_personal_get_workspace | Own cardex balance, work metrics, periods, reports, requests and permitted credit types | | kasra_personal_get_period_report | Own attendance and requests for a verified Kasra period | | kasra_personal_submit_request | One reviewed personal request; stable UUID, durable claim, business acknowledgement, no automatic resend |

The 18 existing tools keep their schemas and local stdio behavior. Private HTTP blocks the legacy submit and delete tools. The personal submission tool requires explicit confirmation and uses a durable submission ID.

Local agent connection (stdio)

Python 3.11+ is required. Create an isolated environment and install this directory:

python3 -m venv .venv
.venv/bin/pip install -r requirements.lock
.venv/bin/pip install --no-deps .

Provide KASRA_USERNAME and KASRA_PASSWORD through the agent's secure environment. Do not put credentials in prompts or a tracked config file. Add an MCP server using the environment's kasra-mcp-server command. A host that supports mcpServers can use:

{
  "mcpServers": {
    "kasra": {
      "command": "/absolute/path/to/.venv/bin/kasra-mcp-server"
    }
  }
}

Read access is the default. Set KASRA_ENABLE_DECISIONS=true only for the authorized manager. Each decision still requires confirmed=true after the human reviews the specific document, action, and fingerprint. A model-supplied boolean is an expression of the host's authorization, not an independent proof of human consent; the agent host must enforce its approval policy.

Examples:

  • Monthly: {"page":{"limit":25,"offset":0,"search":"00123"}}.
  • Requests: {"page":{"limit":25},"status":"pending"}.
  • Daily: {"personnel_code":"00123","jalali_date":"1405/07/01"}.

Private server connection (private Streamable HTTP)

Run the private service with KASRA_MCP_MODE=http. Set a random KASRA_MCP_TOKEN of at least 32 characters and a base64-encoded 32-byte KASRA_MCP_ENVELOPE_KEY. Clients send the bearer token and a short-lived AES-256-GCM account envelope in X-Kasra-Account.

The Compose service uses the existing Docker network named by KASRA_MCP_NETWORK and keeps the decision ledger in a named volume. Start it with docker compose -f compose.server.yml up -d --build. The service publishes no host port.

Verification

.venv/bin/pip install 'pytest>=8,<10' 'pytest-asyncio>=1,<2'
.venv/bin/python -m pytest -q

Tests use HTTP mocks and exercise the MCP protocol through stdio and private HTTP.

Metadata

Release files for kasra-mcp-server 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kasra-mcp-server 1.2.0
File Size Uploaded Provenance Actions
kasra_mcp_server-1.2.0.tar.gz 56.3 kB Without provenance Details for kasra_mcp_server-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kasra-mcp-server 1.2.0
File Interpreter ABI Platform Actions
kasra_mcp_server-1.2.0-py3-none-any.whl Python 3 none any Details for kasra_mcp_server-1.2.0-py3-none-any.whl

Total release size: 108.3 kB

Release files / kasra_mcp_server-1.2.0.tar.gz

Download URL kasra_mcp_server-1.2.0.tar.gz
Size 56.3 kB
Tags Source
SHA-256 checksum
How to use checksums
381e229bd7f1b76facd68b3d1a37a1d0be7d25be5691996f831c6f361e3f31b9
BLAKE2b-256 checksum
How to use checksums
1b1294c41e0d60f04df24f45cd5629e9f7ea502f21af97488c2aef930b1498a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / kasra_mcp_server-1.2.0-py3-none-any.whl

Download URL kasra_mcp_server-1.2.0-py3-none-any.whl
Size 52.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70e04cf4c9bb22c849c29e06ecab3bd175ac04f53100bdc96b30dcb0d0da2a0a
BLAKE2b-256 checksum
How to use checksums
19662093ed95da7e7dd29f74fabf05fb203f77593ad40d2f9e68e7d8873ac884
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Security for kasra-mcp-server 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page