Metadata-Version: 2.3
Name: imcp-addon
Version: 0.1.0
Summary: MCP addon framework: tools, pages, identity and storage for one containerised capability.
Keywords: mcp,addon,gateway
Author: iydon
Author-email: iydon <liangiydon@gmail.com>
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Dist: mcp>=2.3.0
Requires-Dist: starlette>=0.37
Requires-Dist: pydantic>=2.9
Requires-Dist: python-multipart>=0.0.32
Requires-Dist: httpx2>=2.10.0
Requires-Dist: uvicorn[standard]>=0.31.1 ; extra == 'serve'
Requires-Python: >=3.12
Project-URL: Repository, https://github.com/aiydon/imcp
Project-URL: Documentation, https://github.com/aiydon/imcp/blob/main/docs/ADDONS.md
Provides-Extra: serve
Description-Content-Type: text/markdown

# imcp-addon

The SDK for one containerised MCP capability: an addon declares tools, serves pages, knows who is
calling, and keeps its own SQLite storage. Install the server extra for `uvicorn`, which `run()` needs:

```console
pip install imcp-addon[serve]
```

## A minimal addon — `server.py`

```python
from imcp_addon import Addon, Request, ToolRequest, html

app = Addon(name="notes", title="Notes", schema=["CREATE TABLE note (account TEXT, text TEXT)"])


@app.tool("note_add", "Save a note for the current caller.")
async def note_add(request: ToolRequest, text: str) -> dict[str, str]:
    request.store.insert("note", {"account": request.identity.account or "", "text": text})
    return {"saved": text}


@app.page("/", title="Notes")
async def notes_page(request: Request) -> str:
    notes = request.store.fetch_all("SELECT text FROM note")
    body = html.card(None, *[html.el("p", text=row["text"]) for row in notes])
    return html.page("Notes", body, base=request.base).render()


app.run()
```

Set `IMCP_ADDON_DATA` to a data directory and `PORT` to a free port, then `python server.py`. That
path is for local work only: in production the gateway starts the container, passes the caller's
signed identity in headers and proxies the pages and `/mcp`, so an addon implements no routing,
authentication or billing of its own.

The contract, storage rules and the page kit are in
[docs/ADDONS.md](https://github.com/aiydon/imcp/blob/main/docs/ADDONS.md).
