Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
[![Python Support](https://img.shields.io/pypi/pyversions/zerodb-mcp.svg)](https://pypi.org/project/zerodb-mcp/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A production-ready Python client for the ZeroDB MCP Bridge API. Provides comprehensive async access to all 60+ operations including vectors, TurboQuant vector compression (PolarQuant + QJL), NoSQL tables, file storage, events, RLHF, and admin functionality.
A production-ready Python client for the ZeroDB MCP Bridge API and AI-agent infrastructure. Provides comprehensive async access to all 60+ operations including vectors, TurboQuant vector compression (PolarQuant + QJL), NoSQL tables, file storage, events, RLHF, [x402](https://github.com/coinbase/x402) agent-payment header parsing, and admin functionality.

## Features

- **Complete API Coverage**: All 60+ MCP Bridge operations
- **Async/Await Support**: Built on `httpx` for high-performance async operations
- **Type Safety**: Full Pydantic model validation
- **x402 Agent Payments**: Parses the `WWW-Authenticate: Payment` header AI agents receive on an HTTP 402 challenge
- **Automatic Retries**: Intelligent retry logic with exponential backoff
- **Error Handling**: Comprehensive exception hierarchy
- **Rate Limiting**: Built-in rate limit handling with retry-after support
Expand All @@ -26,8 +27,8 @@ pip install zerodb-mcp
### Development Installation

```bash
git clone https://github.com/ainative/zerodb-mcp-python.git
cd zerodb-mcp-python
git clone https://github.com/AINative-Studio/zerodb-python-sdk.git
cd zerodb-python-sdk
pip install -e ".[dev]"
```

Expand Down Expand Up @@ -469,6 +470,28 @@ health = await client.admin.system_health()
result = await client.admin.optimize_database(vacuum=True, reindex=True)
```

## x402 Agent Payments

[x402](https://github.com/coinbase/x402) is the HTTP 402 "Payment Required" micropayment standard — an AI agent hits a paid endpoint, gets back a `402` with a `WWW-Authenticate: Payment ...` header describing what it costs, pays in USDC, and retries. This SDK includes a parser for that header so your agent doesn't need to hand-roll the parsing.

```python
from zerodb_mcp import parse_x402_payment_header, parse_x402_payment_header_or_raise

# Given a real 402 response from an x402-protected endpoint:
header = response.headers.get("www-authenticate")
# 'Payment scheme="exact", network="base", asset="USDC", amount="2000", pay_to="0xabc..."'

requirements = parse_x402_payment_header(header)
# {'scheme': 'exact', 'network': 'base', 'asset': 'USDC', 'amount': '2000', 'pay_to': '0xabc...'}
# Returns None if the header isn't an x402 Payment challenge (e.g. a plain
# 401 on the same route) -- callers should treat None as "not x402", not raise.

# Or raise immediately if you expect a valid challenge and want to fail loudly:
requirements = parse_x402_payment_header_or_raise(header)
```

Pair this with your own wallet/payment logic to pay the `amount` of `asset` to `pay_to` on `network`, then retry the original request with proof of payment.

## Error Handling

```python
Expand Down Expand Up @@ -794,12 +817,16 @@ ZERODB_API_KEY="your-key" pytest test_zerodb_integration.py -v
## Support

- Documentation: https://docs.ainative.studio/sdk/python
- Issues: https://github.com/ainative/zerodb-mcp-python/issues
- Issues: https://github.com/AINative-Studio/zerodb-python-sdk/issues
- Email: [email protected]
- Discord: https://discord.gg/ainative

## Changelog

### 1.2.0

- Added `parse_x402_payment_header` / `parse_x402_payment_header_or_raise` — parses the `WWW-Authenticate: Payment` header an AI agent receives on an x402 HTTP 402 challenge

### 1.0.0 (2025-01-14)

- Initial production release
Expand Down
18 changes: 13 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@ build-backend = "setuptools.build_meta"

[project]
name = "zerodb-mcp"
version = "1.2.0"
description = "Production-ready Python client for ZeroDB MCP Bridge API"
version = "1.3.0"
description = "Python client for ZeroDB: vector database, agent memory, and x402 agent payments (USDC micropayments) for AI agents and MCP servers"
readme = "README.md"
requires-python = ">=3.9"
license = {text = "MIT"}
authors = [
{name = "AINative Studio", email = "[email protected]"}
]
keywords = ["zerodb", "mcp", "vector", "database", "quantum", "ai"]
keywords = [
"zerodb", "mcp", "model-context-protocol", "vector", "vector-database",
"database", "quantum", "ai",
"ai-agents", "ai-agent", "agentic-ai", "autonomous-agents",
"x402", "agent-payments", "agentic-commerce", "usdc", "micropayments", "http-402",
"vibe-coding", "ai-coding", "ai-assistant",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -21,6 +27,8 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Database :: Front-Ends",
]

dependencies = [
Expand All @@ -43,8 +51,8 @@ dev = [
[project.urls]
Homepage = "https://ainative.studio"
Documentation = "https://docs.ainative.studio/sdk/python"
Repository = "https://github.com/ainative/zerodb-mcp-python"
Issues = "https://github.com/ainative/zerodb-mcp-python/issues"
Repository = "https://github.com/AINative-Studio/zerodb-python-sdk"
Issues = "https://github.com/AINative-Studio/zerodb-python-sdk/issues"

[project.entry-points.pytest11]
zerodb_mcp = "zerodb_mcp.testing"
Expand Down
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

setup(
name="zerodb-mcp",
version="1.2.0",
version="1.3.0",
author="AINative Studio",
author_email="[email protected]",
description="Production-ready Python client for ZeroDB MCP Bridge API",
description="Python client for ZeroDB: vector database, agent memory, and x402 agent payments (USDC micropayments) for AI agents and MCP servers",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://ainative.studio/products/zerodb",
Expand Down Expand Up @@ -53,7 +53,10 @@
"sphinx-rtd-theme>=1.2.0",
],
},
keywords="zerodb mcp ainative vector-database semantic-search agent-memory agent-cloud",
keywords="zerodb mcp model-context-protocol ainative vector-database semantic-search "
"agent-memory agent-cloud ai-agents ai-agent agentic-ai autonomous-agents "
"x402 agent-payments agentic-commerce usdc micropayments http-402 "
"vibe-coding ai-coding ai-assistant",
project_urls={
"Homepage": "https://ainative.studio/products/zerodb",
"Documentation": "https://docs.ainative.studio",
Expand Down
2 changes: 1 addition & 1 deletion zerodb_mcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
... )
"""

__version__ = "1.2.0"
__version__ = "1.3.0"
__author__ = "AINative Studio"
__license__ = "MIT"

Expand Down