Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

artificer_objects-0.1.0a2.tar.gz (71.6 kB view details)

Uploaded Source

Built Distribution

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

artificer_objects-0.1.0a2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file artificer_objects-0.1.0a2.tar.gz.

File metadata

  • Download URL: artificer_objects-0.1.0a2.tar.gz
  • Upload date:
  • Size: 71.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for artificer_objects-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 e682364fbee5c23b5106a865c86f2350bfbc6319f940f8d80ac33836d3cd1ae0
MD5 017348e4f70053a16b8f5f8a9e1629cf
BLAKE2b-256 1e0b712a2f0d229dd230ed86dca756f34c1885c3018ce76c9b96e63dc008ffb2

See more details on using hashes here.

File details

Details for the file artificer_objects-0.1.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for artificer_objects-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 476286f8bd39c96800aefcb768b8ba2eedb29cb8ce83d8328a53f88e029c5ad7
MD5 23facd2edc3363eff310d88e124b694b
BLAKE2b-256 c9d91e05545ad8690876d4a970a5c9bbf9dd5d0162ad6eff055661c7fe7af742

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