Arclio-rules mcp-server created using fastmcp ๐
Project description
Arclio Rules ๐
Arclio Rules is a FastAPI-based service that implements rule processing using the FastMCP framework. It provides a robust and efficient system for managing and executing business rules in a microservices architecture.
Overview
Arclio Rules is built with Python 3.12+ and leverages modern async capabilities to provide high-performance rule processing. The service can be run either with session management or in a stateless mode using standard I/O.
Features
- FastAPI-based REST API
- Built on FastMCP framework for efficient rule processing
- Elasticsearch integration for rule storage and querying
- Git integration for version control of rules
- Support for both session-based and stateless operation modes
- Frontmatter parsing capabilities
- Comprehensive logging with Loguru
- UV package management for fast, reliable dependency handling
- Make-based workflow automation
Prerequisites
- Python 3.12.8 or higher
- UV package manager
- Docker (optional, for containerized deployment)
- Age (for secrets management)
Installation
- Clone the repository:
git clone https://github.com/fisseha-estifanos/arclio-rules.git
cd arclio-rules
- Install dependencies using UV:
make install
This will:
- Install project dependencies using UV
- Set up the development environment
- Sync all dependencies
Environment Setup
- Initialize SOPS for secret management:
make init-key
- Create your environment file:
# Copy the example environment file
cp .env.example .env
# Decrypt existing secrets (if you have access)
make decrypt
Required Environment Variables:
# GitHub API Configuration
GITHUB_TOKEN="add your GH PAT here"
GITHUB_ORG="add your GH Organization here"
REPO_NAME="add your repo that holds the rules here"
Default Environmental Variables (No need to modify):
# Server Configuration
PORT=8000 # Application port
HOST=0.0.0.0 # Host to bind to
# Additional Settings
LOG_LEVEL=INFO # Logging level (DEBUG, INFO, WARNING, ERROR)
ENVIRONMENT=development # Application environment
Usage
The service can be run in two modes:
Stateless Mode (using stdio)
source .env
arclio-rules
Development Mode
make run-dev
Development Commands
The project includes a comprehensive Makefile for common development tasks:
# Development
make run-dev # Run development server
make install # Install dependencies
make build # Build the project
make publish # Publish the project to pypi
# Code Quality
make lint # Run Ruff linter
make type-check # Run Pyright type checker
make format # Format code with Ruff
make pre-commit # Run all code quality checks
# Secrets Management
make init-key # Generate new age key for SOPS
make encrypt # Encrypt .env to .env.sops
make decrypt # Decrypt .env.sops to .env
make add-recipient # Add new public key (make add-recipient KEY=age1...)
Project Structure
arclio-rules/ โโโ .github/ โ โโโ workflows/ โ โโโ linting-and-pyright.yml โโโ .gitignore โโโ LICENSE โโโ Makefile โโโ README.md โโโ pyproject.toml โโโ pyrightconfig.json โโโ src/ โ โโโ arclio_rules/ โ โโโ init.py โ โโโ main.py โ โโโ datamodels/ โ โ โโโ client_schema.py โ โ โโโ rule_schema.py โ โโโ inhouse_rules/ โ โ โโโ example_rule.py โ โโโ main.py โ โโโ routes/ โ โ โโโ rules.py โ โโโ services/ โ โโโ rule_indexing_service.py โ โโโ rule_resolution_service.py โ โโโ rule_storage_service.py โโโ tests/ โโโ .env.example
Configuration
The project uses various configuration files:
pyproject.toml: Project metadata and dependenciespyrightconfig.json: Python type checking configuration.sops.yaml: Secrets management configurationdocker-compose.yml: Container orchestration settings.env: Environment variables (created from .env.example)
Development
Package Management with UV
The project uses UV for dependency management, offering:
- Faster package installation
- Reliable dependency resolution
- Consistent environments across development and production
- Integration with virtual environments
Code Quality Tools
The project uses several tools to maintain code quality:
- Ruff: For linting and formatting
- Enforces PEP 8 style guide
- Manages import sorting
- Checks docstring formatting (Google style)
- MyPy: For static type checking
- Pytest: For testing (with async support)
Linting Rules
The project enforces specific linting rules through Ruff, including:
- PEP 8 compliance (E)
- PyFlakes checks (F)
- Import sorting (I)
- Docstring formatting (D)
Dependencies
Key dependencies include:
fastapi: Web frameworkfastmcp: MCP framework integrationelasticsearch: Search and storageaiohttp: Async HTTP clientpydantic: Data validationuvicorn: ASGI server
License
[Add your license information here]
Contributing
[Add contribution guidelines here]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file arclio_rules-0.4.3.tar.gz.
File metadata
- Download URL: arclio_rules-0.4.3.tar.gz
- Upload date:
- Size: 62.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e2791e2d47fd253c88a92dff8253875f5984205fc5988cdd152936bdcc88783
|
|
| MD5 |
aa647b4b2e8b78ca9994f52e87a23152
|
|
| BLAKE2b-256 |
751999f29e09bc5dcd50c6f9d8a7346db477f700aa6360fc4fb8ebbdb8108572
|
File details
Details for the file arclio_rules-0.4.3-py3-none-any.whl.
File metadata
- Download URL: arclio_rules-0.4.3-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1391da4c5ce28bf44900b127d9ffc6d6342154e65038eeb775454fefad05a3d
|
|
| MD5 |
7ce1b4c85374581f3dd568708ca60719
|
|
| BLAKE2b-256 |
95e35b41e43521f7542d916f686cc57f9ce6312842145760f609b5374f8a1df3
|