ContextBase Python SDK
A Python SDK for interacting with the ContextBase MCP API, simple key-value memory storage service with authentication and search capabilities.
Installation
pip install contextbase-py
Usage
Initialization
from contextbase import Context
ctx = Context(base_url='https://contextbase.onrender.com')
Authentication
signup_token = ctx.signup('user@example.com', 'password')
login_token = ctx.login('user@example.com', 'password')
ctx.set_token('your-auth-token')
Memory Operations
ctx.set('myKey', 'myValue')
ctx.set('temporaryKey', 'temporaryValue', 3600) # 1 hour TTL
ctx.set('temporaryKey', 'temporaryValue') # Without TTL
memory = ctx.get('myKey')
all_memories = ctx.list()
search_results = ctx.search('queryString')
ctx.delete('myKey')
API Reference
Constructor
Context(
base_url: str,
token: str = None # Optional initially, required for memory operations
)
Methods
| Method | Parameters | Return Type | Description |
|---|---|---|---|
set_token |
token: str |
None |
Sets the authentication token |
signup |
email: str, password: str |
str |
Creates a new user account and returns a token |
login |
email: str, password: str |
str |
Authenticates user and returns a token |
set |
key: str, value: str, ttl: int = None |
dict |
Stores a memory with optional TTL (in seconds) |
get |
key: str |
dict |
Retrieves a memory by key |
list |
None | list |
Lists all memories |
search |
query: str |
list |
Searches memories by query string |
delete |
key: str |
dict |
Deletes a memory by key |
License
MIT
Metadata
Release files for contextbase-py 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| contextbase_py-1.0.0.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| contextbase_py-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.8 kB
Release files / contextbase_py-1.0.0.tar.gz
| Download URL | contextbase_py-1.0.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dad34276b6abe248881dba2471fb14b235f2cafb24fdcebf7fcec79aae1787b
|
|
BLAKE2b-256 checksum How to use checksums |
749f2df054988047c9a6272a5c00107f34784a6a1120b6682bc2753cdc840382
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / contextbase_py-1.0.0-py3-none-any.whl
| Download URL | contextbase_py-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f14fa79426f360a984aaea0d21f946bb60b1cb5fea427c2bfc913363b7dd5436
|
|
BLAKE2b-256 checksum How to use checksums |
aec756cc8782628af17a6dc4a728766c2b392317553130cb178c0de25d06ed91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|