Summary
The gateway supports a sign query parameter on POST /api/v1/data/. When sign=notary, the gateway cryptographically signs the uploaded data using its notary service, providing provenance guarantees at upload time. This is the simplest way to add provenance to data — no blockchain interaction required.
What to Implement
1. Gateway Client (gateway_client.py)
Add sign parameter to upload_data():
def upload_data(self, data: str, stamp_id: str, content_type: str = "application/json", sign: Optional[str] = None) -> Dict[str, Any]:
When sign is provided, include it as a query parameter:
params = {
'stamp_id': stamp_id,
'content_type': content_type
}
if sign:
params['sign'] = sign
2. MCP Server (server.py)
Add sign to the upload_data tool schema:
"sign": {
"type": "string",
"description": "Signing method for provenance. Use 'notary' to have the gateway cryptographically sign the data, creating a verifiable proof of upload. Leave empty for unsigned upload.",
"enum": ["notary"]
}
Pass through in the handler:
sign = arguments.get("sign")
result = gateway_client.upload_data(data, clean_stamp_id, content_type, sign=sign)
When sign=notary was used, include signing info in the success response.
3. Response Enhancement
When notary signing is used, the gateway response may include additional fields. Surface these in the upload response:
- Notary signature info
- Signer address
Files to Modify
swarm_provenance_mcp/gateway_client.py — add sign param to upload_data()
swarm_provenance_mcp/server.py — add sign to tool schema and handler
tests/test_gateway_client.py — add tests for signed uploads
tests/test_integration.py — add integration tests
Reference
- Gateway endpoint:
POST /api/v1/data/?sign=notary
- Related: notary_info tool (check if notary is available before signing)
- Follow existing pattern: see how
content_type optional param is handled in upload_data
Acceptance Criteria
Summary
The gateway supports a
signquery parameter onPOST /api/v1/data/. Whensign=notary, the gateway cryptographically signs the uploaded data using its notary service, providing provenance guarantees at upload time. This is the simplest way to add provenance to data — no blockchain interaction required.What to Implement
1. Gateway Client (
gateway_client.py)Add
signparameter toupload_data():When
signis provided, include it as a query parameter:2. MCP Server (
server.py)Add
signto theupload_datatool schema:Pass through in the handler:
When
sign=notarywas used, include signing info in the success response.3. Response Enhancement
When notary signing is used, the gateway response may include additional fields. Surface these in the upload response:
Files to Modify
swarm_provenance_mcp/gateway_client.py— addsignparam toupload_data()swarm_provenance_mcp/server.py— addsignto tool schema and handlertests/test_gateway_client.py— add tests for signed uploadstests/test_integration.py— add integration testsReference
POST /api/v1/data/?sign=notarycontent_typeoptional param is handled inupload_dataAcceptance Criteria
upload_datatool accepts optionalsignparametersign="notary", request includes?sign=notaryquery param