pythonium


Namepythonium JSON
Version 0.1.5 PyPI version JSON
download
home_pageNone
SummaryA modular MCP (Model Context Protocol) server for AI agents with plugin-based architecture
upload_time2025-08-03 22:39:08
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords mcp model-context-protocol ai-agents plugin-framework server artificial-intelligence tools
VCS
bugtrack_url
requirements pydantic pydantic-settings pyyaml click rich loguru httpx beautifulsoup4 openai mcp langgraph orjson aiofiles
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pythonium

A modular Model Context Protocol (MCP) server designed to enable advanced capabilities for AI agents through a robust, extensible architecture built on the official MCP SDK.

## Overview

Pythonium provides a comprehensive, production-ready foundation for building sophisticated AI agent tools and capabilities. Built around the Model Context Protocol specification and leveraging the official MCP SDK (FastMCP), it offers a clean separation of concerns through its modular package structure and streamlined configuration management.

## Architecture

### Core Packages

- **`pythonium.common`** - Shared utilities, configuration management, and base components
- **`pythonium.core`** - Central server implementation, configuration, and tool management
- **`pythonium.tools`** - Comprehensive standard tool library with extensible framework
- **`pythonium.managers`** - Lightweight management systems for specialized functionality

## Features

### MCP SDK Integration
- Built on the official MCP SDK's FastMCP framework
- Full Model Context Protocol compliance
- Multiple transport support (stdio, HTTP, WebSocket)
- Native tool registration and capability negotiation

### Comprehensive Tool Library
- **System Operations**: Command execution, environment access, system monitoring (`pythonium.tools.std.execution`)
- **File Operations**: Advanced file and directory management (`pythonium.tools.std.file_ops`)
- **Web Operations**: HTTP client, web search with multiple engines (`pythonium.tools.std.web`)
- **Tool Management**: Meta-tools for tool discovery and introspection (`pythonium.tools.std.tool_ops`)

### Advanced Configuration
- Pydantic-based configuration with validation
- Environment variable integration
- Multiple format support (YAML, JSON, TOML)
- Hot-reload capability and override support

### Production Features
- Structured logging with multiple output formats
- Comprehensive error handling and recovery
- Resource management and connection pooling
- Security considerations and rate limiting
- Performance optimizations with async architecture

## Quick Start

### Installation

```bash
# Clone the repository
git clone https://github.com/dwharve/pythonium.git
cd pythonium

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install in development mode
pip install -e .
```

### Basic Usage

```bash
# Run the MCP server
python -m pythonium --help

# Start with default configuration (stdio transport)
python -m pythonium serve

# Start with HTTP transport
python -m pythonium serve --transport http --host localhost --port 8080

# Start with WebSocket transport
python -m pythonium serve --transport websocket --host localhost --port 8080

# Start with custom configuration file
python -m pythonium serve --config config/server.yaml

# Alternative: Use installed script
pythonium --help
pythonium serve
```

## Development

### Setup Development Environment

```bash
# Install development dependencies
pip install -r requirements-dev.txt

# Install pre-commit hooks
pre-commit install

# Run tests
pytest

# Run tests with coverage
pytest --cov=pythonium --cov-report=html

# Format code
black pythonium tests
isort pythonium tests

# Type checking
mypy pythonium
```

### Project Structure

```
pythonium/
├── pythonium/           # Main package
│   ├── common/         # Shared utilities and base components
│   │   ├── config.py   # Pydantic configuration management
│   │   ├── base.py     # Base classes and result types
│   │   ├── logging.py  # Structured logging system
│   │   └── ...         # HTTP client, error handling, etc.
│   ├── core/           # Core server and management
│   │   ├── server.py   # Main MCP server implementation
│   │   ├── config.py   # Configuration manager
│   │   └── tools/      # Tool registry and discovery
│   ├── tools/          # Tool implementations
│   │   ├── base.py     # Base tool framework
│   │   └── std/        # Standard tool library
│   ├── managers/       # Specialized managers
│   ├── main.py         # CLI entry point
│   └── __main__.py     # Module entry point
├── tests/              # Comprehensive test suite (335 tests)
├── docs/               # Documentation
├── config/             # Configuration examples
└── requirements.txt    # Dependencies
```

### Testing

The project uses pytest for testing with comprehensive coverage across all components:

- **Unit Tests**: Individual component testing 
- **Integration Tests**: Cross-component interaction testing  
- **Core Tests**: Configuration, server, and tool management
- **End-to-End Tests**: Full MCP server functionality
- **Performance Tests**: Load testing and benchmarks

**Current Status**: Comprehensive test coverage across all modules ensuring reliability and maintainability.

```bash
# Run all tests
pytest

# Run with coverage reporting
pytest --cov=pythonium --cov-report=html

# Run specific test categories
pytest tests/core/         # Core functionality tests
pytest tests/tools/        # Tool implementation tests
pytest tests/common/       # Common utilities tests

# Quick test run
pytest -q

# Verbose test output
pytest -v
```

## Configuration

Pythonium uses Pydantic-based configuration with support for multiple formats (YAML, JSON, TOML) and environment variable integration:

```yaml
# config/server.yaml
server:
  name: "Pythonium MCP Server"
  description: "A modular MCP server for AI agents"
  host: "localhost"
  port: 8080
  transport: "stdio"  # stdio, http, websocket

tools:
  # Tool discovery and loading configuration
  auto_discover: true
  categories:
    - "system"
    - "web"
    - "file_operations"

logging:
  level: "INFO"           # DEBUG, INFO, WARNING, ERROR
  format: "structured"    # structured, plain
  output: "console"       # console, file

security:
  authentication: "none"  # none, api_key
  rate_limit:
    enabled: false
    requests_per_minute: 60
```

## Tool Development

### Creating a Custom Tool

```python
from pythonium.tools.base import BaseTool, ToolMetadata, ToolParameter, ParameterType
from pythonium.common.base import Result
from pythonium.common.parameters import validate_parameters

class MyCustomTool(BaseTool):
    """A custom tool example with proper parameter validation."""
    
    @property
    def metadata(self) -> ToolMetadata:
        return ToolMetadata(
            name="my_custom_tool",
            description="A custom tool example that demonstrates the framework",
            brief_description="Custom tool example",
            category="custom",
            tags=["example", "custom"],
            parameters=[
                ToolParameter(
                    name="message",
                    type=ParameterType.STRING,
                    description="Message to process",
                    required=True,
                    min_length=1,
                    max_length=1000
                )
            ]
        )
    
    @validate_parameters  # Automatic parameter validation
    async def execute(self, message: str, context: ToolContext) -> Result:
        """Execute the tool with validated parameters."""
        try:
            result = f"Processed: {message}"
            return Result.success_result(
                data={"result": result, "original": message},
                metadata={"tool": "my_custom_tool"}
            )
        except Exception as e:
            return Result.error_result(f"Tool execution failed: {e}")
```

### Tool Registration

Tools are automatically discovered and registered when placed in the appropriate package structure. The tool discovery system handles:

- Automatic tool detection and registration
- Parameter validation and schema generation
- Error handling and logging
- Integration with the MCP protocol

## Contributing

We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.

For a detailed history of changes, see [CHANGELOG.md](CHANGELOG.md).

### Development Workflow

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Ensure all tests pass
6. Submit a pull request

### Code Standards

- Follow PEP 8 style guidelines
- Use type hints throughout the codebase
- Maintain comprehensive test coverage
- Document all public APIs with detailed docstrings
- Use conventional commit messages
- Leverage Pydantic for data validation and configuration
- Implement proper async/await patterns for I/O operations

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Support

- **Documentation**: Available in the `docs/` directory
- **Issues**: [GitHub Issues](https://github.com/dwharve/pythonium/issues)
- **Discussions**: [GitHub Discussions](https://github.com/dwharve/pythonium/discussions)

## Acknowledgments

- Official Model Context Protocol SDK and specification
- The open-source Python community
- Pydantic and FastAPI ecosystems for configuration and validation patterns
- Contributors and maintainers

---

**Status**: Production-ready Beta - Core functionality stable, comprehensive test coverage, active development

**Current Version**: 0.1.5  
**Last Updated**: July 6, 2025  
**Maintainer**: David Harvey

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pythonium",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "mcp, model-context-protocol, ai-agents, plugin-framework, server, artificial-intelligence, tools",
    "author": null,
    "author_email": "David Harvey <dwh.exis@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/50/7f/2ce42ddf85b5e20192e6a14ffc959ff3c1c689208b00637c021aefd93c40/pythonium-0.1.5.tar.gz",
    "platform": null,
    "description": "# Pythonium\n\nA modular Model Context Protocol (MCP) server designed to enable advanced capabilities for AI agents through a robust, extensible architecture built on the official MCP SDK.\n\n## Overview\n\nPythonium provides a comprehensive, production-ready foundation for building sophisticated AI agent tools and capabilities. Built around the Model Context Protocol specification and leveraging the official MCP SDK (FastMCP), it offers a clean separation of concerns through its modular package structure and streamlined configuration management.\n\n## Architecture\n\n### Core Packages\n\n- **`pythonium.common`** - Shared utilities, configuration management, and base components\n- **`pythonium.core`** - Central server implementation, configuration, and tool management\n- **`pythonium.tools`** - Comprehensive standard tool library with extensible framework\n- **`pythonium.managers`** - Lightweight management systems for specialized functionality\n\n## Features\n\n### MCP SDK Integration\n- Built on the official MCP SDK's FastMCP framework\n- Full Model Context Protocol compliance\n- Multiple transport support (stdio, HTTP, WebSocket)\n- Native tool registration and capability negotiation\n\n### Comprehensive Tool Library\n- **System Operations**: Command execution, environment access, system monitoring (`pythonium.tools.std.execution`)\n- **File Operations**: Advanced file and directory management (`pythonium.tools.std.file_ops`)\n- **Web Operations**: HTTP client, web search with multiple engines (`pythonium.tools.std.web`)\n- **Tool Management**: Meta-tools for tool discovery and introspection (`pythonium.tools.std.tool_ops`)\n\n### Advanced Configuration\n- Pydantic-based configuration with validation\n- Environment variable integration\n- Multiple format support (YAML, JSON, TOML)\n- Hot-reload capability and override support\n\n### Production Features\n- Structured logging with multiple output formats\n- Comprehensive error handling and recovery\n- Resource management and connection pooling\n- Security considerations and rate limiting\n- Performance optimizations with async architecture\n\n## Quick Start\n\n### Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/dwharve/pythonium.git\ncd pythonium\n\n# Create and activate virtual environment\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n\n# Install dependencies\npip install -r requirements.txt\n\n# Install in development mode\npip install -e .\n```\n\n### Basic Usage\n\n```bash\n# Run the MCP server\npython -m pythonium --help\n\n# Start with default configuration (stdio transport)\npython -m pythonium serve\n\n# Start with HTTP transport\npython -m pythonium serve --transport http --host localhost --port 8080\n\n# Start with WebSocket transport\npython -m pythonium serve --transport websocket --host localhost --port 8080\n\n# Start with custom configuration file\npython -m pythonium serve --config config/server.yaml\n\n# Alternative: Use installed script\npythonium --help\npythonium serve\n```\n\n## Development\n\n### Setup Development Environment\n\n```bash\n# Install development dependencies\npip install -r requirements-dev.txt\n\n# Install pre-commit hooks\npre-commit install\n\n# Run tests\npytest\n\n# Run tests with coverage\npytest --cov=pythonium --cov-report=html\n\n# Format code\nblack pythonium tests\nisort pythonium tests\n\n# Type checking\nmypy pythonium\n```\n\n### Project Structure\n\n```\npythonium/\n\u251c\u2500\u2500 pythonium/           # Main package\n\u2502   \u251c\u2500\u2500 common/         # Shared utilities and base components\n\u2502   \u2502   \u251c\u2500\u2500 config.py   # Pydantic configuration management\n\u2502   \u2502   \u251c\u2500\u2500 base.py     # Base classes and result types\n\u2502   \u2502   \u251c\u2500\u2500 logging.py  # Structured logging system\n\u2502   \u2502   \u2514\u2500\u2500 ...         # HTTP client, error handling, etc.\n\u2502   \u251c\u2500\u2500 core/           # Core server and management\n\u2502   \u2502   \u251c\u2500\u2500 server.py   # Main MCP server implementation\n\u2502   \u2502   \u251c\u2500\u2500 config.py   # Configuration manager\n\u2502   \u2502   \u2514\u2500\u2500 tools/      # Tool registry and discovery\n\u2502   \u251c\u2500\u2500 tools/          # Tool implementations\n\u2502   \u2502   \u251c\u2500\u2500 base.py     # Base tool framework\n\u2502   \u2502   \u2514\u2500\u2500 std/        # Standard tool library\n\u2502   \u251c\u2500\u2500 managers/       # Specialized managers\n\u2502   \u251c\u2500\u2500 main.py         # CLI entry point\n\u2502   \u2514\u2500\u2500 __main__.py     # Module entry point\n\u251c\u2500\u2500 tests/              # Comprehensive test suite (335 tests)\n\u251c\u2500\u2500 docs/               # Documentation\n\u251c\u2500\u2500 config/             # Configuration examples\n\u2514\u2500\u2500 requirements.txt    # Dependencies\n```\n\n### Testing\n\nThe project uses pytest for testing with comprehensive coverage across all components:\n\n- **Unit Tests**: Individual component testing \n- **Integration Tests**: Cross-component interaction testing  \n- **Core Tests**: Configuration, server, and tool management\n- **End-to-End Tests**: Full MCP server functionality\n- **Performance Tests**: Load testing and benchmarks\n\n**Current Status**: Comprehensive test coverage across all modules ensuring reliability and maintainability.\n\n```bash\n# Run all tests\npytest\n\n# Run with coverage reporting\npytest --cov=pythonium --cov-report=html\n\n# Run specific test categories\npytest tests/core/         # Core functionality tests\npytest tests/tools/        # Tool implementation tests\npytest tests/common/       # Common utilities tests\n\n# Quick test run\npytest -q\n\n# Verbose test output\npytest -v\n```\n\n## Configuration\n\nPythonium uses Pydantic-based configuration with support for multiple formats (YAML, JSON, TOML) and environment variable integration:\n\n```yaml\n# config/server.yaml\nserver:\n  name: \"Pythonium MCP Server\"\n  description: \"A modular MCP server for AI agents\"\n  host: \"localhost\"\n  port: 8080\n  transport: \"stdio\"  # stdio, http, websocket\n\ntools:\n  # Tool discovery and loading configuration\n  auto_discover: true\n  categories:\n    - \"system\"\n    - \"web\"\n    - \"file_operations\"\n\nlogging:\n  level: \"INFO\"           # DEBUG, INFO, WARNING, ERROR\n  format: \"structured\"    # structured, plain\n  output: \"console\"       # console, file\n\nsecurity:\n  authentication: \"none\"  # none, api_key\n  rate_limit:\n    enabled: false\n    requests_per_minute: 60\n```\n\n## Tool Development\n\n### Creating a Custom Tool\n\n```python\nfrom pythonium.tools.base import BaseTool, ToolMetadata, ToolParameter, ParameterType\nfrom pythonium.common.base import Result\nfrom pythonium.common.parameters import validate_parameters\n\nclass MyCustomTool(BaseTool):\n    \"\"\"A custom tool example with proper parameter validation.\"\"\"\n    \n    @property\n    def metadata(self) -> ToolMetadata:\n        return ToolMetadata(\n            name=\"my_custom_tool\",\n            description=\"A custom tool example that demonstrates the framework\",\n            brief_description=\"Custom tool example\",\n            category=\"custom\",\n            tags=[\"example\", \"custom\"],\n            parameters=[\n                ToolParameter(\n                    name=\"message\",\n                    type=ParameterType.STRING,\n                    description=\"Message to process\",\n                    required=True,\n                    min_length=1,\n                    max_length=1000\n                )\n            ]\n        )\n    \n    @validate_parameters  # Automatic parameter validation\n    async def execute(self, message: str, context: ToolContext) -> Result:\n        \"\"\"Execute the tool with validated parameters.\"\"\"\n        try:\n            result = f\"Processed: {message}\"\n            return Result.success_result(\n                data={\"result\": result, \"original\": message},\n                metadata={\"tool\": \"my_custom_tool\"}\n            )\n        except Exception as e:\n            return Result.error_result(f\"Tool execution failed: {e}\")\n```\n\n### Tool Registration\n\nTools are automatically discovered and registered when placed in the appropriate package structure. The tool discovery system handles:\n\n- Automatic tool detection and registration\n- Parameter validation and schema generation\n- Error handling and logging\n- Integration with the MCP protocol\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.\n\nFor a detailed history of changes, see [CHANGELOG.md](CHANGELOG.md).\n\n### Development Workflow\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests for new functionality\n5. Ensure all tests pass\n6. Submit a pull request\n\n### Code Standards\n\n- Follow PEP 8 style guidelines\n- Use type hints throughout the codebase\n- Maintain comprehensive test coverage\n- Document all public APIs with detailed docstrings\n- Use conventional commit messages\n- Leverage Pydantic for data validation and configuration\n- Implement proper async/await patterns for I/O operations\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\n- **Documentation**: Available in the `docs/` directory\n- **Issues**: [GitHub Issues](https://github.com/dwharve/pythonium/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/dwharve/pythonium/discussions)\n\n## Acknowledgments\n\n- Official Model Context Protocol SDK and specification\n- The open-source Python community\n- Pydantic and FastAPI ecosystems for configuration and validation patterns\n- Contributors and maintainers\n\n---\n\n**Status**: Production-ready Beta - Core functionality stable, comprehensive test coverage, active development\n\n**Current Version**: 0.1.5  \n**Last Updated**: July 6, 2025  \n**Maintainer**: David Harvey\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A modular MCP (Model Context Protocol) server for AI agents with plugin-based architecture",
    "version": "0.1.5",
    "project_urls": {
        "Bug Reports": "https://github.com/dwharve/pythonium/issues",
        "Documentation": "https://pythonium.readthedocs.io/",
        "Homepage": "https://github.com/dwharve/pythonium",
        "Source": "https://github.com/dwharve/pythonium"
    },
    "split_keywords": [
        "mcp",
        " model-context-protocol",
        " ai-agents",
        " plugin-framework",
        " server",
        " artificial-intelligence",
        " tools"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5719e05e3270925a1ebb4364caea4d855620eacf80f0b9c222a3dd53b621fcc1",
                "md5": "dadf4026ae4308aefec806262319d6de",
                "sha256": "d4d0488f961b1822b1aced5402ccf64eda89bfb8c29742fae9a1e202a726381c"
            },
            "downloads": -1,
            "filename": "pythonium-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dadf4026ae4308aefec806262319d6de",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 91293,
            "upload_time": "2025-08-03T22:39:07",
            "upload_time_iso_8601": "2025-08-03T22:39:07.151698Z",
            "url": "https://files.pythonhosted.org/packages/57/19/e05e3270925a1ebb4364caea4d855620eacf80f0b9c222a3dd53b621fcc1/pythonium-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "507f2ce42ddf85b5e20192e6a14ffc959ff3c1c689208b00637c021aefd93c40",
                "md5": "60f4dafc73ccacbcaf1f2674effb9669",
                "sha256": "c7360cfaa7332af4321b99a9e40f7eefa17670d04607b7c4983f3a47f1fc3677"
            },
            "downloads": -1,
            "filename": "pythonium-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "60f4dafc73ccacbcaf1f2674effb9669",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 86451,
            "upload_time": "2025-08-03T22:39:08",
            "upload_time_iso_8601": "2025-08-03T22:39:08.965337Z",
            "url": "https://files.pythonhosted.org/packages/50/7f/2ce42ddf85b5e20192e6a14ffc959ff3c1c689208b00637c021aefd93c40/pythonium-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-03 22:39:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dwharve",
    "github_project": "pythonium",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pydantic",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "pydantic-settings",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "pyyaml",
            "specs": [
                [
                    ">=",
                    "6.0"
                ]
            ]
        },
        {
            "name": "click",
            "specs": [
                [
                    ">=",
                    "8.0.0"
                ]
            ]
        },
        {
            "name": "rich",
            "specs": [
                [
                    ">=",
                    "13.0.0"
                ]
            ]
        },
        {
            "name": "loguru",
            "specs": [
                [
                    ">=",
                    "0.7.0"
                ]
            ]
        },
        {
            "name": "httpx",
            "specs": [
                [
                    ">=",
                    "0.24.0"
                ]
            ]
        },
        {
            "name": "beautifulsoup4",
            "specs": [
                [
                    ">=",
                    "4.12.0"
                ]
            ]
        },
        {
            "name": "openai",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "mcp",
            "specs": [
                [
                    ">=",
                    "1.10.0"
                ]
            ]
        },
        {
            "name": "langgraph",
            "specs": [
                [
                    ">=",
                    "0.2.0"
                ]
            ]
        },
        {
            "name": "orjson",
            "specs": [
                [
                    ">=",
                    "3.9.0"
                ]
            ]
        },
        {
            "name": "aiofiles",
            "specs": [
                [
                    ">=",
                    "23.0.0"
                ]
            ]
        }
    ],
    "lcname": "pythonium"
}
        
Elapsed time: 1.81333s