Python API reference¶
These sections document the existing server modules from their Python
docstrings. The MCP-facing read_emails function is registered inside a helper;
its client contract is documented explicitly in the tool reference.
The pre-push hook builds this reference with strict link and anchor checks.
Use make docs-build for earlier feedback when needed; do not repeat a passing
hook gate manually.
Configuration store¶
Read-only file-backed store for integrations.json.
IntegrationsFileError
¶
Bases: Exception
Raised when integrations.json is missing, empty, or corrupt.
Source code in src/justpen_integration_mcp/store.py
15 16 | |
get_integrations_path()
¶
Return the configured integrations path or the container default.
Source code in src/justpen_integration_mcp/store.py
24 25 26 27 28 | |
load()
async
¶
Load and parse integrations.json. Read-only — no writes.
Source code in src/justpen_integration_mcp/store.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
load_email_config()
async
¶
Load and validate the email block from integrations.json.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
{"service_account_key": str, "delegated_user": str} |
Raises:
| Type | Description |
|---|---|
IntegrationsFileError
|
On any config problem. |
Source code in src/justpen_integration_mcp/store.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
set_integrations_path(path)
¶
Set the path used to read the integrations configuration.
Source code in src/justpen_integration_mcp/store.py
19 20 21 | |
Response helpers¶
Successful tool responses use status: "ok"; failures use status: "error"
and an error string. The tool reference shows the
data shapes returned by read_emails.
Response builders for integration MCP tools.
error_response(error)
¶
Build an error response containing the supplied message.
Source code in src/justpen_integration_mcp/responses.py
14 15 16 | |
ok_response(data=None)
¶
Build an ok response, including data only when provided.
Source code in src/justpen_integration_mcp/responses.py
6 7 8 9 10 11 | |
Email registration¶
Email reading tool — Gmail via service account delegation.
register(mcp)
¶
Register the Gmail email-reading tool on the MCP server.
Source code in src/justpen_integration_mcp/tools/email.py
290 291 292 | |