Object store exposed to agents as MCP server
Project description
artificer-objects
Object store framework for MCP (Model Context Protocol) servers. Define typed object stores that agents can read, write, and query.
Installation
pip install artificer-objects
Usage
Subclass Object and implement the CRUD methods:
from pathlib import Path
from pydantic import BaseModel
from fastmcp import FastMCP
from artificer.objects import Object
class Note(BaseModel):
title: str
content: str
class NotesStore(Object):
model = Note
def __init__(self, path: str):
self.path = Path(path)
self.path.mkdir(parents=True, exist_ok=True)
def read(self, name: str) -> Note:
return Note.model_validate_json((self.path / f"{name}.json").read_text())
def write(self, name: str, data: Note) -> None:
(self.path / f"{name}.json").write_text(data.model_dump_json())
def delete(self, name: str) -> None:
(self.path / f"{name}.json").unlink()
def exists(self, name: str) -> bool:
return (self.path / f"{name}.json").exists()
def list_objects(self) -> list[str]:
return [f.stem for f in self.path.glob("*.json")]
# Register with MCP server
mcp = FastMCP()
NotesStore.register(mcp, NotesStore("/tmp/notes"), default=True)
mcp.run()
This exposes MCP tools: read_object, write_object, delete_object, exists_object, list_objects, list_object_types, get_object_schema.
CLI Integration
Integrates with artificer-cli for command-line access:
artificer objects list
artificer objects read myobj
artificer objects write myobj '{"title": "Hello", "content": "World"}'
artificer objects delete myobj
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 artificer_objects-0.1.0a3.tar.gz.
File metadata
- Download URL: artificer_objects-0.1.0a3.tar.gz
- Upload date:
- Size: 73.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee21a7ba56587c308e82a34a27191bd367bdfb5aff2cf658c0192da590f08ff9
|
|
| MD5 |
ff1c2457eb7bcaca866463ec8b4b460e
|
|
| BLAKE2b-256 |
c7607bda42f10b7eda64de011d5710249f9efe7460adf5c3993cc252824415ca
|
File details
Details for the file artificer_objects-0.1.0a3-py3-none-any.whl.
File metadata
- Download URL: artificer_objects-0.1.0a3-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e592c7d72a10ba9567b1a8e174b1535f1d20ac3a9f4bba7bf33ceba4f2df2a6f
|
|
| MD5 |
302321e4d895c706199f7595699955c4
|
|
| BLAKE2b-256 |
a4b07f32a4b14686433357114f74d600de435b489cc9cdb9f93496081311f495
|