- Explore MCP Servers
- contextbase-ts
Contextbase Ts
What is Contextbase Ts
contextbase-ts is a TypeScript SDK designed for interacting with the ContextBase MCP API, which provides a simple key-value memory storage service with authentication and search capabilities.
Use cases
Use cases include user session management, caching data, storing user preferences, and any scenario where quick access to key-value pairs is needed.
How to use
To use contextbase-ts, first install it via npm with ‘npm install ts-sdk’. Then, initialize the client with your base URL, authenticate using signup or login methods, and perform memory operations such as set, get, list, search, and delete.
Key features
Key features include easy authentication, memory storage and retrieval, optional time-to-live (TTL) for stored memories, and search functionality for querying stored data.
Where to use
contextbase-ts can be used in web applications, mobile applications, and any TypeScript-based projects that require persistent key-value storage with authentication and search capabilities.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Contextbase Ts
contextbase-ts is a TypeScript SDK designed for interacting with the ContextBase MCP API, which provides a simple key-value memory storage service with authentication and search capabilities.
Use cases
Use cases include user session management, caching data, storing user preferences, and any scenario where quick access to key-value pairs is needed.
How to use
To use contextbase-ts, first install it via npm with ‘npm install ts-sdk’. Then, initialize the client with your base URL, authenticate using signup or login methods, and perform memory operations such as set, get, list, search, and delete.
Key features
Key features include easy authentication, memory storage and retrieval, optional time-to-live (TTL) for stored memories, and search functionality for querying stored data.
Where to use
contextbase-ts can be used in web applications, mobile applications, and any TypeScript-based projects that require persistent key-value storage with authentication and search capabilities.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
ContextBase TypeScript SDK
A TypeScript SDK for interacting with the ContextBase MCP API, simple key-value memory storage service with authentication and search capabilities.
Installation
npm install contextbase-ts
Usage
Initialization
import { context } from 'contextbase-ts';
const ctx = new context({
baseUrl: 'https://contextbase.onrender.com'
});
Authentication
const signupToken = await ctx.signup('[email protected]', 'password');
const loginToken = await ctx.login('[email protected]', 'password');
ctx.setToken('your-auth-token');
Memory Operations
await ctx.set('myKey', 'myValue');
await ctx.set('temporaryKey', 'temporaryValue', 3600); // 1 hour TTL
await ctx.set('temporaryKey', 'temporaryValue'); // Without TTL
const memory = await ctx.get('myKey');
const allMemories = await ctx.list();
const searchResults = await ctx.search('queryString');
await ctx.delete('myKey');
API Reference
Constructor
new context({
baseUrl: string,
token?: string // Optional initially, required for memory operations
})
Methods
| Method | Parameters | Return Type | Description |
|---|---|---|---|
setToken |
token: string |
void |
Sets the authentication token |
signup |
email: string, password: string |
Promise<string> |
Creates a new user account and returns a token |
login |
email: string, password: string |
Promise<string> |
Authenticates user and returns a token |
set |
key: string, value: string, ttl?: number |
Promise<any> |
Stores a memory with optional TTL (in seconds) |
get |
key: string |
Promise<any> |
Retrieves a memory by key |
list |
None | Promise<any> |
Lists all memories |
search |
query: string |
Promise<any> |
Searches memories by query string |
delete |
key: string |
Promise<any> |
Deletes a memory by key |
License
MIT
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










