contextslim
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@contextslimprune this massive JSON to save tokens"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ContextSlim TypeScript SDK
High-performance M2M context middleware and x402 micropayment engine for AI Agents and MCP tools on Base.
ContextSlim prunes massive JSON payloads by up to 85%, enforces strict token budgets, and handles autonomous HTTP 402 EIP-712 micropayments—keeping agent execution fast, cost-effective, and deterministically within LLM context limits.
Proven E2E Benchmarks
Real-world test suite performance measured over live execution on Cloudflare KV + Base Sepolia:
MCP Tool / Operation | Input Payload | Output Payload | Reduction / Impact | Performance Metric |
| 622 Tokens | 94 Tokens | 84.9% Token Saved | 528 Tokens saved in array pruning |
| 622 Tokens | 9 Tokens | 98.5% Savings | Instant extraction via JSONPath |
Session Pass (2nd Query) | On-chain Auth | Cache Auth | 70% Latency Drop | 0.43s $\rightarrow$ 0.13s execution speed |
Related MCP server: Budget Governor
Architecture & Protocol Flow
ContextSlim seamlessly sits between your AI Agent framework, the Model Context Protocol (MCP), and the Base blockchain:
+-------------------+ 1. MCP Tool Call +------------------------+
| AI Agent / LLM | ---------------------------> | @contextslim/sdk |
| (Claude / Cursor) | <--------------------------- | (TS Engine Client) |
+-------------------+ 4. Pruned Payload +------------------------+
| ^
2. x402 Payment | | 3. Optimized Data
Challenge/Pass | | & Reference ID
v |
+--------------------------------+
| ContextSlim Worker Engine |
| (Cloudflare KV + Pruner Engine)|
+--------------------------------+
|
v (On-Chain Settlement)
+--------------------------------+
| Base Network (USDC / ERC-3009) |
+--------------------------------+Installation
Install the agnostic SDK optimized for Node.js (v18+), Bun, Deno, and Cloudflare Workers:
npm install @contextslim/sdk ethers dotenvMCP Client Configurations
1. Claude Desktop Integration
Add the following configuration to your claude_desktop_config.json file:
{
"mcpServers": {
"contextslim": {
"command": "npx",
"args": ["-y", "@contextslim/sdk"],
"env": {
"ENDPOINT_URL": "https://contextslim.friczero.com",
"PRIVATE_KEY": "0x_YOUR_AGENT_PRIVATE_KEY"
}
}
}
}2. Cursor IDE (.cursor/mcp.json)
{
"mcpServers": {
"contextslim": {
"url": "https://contextslim.friczero.com/message"
}
}
}3. Smithery CLI
One-click installation via Smithery:
npx -y @smithery/cli install context-slim --client claude30-Second Quickstart
This script initializes the client with an active Session Pass ($0.005 USDC), prunes a massive JSON payload, and retrieves specific fields with ultra-low latency:
import { ContextSlimClient } from "@contextslim/sdk";
import { Wallet } from "ethers";
import * as dotenv from "dotenv";
dotenv.config();
async function main() {
// 1. Initialize Local Signer (Private key isolated in memory)
const wallet = new Wallet(process.env.PRIVATE_KEY!);
// 2. Instantiate ContextSlim Client
const client = new ContextSlimClient({
endpoint: process.env.ENDPOINT_URL || "https://contextslim.friczero.com",
signer: wallet,
allowanceBudget: 0.005, // Optional: Enables Session Pass to avoid signing every query
maxTokenBudget: 1000,
});
// 3. Prune Massive Payload (optimize_context)
const heavyPayload = {
critical_alert: {
severity: "CRITICAL",
system: "database-cluster-primary",
message: "Connection pool exhausted on port 5432",
},
system_status: { cpu_load: "88%", memory_used: "14.2GB" },
logs: Array.from({ length: 100 }, (_, i) => `Log entry #${i + 1}: Activity sweep`),
};
console.log(" Optimizing massive context...");
const prep = await client.callTool("optimize_context", {
data: heavyPayload,
maxTokenBudget: 150,
});
const refId = prep.result.toolResultReference.referenceId;
console.log(` Reference Cached in KV: ${refId}`);
console.log(` Saved Tokens: ${prep.metrics.savedTokens}`);
// 4. Targeted Path Extraction (fetch_result)
console.log(" Retrieving only 'critical_alert.severity'...");
const extracted = await client.callTool("fetch_result", {
referenceId: refId,
paths: ["critical_alert.severity"],
});
console.log("Result:", JSON.stringify(extracted.result, null, 2));
// Returns only 9 tokens: { critical_alert: { severity: 'CRITICAL' } }
}
main().catch(console.error);Advanced Signer Setup (Production & Enterprise)
While passing a raw ethers.Wallet initialized from an environment variable works for local development, production AI agents should avoid storing plain-text private keys in .env files.
ContextSlimClient accepts any standard ethers.Signer interface, allowing seamless integration with Hardware Security Modules (HSMs), Cloud Key Management Services (KMS), and Multi-Party Computation (MPC) infrastructure:
1. AWS KMS / Cloud HSM
Keep keys non-exportable inside dedicated cloud HSMs:
import { KmsSigner } from "aws-kms-ethers-signer";
import { ContextSlimClient } from "@contextslim/sdk";
const kmsSigner = new KmsSigner({
keyId: "arn:aws:kms:us-east-1:123456789012:key/your-agent-key-id",
});
const client = new ContextSlimClient({
endpoint: "https://contextslim.friczero.com",
signer: kmsSigner, // Native Ethers Signer wrapping AWS KMS
});2. Turnkey / Non-Custodial MPC Wallets
Isolate credentials for serverless agents or multi-tenant agent architectures:
import { TurnkeySigner } from "@turnkey/ethers";
import { ContextSlimClient } from "@contextslim/sdk";
const turnkeySigner = new TurnkeySigner({
client: turnkeyClient,
organizationId: process.env.TURNKEY_ORGANIZATION_ID!,
signWith: process.env.TURNKEY_WALLET_ADDRESS!,
});
const client = new ContextSlimClient({
endpoint: "https://contextslim.friczero.com",
signer: turnkeySigner,
});API Reference
new ContextSlimClient(options)
Option | Type | Default | Description |
|
| Required | Base URL of the ContextSlim Worker ( |
|
| Required | Ethers Signer implementation for ERC-3009/EIP-712 payment authorizations. |
|
|
| USDC budget to pre-approve a Session Pass (reduces latency). |
|
|
| Default response token limit. |
client.callTool(name, params)
Unified invocation compatible with MCP JSON-RPC.
1. optimize_context Tool
Reduces complex JSON structures while preserving critical fields and inserting truncated reference markers (_slim).
Parameters:
data(object, required) - Full JSON payload to optimize.maxTokenBudget(number, optional) - Hard token limit for the response payload.Response:
{
status: "success",
result: {
toolResultReference: { referenceId: "ref_ef17a253", expiresIn: "3600s" },
// ... pruned payload
},
metrics: {
originalTokens: 622,
slimmedTokens: 94,
savedTokens: 528,
reductionPercentage: "84.9%",
strategyApplied: "recursive:arrays(47_items)"
}
}2. fetch_result Tool
Retrieves exact data subsets from a cached reference ID.
Parameters:
referenceId(string, required) - ID returned byoptimize_context.paths(string[], optional) - Dot-notation field paths to extract (e.g.,["user.id", "items[0].price"]).Response:
{
status: "success",
referenceId: "ref_ef17a253",
retrievedTokens: 9,
result: { critical_alert: { severity: "CRITICAL" } }
}Security & Resilience
Cryptographic Isolation: EIP-712 / ERC-3009 x402 payment challenge signing happens strictly within your local process or designated KMS signer. No private keys or seed phrases ever leave your execution environment.
Anti-Replay Protection: Every payment challenge issued by the HTTP 402 server includes time-bound single-use nonces. Reusing
X-PAYMENTheaders is strictly rejected.Session Pass Mechanism: Setting an
allowanceBudgetissues an encrypted session pass, amortizing on-chain verification and speeding up subsequent KV fetches to an average execution speed of 0.13 seconds.
License
This project is licensed under the MIT License.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityFmaintenanceEnables AI agents to autonomously request services from other specialized agents and compensate them via x402 micropayments. Demonstrates a Machine-to-Machine economy using A2A protocol for agent communication, MCP for context management, and blockchain-based payments on Base network.2431MIT
- Alicense-qualityAmaintenanceBudget & cost control for AI agents: hard per-agent spend caps, rate limits, idempotency, and human-in-the-loop approval — enforced before each LLM call, not after the invoice. One hosted MCP endpoint (no proxy or self-hosting), settled via x402 (USDC on Base).MIT
- Alicense-qualityAmaintenanceA budget-bound x402 payment wallet for AI agents: it autonomously pays HTTP 402 payment-gated URLs across every major chain (EVM, Solana, and many non-EVM families). Self-custodial and backendless, your key, your RPC, with spend caps enforced before any on-chain send.7MIT

@arispay/payagent-mcpofficial
AlicenseDqualityFmaintenanceEnables AI agents to call paid APIs and settle HTTP 402 payment challenges with USDC on Base, without private keys ever being involved.2102MIT
Related MCP Connectors
Pay-per-call JSON repair + JSON Schema validation for AI agents (USDC on Base, x402).
63 pay-per-call tools for agents: vision, text, data, web, blockchain. USDC on Base via x402.
30 pay-per-call APIs for AI agents: compliance, trade, safety, web, data. USDC on Base via x402.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/friczerocom-cpu/contextslim-typescript'
If you have feedback or need assistance with the MCP directory API, please join our Discord server