Installation Overview
Sardis provides three installation methods depending on your use case:
Python SDK
For LangChain, OpenAI, CrewAI, Python agents
TypeScript SDK
For Vercel AI, Node.js, React, TypeScript agents
MCP Server
For Claude Desktop, Cursor, ChatGPT, VS Code
Python SDK
Installation
Requirements
- Python 3.11 or higher
pip 21.0 or higher (for PEP 517 support)
Optional Dependencies
The sardis package is a meta-package that includes the core SDK. Install optional features:
# Full installation (all features)
pip install sardis[all]
# Individual features
pip install sardis[chain] # Blockchain execution
pip install sardis[compliance] # KYC/AML integrations
pip install sardis[cards] # Virtual card issuance
pip install sardis[ledger] # Audit ledger
pip install sardis[protocols] # AP2/TAP/UCP protocols
# Development tools
pip install sardis[dev] # Testing and linting
Verify Installation
import sardis
print(f"Sardis version: {sardis.__version__}")
# Test in simulation mode (no API key needed)
from sardis import Wallet, Transaction
wallet = Wallet(initial_balance=100, currency="USDC")
tx = Transaction(
from_wallet=wallet,
to="test:merchant",
amount=10,
purpose="Test payment"
)
result = tx.execute()
print(f"Transaction status: {result.status.value}")
Configuration
Set your API key via environment variable:
export SARDIS_API_KEY=sk_live_your_api_key_here
Or pass it directly in code:
from sardis import SardisClient
client = SardisClient(api_key="sk_live_...")
Never hardcode API keys in production code. Use environment variables or secret management systems.
TypeScript SDK
Installation
Requirements
- Node.js 18.0 or higher
- TypeScript 4.7 or higher (for TypeScript projects)
Package Exports
The SDK supports multiple module formats:
// ES Modules (recommended)
import { SardisClient } from '@sardis/sdk';
// CommonJS
const { SardisClient } = require('@sardis/sdk');
// Browser (via CDN)
import { SardisClient } from 'https://esm.sh/@sardis/sdk';
Verify Installation
import { SardisClient } from '@sardis/sdk';
console.log('Sardis SDK loaded successfully');
// Test connection (optional)
const client = new SardisClient({
apiKey: process.env.SARDIS_API_KEY
});
// Health check
const health = await client.health();
console.log('API Status:', health.status);
Configuration
Set your API key via environment variable:
export SARDIS_API_KEY=sk_live_your_api_key_here
Or pass it directly:
import { SardisClient } from '@sardis/sdk';
const client = new SardisClient({
apiKey: 'sk_live_...',
baseURL: 'https://api.sardis.sh', // Optional: custom API endpoint
timeout: 30000, // Optional: request timeout (ms)
});
TypeScript Configuration
Add to your tsconfig.json:
{
"compilerOptions": {
"moduleResolution": "bundler",
"module": "ESNext",
"target": "ES2022",
"lib": ["ES2022"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}
MCP Server
The MCP (Model Context Protocol) server enables AI assistants like Claude, ChatGPT, Cursor, and VS Code to execute payments.
Claude Desktop
Edit your Claude Desktop configuration file:
File: ~/Library/Application Support/Claude/claude_desktop_config.json{
"mcpServers": {
"sardis": {
"command": "npx",
"args": ["-y", "@sardis/mcp-server"],
"env": {
"SARDIS_API_KEY": "sk_live_your_api_key_here"
}
}
}
}
File: %APPDATA%\Claude\claude_desktop_config.json{
"mcpServers": {
"sardis": {
"command": "npx",
"args": ["-y", "@sardis/mcp-server"],
"env": {
"SARDIS_API_KEY": "sk_live_your_api_key_here"
}
}
}
}
File: ~/.config/Claude/claude_desktop_config.json{
"mcpServers": {
"sardis": {
"command": "npx",
"args": ["-y", "@sardis/mcp-server"],
"env": {
"SARDIS_API_KEY": "sk_live_your_api_key_here"
}
}
}
}
Restart Claude Desktop after making changes.
Cursor
File: .cursor/mcp.json (in your project root)
{
"mcpServers": {
"sardis": {
"command": "npx",
"args": ["-y", "@sardis/mcp-server"],
"env": {
"SARDIS_API_KEY": "sk_live_your_api_key_here"
}
}
}
}
Windsurf
File: .windsurf/mcp.json (in your project root)
{
"mcpServers": {
"sardis": {
"command": "npx",
"args": ["-y", "@sardis/mcp-server"],
"env": {
"SARDIS_API_KEY": "sk_live_your_api_key_here"
}
}
}
}
VS Code
- Install the MCP Extension
- Open VS Code Settings (JSON)
- Add:
{
"mcp.servers": {
"sardis": {
"command": "npx",
"args": ["-y", "@sardis/mcp-server"],
"env": {
"SARDIS_API_KEY": "sk_live_your_api_key_here"
}
}
}
}
ChatGPT
- Open ChatGPT Settings
- Navigate to MCP Servers
- Click Add Custom
- Configure:
- Name:
sardis
- Command:
npx -y @sardis/mcp-server
- Environment Variable:
SARDIS_API_KEY=sk_live_your_api_key_here
Claude Code (CLI)
claude mcp add sardis -- npx -y @sardis/mcp-server
Then set your API key:
export SARDIS_API_KEY=sk_live_your_api_key_here
Demo Mode (No API Key)
Test the MCP server without an API key:
npx @sardis/mcp-server --demo
Sandbox tools simulate payments, wallet creation, and policy validation.
Verify MCP Installation
After configuring your MCP client, test the integration:
-
Claude Desktop / Cursor / VS Code: Ask the assistant:
"Check my Sardis wallet balance"
-
CLI Test:
npx @sardis/mcp-server --test
Framework-Specific Installation
LangChain
pip install langchain langchain-openai sardis
Example:
from langchain_core.tools import tool
from sardis import SardisClient
sardis = SardisClient(api_key="sk_live_...")
@tool
def sardis_pay(to: str, amount: str, token: str) -> str:
"""Execute a payment through Sardis."""
result = sardis.wallets.transfer(
wallet_id="...",
destination=to,
amount=amount,
token=token,
chain="base",
)
return f"Payment: {result.tx_hash}"
Vercel AI SDK
npm install ai @ai-sdk/openai @sardis/sdk zod
Example:
import { generateText, tool } from "ai";
import { openai } from "@ai-sdk/openai";
import { z } from "zod";
import { SardisClient } from "@sardis/sdk";
const sardis = new SardisClient({ apiKey: process.env.SARDIS_API_KEY });
const { text } = await generateText({
model: openai("gpt-4o"),
tools: {
sardisPay: tool({
description: "Execute a payment",
parameters: z.object({
to: z.string(),
amount: z.string(),
token: z.enum(["USDC", "USDT"]),
}),
execute: async ({ to, amount, token }) => {
const result = await sardis.wallets.transfer(walletId, {
destination: to,
amount,
token,
chain: "base",
});
return result;
},
}),
},
});
OpenAI Function Calling
pip install openai sardis
Example:
from openai import OpenAI
from sardis import SardisClient
sardis = SardisClient(api_key="sk_live_...")
client = OpenAI()
tools = [{
"type": "function",
"function": {
"name": "sardis_pay",
"description": "Execute a payment through Sardis",
"parameters": {
"type": "object",
"properties": {
"to": {"type": "string"},
"amount": {"type": "string"},
"token": {"type": "string", "enum": ["USDC", "USDT"]},
},
},
},
}]
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Pay $25 to OpenAI"}],
tools=tools,
)
CrewAI
pip install crewai sardis
Example:
from crewai import Agent, Task, Crew
from crewai.tools import tool
from sardis import SardisClient
sardis = SardisClient(api_key="sk_live_...")
@tool("sardis_pay")
def sardis_pay(to: str, amount: str, token: str) -> str:
"""Execute a payment through Sardis."""
result = sardis.wallets.transfer(...)
return f"Payment: {result.tx_hash}"
purchaser = Agent(
role="Procurement Specialist",
tools=[sardis_pay],
)
crew = Crew(agents=[purchaser], tasks=[...])
Environment Variables
| Variable | Required | Default | Description |
|---|
SARDIS_API_KEY | Yes | - | Your Sardis API key (starts with sk_live_ or sk_test_) |
SARDIS_API_URL | No | https://api.sardis.sh | API endpoint (for self-hosted or enterprise) |
SARDIS_MODE | No | live | live or sandbox (test mode with simulated payments) |
SARDIS_WALLET_ID | No | - | Default wallet ID for operations |
SARDIS_AGENT_ID | No | - | Default agent ID for this installation |
Troubleshooting
pip install fails with 'No matching distribution found'
Upgrade pip and setuptools:pip install --upgrade pip setuptools wheel
pip install sardis
TypeScript: 'Cannot find module @sardis/sdk'
Ensure TypeScript moduleResolution is set to bundler or node16 in tsconfig.json.
MCP server not appearing in Claude Desktop
- Verify JSON syntax in
claude_desktop_config.json
- Restart Claude Desktop completely (quit, not just close window)
- Check Claude logs:
~/Library/Logs/Claude/mcp*.log (macOS)
npx command hangs or fails
Clear npx cache:npx clear-npx-cache
npm cache clean --force
API key errors: 'Invalid authentication credentials'
- Verify your API key starts with
sk_live_ (production) or sk_test_ (sandbox)
- Check the key is active at sardis.sh/settings/api-keys
- Ensure no extra spaces or quotes in the environment variable
What’s Next?
Quickstart
Execute your first agent payment in 5 minutes
Framework Guides
LangChain, OpenAI, Vercel AI, CrewAI integration guides
API Reference
Complete API documentation
Examples
Production-ready code examples