Skip to main content

A Python package for MCP (Model Context Protocol) integration with Pkl configuration language

Project description

pkl-mcp

CI PyPI version Python versions License: MIT Code style: ruff

A Python package for MCP (Model Context Protocol) integration with Pkl configuration language.

Features

  • ๐Ÿš€ Modern Python: Built with Python 3.9+ support
  • ๐Ÿ”ง Type Safe: Full type hints and mypy compatibility
  • ๐Ÿงช Well Tested: Comprehensive test suite with coverage reporting
  • ๐Ÿ“ฆ Easy Installation: Available on PyPI
  • ๐Ÿ› ๏ธ Developer Friendly: Pre-commit hooks and automated formatting
  • ๐Ÿ”„ CI/CD Ready: GitHub Actions workflows included

Installation

From PyPI (Recommended)

pip install pkl-mcp

From Source

git clone https://github.com/username/pkl-mcp.git
cd pkl-mcp
pip install -e .

Quick Start

Basic Usage

from pkl_mcp import hello_world

# Simple greeting
message = hello_world()
print(message)  # Output: Hello, World!

# Custom greeting
message = hello_world("Python Developer")
print(message)  # Output: Hello, Python Developer!

Command Line Interface

The package also provides a command-line interface:

# Run the main function
pkl-mcp

# Or use python -m
python -m pkl_mcp.main

API Documentation

hello_world(name: str = "World") -> str

Returns a greeting message.

Parameters:

  • name (str, optional): The name to greet. Defaults to "World".

Returns:

  • str: A greeting message string.

Example:

>>> from pkl_mcp import hello_world
>>> hello_world()
'Hello, World!'
>>> hello_world("Python")
'Hello, Python!'

Development

This project uses modern Python development tools and practices.

Prerequisites

  • Python 3.9 or higher
  • uv for dependency management
  • Git for version control
  • GitHub CLI for repository operations (optional)

Development Setup

  1. Clone the repository:

    git clone https://github.com/username/pkl-mcp.git
    cd pkl-mcp
    
  2. Set up the development environment:

    # Create virtual environment and install dependencies
    uv sync --dev
    
    # Activate the virtual environment (if needed)
    source .venv/bin/activate  # On macOS/Linux
    # .venv\Scripts\activate   # On Windows
    
  3. Install pre-commit hooks:

    uv run pre-commit install
    

Development Workflow

Running Tests

# Run all tests
uv run pytest

# Run tests with coverage
uv run pytest --cov=pkl_mcp

# Run tests in watch mode (for development)
uv run pytest --watch

Code Quality

# Format code
uv run ruff format .

# Lint code
uv run ruff check .

# Fix linting issues automatically
uv run ruff check . --fix

# Type checking
uv run mypy .

Local Build Validation

Before pushing changes, run the complete validation pipeline:

# Run the local build script (must pass before pushing)
uv run ./scripts/local-build.sh

This script runs:

  • Dependency synchronization
  • Code formatting and linting
  • Type checking
  • Complete test suite with coverage
  • Package building
  • Final validation

Building the Package

# Build distribution packages
uv run python -m build

# Check the built packages
uv run twine check dist/*

Project Structure

pkl-mcp/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ pkl_mcp/           # Main package
โ”‚       โ”œโ”€โ”€ __init__.py    # Package initialization
โ”‚       โ””โ”€โ”€ main.py        # Core functionality
โ”œโ”€โ”€ tests/                 # Test suite
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ test_main.py
โ”œโ”€โ”€ scripts/               # Build and utility scripts
โ”‚   โ””โ”€โ”€ local-build.sh     # Local validation script
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/         # GitHub Actions
โ”‚       โ”œโ”€โ”€ ci.yml         # Continuous Integration
โ”‚       โ””โ”€โ”€ publish.yml    # PyPI Publishing
โ”œโ”€โ”€ docs/                  # Documentation
โ”œโ”€โ”€ pyproject.toml         # Project configuration
โ”œโ”€โ”€ README.md              # This file
โ”œโ”€โ”€ LICENSE                # MIT License
โ”œโ”€โ”€ .gitignore             # Git ignore rules
โ””โ”€โ”€ .pre-commit-config.yaml # Pre-commit hooks

Configuration

The project uses pyproject.toml for all configuration:

  • Build system: Hatchling
  • Dependencies: Managed by uv
  • Code formatting: Ruff
  • Linting: Ruff
  • Type checking: MyPy
  • Testing: Pytest with coverage
  • Pre-commit hooks: Automated quality checks

Contributing

  1. Fork the repository on GitHub
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and add tests
  4. Run the local build: uv run ./scripts/local-build.sh
  5. Commit your changes: git commit -am 'Add some feature'
  6. Push to the branch: git push origin feature-name
  7. Create a Pull Request on GitHub

Code Style

This project follows these conventions:

  • PEP 8 compliance via Ruff
  • Type hints for all public APIs
  • Docstrings for all public functions and classes
  • Test coverage of 90% or higher
  • Pre-commit hooks for automated quality checks

Release Process

Releases are automated through GitHub Actions:

  1. Create a new tag: git tag v1.0.0
  2. Push the tag: git push origin v1.0.0
  3. GitHub Actions will automatically:
    • Run the full test suite
    • Build the package
    • Publish to PyPI
    • Create a GitHub release

Requirements

  • Python 3.9+
  • No runtime dependencies (currently)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

[0.1.0] - 2024-01-01

  • Initial release
  • Basic hello_world functionality
  • Complete development workflow setup
  • CI/CD automation
  • PyPI publishing

Support

Acknowledgments

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

pkl_mcp-0.1.3.tar.gz (83.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pkl_mcp-0.1.3-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file pkl_mcp-0.1.3.tar.gz.

File metadata

  • Download URL: pkl_mcp-0.1.3.tar.gz
  • Upload date:
  • Size: 83.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pkl_mcp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c58f988c259710947b74d332881e656abdfe42432653ffe91f615a6891ab0227
MD5 4c97c6adf74e3a45243eccd3b12dbd68
BLAKE2b-256 5781ab79b746d7d715ee8ae20c88cff13348a035ed5219ecfc1ac96a236c2598

See more details on using hashes here.

File details

Details for the file pkl_mcp-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pkl_mcp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pkl_mcp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0c8c57640a503352609cad05d5e837c68615aed7cd1d2e948aeb7008c689556d
MD5 23a3630b16af49b08a0eccb5203a37c7
BLAKE2b-256 a693106a9ac2d2b86aad56b44b3a800ac39784da02f9985ea9af5ba66116678b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page