This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Reason given by maintainers: Not ready for use
our-mcp-base
Base framework for building MCP (Model Context Protocol) servers in the ourochronos ecosystem.
Overview
our-mcp-base provides reusable patterns for MCP server implementations: an abstract base class with lifecycle hooks, a decorator-based tool router, and consistent response formatting. It reduces boilerplate and ensures all MCP servers in the ecosystem follow the same conventions.
Install
pip install our-mcp-base
Requires mcp>=1.0.
Usage
Basic Server
from mcp.types import Tool
from our_mcp_base import MCPServerBase
class MyServer(MCPServerBase):
server_name = "my-server"
def get_tools(self) -> list[Tool]:
return [
Tool(name="greet", description="Say hello", inputSchema={...}),
]
def handle_tool(self, name: str, arguments: dict) -> dict:
if name == "greet":
return {"success": True, "message": f"Hello, {arguments['name']}!"}
return {"success": False, "error": f"Unknown tool: {name}"}
if __name__ == "__main__":
MyServer().run()
With Lifecycle Hooks
MyServer(
startup_hook=lambda: init_database(),
health_check=lambda: check_db_connection(),
).run()
Run with --health-check to execute the health check and exit, or --skip-startup-hook to skip initialization.
Tool Router
from our_mcp_base import ToolRouter
router = ToolRouter()
@router.register("greet")
def handle_greet(name: str, enthusiasm: int = 1) -> dict:
return {"success": True, "message": f"Hello, {name}{'!' * enthusiasm}"}
# In handle_tool:
result = router.dispatch(name, arguments)
Response Helpers
from our_mcp_base import success_response, error_response, not_found_response
success_response(data="value", count=42)
# → {"success": True, "data": "value", "count": 42}
error_response("Invalid input", code=400)
# → {"success": False, "error": "Invalid input", "code": 400}
not_found_response("Belief", "belief-123")
# → {"success": False, "error": "Belief not found: belief-123"}
Custom Error Handling
def handle_db_error(exc: Exception, tool_name: str) -> list[TextContent]:
return [TextContent(type="text", text=json.dumps({"success": False, "error": str(exc)}))]
server = MyServer(error_handlers=[(DatabaseError, handle_db_error)])
API
| Symbol | Description |
|---|---|
MCPServerBase |
Abstract base class — implement get_tools() and handle_tool() |
ToolRouter |
Decorator-based tool dispatch registry |
success_response(**kwargs) |
Returns {success: True, ...} |
error_response(error, **kwargs) |
Returns {success: False, error: str, ...} |
not_found_response(type, id) |
Returns a 404-style error response |
Development
# Install with dev dependencies
make dev
# Run linters
make lint
# Run tests
make test
# Run tests with coverage
make test-cov
# Auto-format
make format
State Ownership
None. This package provides base classes and utilities only. State is owned by the concrete MCP server implementations that inherit from MCPServerBase.
Part of Valence
This brick is part of the Valence knowledge substrate. See our-infra for ourochronos conventions.
License
MIT
Metadata
Release files for our-mcp-base 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| our_mcp_base-0.1.0.tar.gz | 10.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| our_mcp_base-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.7 kB
Release files / our_mcp_base-0.1.0.tar.gz
| Download URL | our_mcp_base-0.1.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
844b4c2fb9c2dec7ee31456fe2534b94860f8a9b9af7efe5be9207911b944501
|
|
BLAKE2b-256 checksum How to use checksums |
a2975341b6100285cd5a59435aa727850cb00117433b10cbe3621c7b03f15741
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / our_mcp_base-0.1.0-py3-none-any.whl
| Download URL | our_mcp_base-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7098ed2a06fa62225467a907a028d6904f8cddee88ba8c0845abc24a2c60bbb5
|
|
BLAKE2b-256 checksum How to use checksums |
a2dc8278b445fca93aaaf5aab78756f2c821433a0f30eee174a08e2ae1416e45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for our-mcp-base 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.