Skip to main content

🚀 MCP framework that unlocks truly scalable AI systems with zero friction

Project description

Axiom MCP

Model Context Protocol (MCP) implementation for connecting AI systems with external data sources.

Installation

Using uv (recommended):

uv pip install axiom-mcp

Development Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/axiom-mcp.git
    cd axiom-mcp
    
  2. Install uv if you haven't already:

    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  3. Create and activate a virtual environment with uv:

    uv venv
    source .venv/bin/activate  # On Unix/Linux
    # or
    .venv\Scripts\activate  # On Windows
    
  4. Install development dependencies:

    uv pip install -e ".[dev]"
    

Core Features

1. Tool Definition

Tools in Axiom MCP are defined as classes that inherit from the Tool base class. Here's how to define a tool:

from axiom_mcp.tools.base import Tool, ToolMetadata, ToolValidation

# Define input schema for tool validation
number_input_schema = {
    "type": "object",
    "properties": {
        "a": {"type": "number", "description": "First number"},
        "b": {"type": "number", "description": "Second number"},
    },
    "required": ["a", "b"],
}

class AddTool(Tool):
    """Tool for adding two numbers."""
    metadata = ToolMetadata(
        name="add",
        description="Add two numbers together",
        validation=ToolValidation(input_schema=number_input_schema),
        author="MathServer",
        version="1.0.0",
    )

    async def execute(self, args: Dict[str, Any]) -> Dict[str, Any]:
        a, b = args["a"], args["b"]
        result = a + b
        return {
            "type": "text",
            "content": {"operation": "addition", "a": a, "b": b, "result": result},
        }

2. Logging Features

Axiom MCP provides built-in logging capabilities:

import logging
import sys

# Basic logging setup
logging.basicConfig(
    level=logging.INFO,
    format="%(levelname)s: %(message)s",
    stream=sys.stdout
)
logger = logging.getLogger(__name__)

# Usage in tools
logger.info("Operation started")
logger.debug("Debug information")
logger.warning("Warning message")
logger.error("Error occurred")

3. Resource Definition

Resources are lightweight endpoints that can be defined using decorators:

from pathlib import Path
from axiom_mcp import AxiomMCP

mcp = AxiomMCP("MyServer", port=8888)

# Simple string resource
@mcp.resource("greeting://{name}")
def say_hello(name: str) -> str:
    return f"Hello, {name}!"

# Resource returning a list of files
@mcp.resource("dir://desktop")
def list_files() -> list[str]:
    desktop = Path.home() / "Documents"
    return [str(f) for f in desktop.iterdir()]

Running the Server

if __name__ == "__main__":
    import asyncio

    # Register your tools
    mcp._tool_manager.register_tool(AddTool)

    # Run with SSE transport
    asyncio.run(mcp.run(transport="sse"))

Development Commands

# Run tests
uv run pytest

# Run tests with coverage
uv run pytest --cov=axiom_mcp tests/

# Update dependencies
uv pip compile pyproject.toml -o requirements.txt

# Sync your environment
uv pip sync requirements.txt

Contributing

  1. Fork the repository
  2. Create a new branch for your feature
  3. Make your changes
  4. Run the tests:
    uv run pytest
    
  5. Submit a pull request

License

GNU General Public License v3 (GPLv3)

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

axiom_mcp-0.1.2.tar.gz (119.2 kB view details)

Uploaded Source

Built Distribution

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

axiom_mcp-0.1.2-py3-none-any.whl (69.0 kB view details)

Uploaded Python 3

File details

Details for the file axiom_mcp-0.1.2.tar.gz.

File metadata

  • Download URL: axiom_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 119.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for axiom_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5f281ebf47ee7b60da4fdee5cb207562c75258cdcfb7b5bf10695555a42e96ce
MD5 59994d8af5135efd70384b7957be29a6
BLAKE2b-256 c1b893003f8ebc08b01ba9af93015b0aa8dce945948fa71b295640faf9d15c92

See more details on using hashes here.

File details

Details for the file axiom_mcp-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: axiom_mcp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 69.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for axiom_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7c4e7decc9789bf47ca08316130bcde439737fd5a2de00855f2606cd481f6df3
MD5 37c4582ea01aea72722843ea780578ca
BLAKE2b-256 d7958bdc89fb2c74752a1d181d979888c582c1083ccaa7049d2249538c4e2f21

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