🚀 MCP framework that unlocks truly scalable AI systems with zero friction
Project description
Axiom MCP
🚀 Robust and Dev friendly MCP framework
NOTE
This will be oss very soon, working on docs + other misc stuff, if you want to contribute, send me an email.
Installation
Using uv (recommended):
uv pip install axiom-mcp
Development Setup
-
Clone the repository:
git clone https://github.com/axiomml/axiom-mcp.git cd axiom-mcp
-
Install uv if you haven't already:
curl -LsSf https://astral.sh/uv/install.sh | sh
-
Create and activate a virtual environment with uv:
uv venv --python 3.12 source .venv/bin/activate # On Unix/Linux # or .venv\Scripts\activate # On Windows
-
Install development dependencies:
uv sync --frozen --extra 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. Tool Logging and Metrics
Axiom MCP provides comprehensive logging and metrics capabilities for tools:
Basic Logging
Each tool has access to a context with built-in logging methods:
class MyTool(Tool):
async def execute(self, args: Dict[str, Any]) -> Dict[str, Any]:
# Access logging through tool context
self.context.debug("Debug level message")
self.context.info("Processing started")
self.context.warning("Warning message")
self.context.error("Error occurred")
# Your tool logic here
return result
Metrics Tracking
The tool manager automatically tracks:
- Total calls
- Successful calls
- Failed calls
- Average execution time
- Last used timestamp
Metrics are stored in the logs/tools.log file by default and include:
- Tool name
- Operation status
- Timestamp
- Execution time
- Error messages (if any)
Advanced Features
- Cache Control:
# Disable caching for specific execution
tool_context = ToolContext(cache_enabled=False)
tool = MyTool(context=tool_context)
- Execution Timeout:
# Set custom timeout
tool_context = ToolContext(timeout=30.0) # 30 seconds
- Dry Run Mode:
# Enable dry run for testing
tool_context = ToolContext(dry_run=True)
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
axiom-mcp dev server.py # This runs in dev mode
axiom-mcp run server.py # This runs in release/prod mode
Development Commands
# Run tests
uv run pytest
# Run tests with coverage
uv run pytest tests
# Update dependencies
uv add <dep>
# Sync your environment
uv sync
Contributing
- Fork the repository
- Create a new branch for your feature
- Make your changes
- Run the tests:
uv run pytest
- 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
Built Distributions
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 mseep_axiom_mcp-0.1.3.tar.gz.
File metadata
- Download URL: mseep_axiom_mcp-0.1.3.tar.gz
- Upload date:
- Size: 120.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21222b3894c4c274990cce34eb1c01e4cec079c1aeb7b974598716cc6b2e7f96
|
|
| MD5 |
480295505082e0b433e8ea8108cd7340
|
|
| BLAKE2b-256 |
ca5e0165f2103064bf312d7191fe2e1f0d6427c2e6bfe4117adbdf684f9867d4
|
File details
Details for the file mseep_axiom_mcp-0.1.3-py3-none-any.whl.
File metadata
- Download URL: mseep_axiom_mcp-0.1.3-py3-none-any.whl
- Upload date:
- Size: 69.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9635012fcea28b11bc99cdee71abaeb85db255697227b49a63635818eb87e49
|
|
| MD5 |
050811fe1ea05685932e6251cbc70f8c
|
|
| BLAKE2b-256 |
c13298bc1201875172a667077cb0d0355e8e5df48957c97e870ff0c47ef93ba1
|
File details
Details for the file mseep_axiom_mcp-0.1.3-py2.py3-none-any.whl.
File metadata
- Download URL: mseep_axiom_mcp-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4da52749b8697680a34c95fc090ba3893873e1f190053aa454f42dbf61a87cc
|
|
| MD5 |
d875253133d6267d8cb66db429c116a3
|
|
| BLAKE2b-256 |
051f74387e1cd282cff5dc1254abd3fdb9a49ae699d04c0a6b6321a2f1fd3224
|