TypeScript integration guide — add billing to any existing MCP server.
Estimated time: 10 minutes · No code changes to your MCP server required
Agent Bazaar acts as a billing proxy in front of your existing MCP server. Your server continues to work exactly as it does today — we just meter the calls and handle payments.
┌─────────────┐ ┌──────────────┐ ┌──────────────────┐
│ AI Agent │────▶│ Agent Bazaar │────▶│ Your MCP Server │
│ (consumer) │◀────│ (proxy) │◀────│ (unchanged) │
└─────────────┘ └──────────────┘ └──────────────────┘
│ meters calls │
│ signs receipts│
│ handles billing│npm install @noui/bazaar-sdk # or yarn add @noui/bazaar-sdk # or pnpm add @noui/bazaar-sdk
// register-provider.ts
import { BazaarClient } from '@noui/bazaar-sdk';
const bazaar = new BazaarClient({
baseUrl: 'https://noui.bot/api/v1',
});
async function register() {
const result = await bazaar.registerProvider({
name: 'my-awesome-mcp',
displayName: 'My Awesome MCP Server',
description: 'Does amazing things with AI',
mcpServerUrl: 'https://my-server.com/mcp',
contact: 'developer@example.com',
});
console.log('Provider ID:', result.providerId);
console.log('API Key:', result.apiKey);
// Save this API key! You'll need it for all operations.
}
register();Run once: npx tsx register-provider.ts
// list-tools.ts
import { BazaarClient } from '@noui/bazaar-sdk';
const bazaar = new BazaarClient({
baseUrl: 'https://noui.bot/api/v1',
apiKey: 'baz_sk_your_key_here', // from Step 2
});
async function listTools() {
await bazaar.listTools({
tools: [
{
name: 'search',
description: 'Search documents by query',
pricePerCall: 0.01, // $0.01 per search
inputSchema: {
type: 'object',
properties: {
query: { type: 'string', description: 'Search query' },
limit: { type: 'number', description: 'Max results', default: 10 },
},
required: ['query'],
},
},
{
name: 'analyze',
description: 'Deep analysis of a document',
pricePerCall: 0.05, // $0.05 per analysis
inputSchema: {
type: 'object',
properties: {
documentId: { type: 'string' },
depth: { type: 'string', enum: ['summary', 'detailed', 'exhaustive'] },
},
required: ['documentId'],
},
},
{
name: 'list_recent',
description: 'List recently added documents',
pricePerCall: 0, // FREE — great for discovery
inputSchema: {
type: 'object',
properties: {
limit: { type: 'number', default: 20 },
},
},
},
],
});
console.log('Tools listed! They\'re now discoverable on Agent Bazaar.');
}
listTools();// verify.ts
import { BazaarClient } from '@noui/bazaar-sdk';
const bazaar = new BazaarClient({
baseUrl: 'https://noui.bot/api/v1',
apiKey: 'baz_sk_your_key_here',
});
async function verify() {
// Start email verification
await bazaar.startVerification({ method: 'email' });
console.log('Check your email for a verification code.');
// After receiving the code:
await bazaar.completeVerification({
method: 'email',
code: 'YOUR_CODE_HERE',
});
console.log('Verified! You now have a trust badge.');
}
verify();// dashboard.ts
import { BazaarClient } from '@noui/bazaar-sdk';
const bazaar = new BazaarClient({
baseUrl: 'https://noui.bot/api/v1',
apiKey: 'baz_sk_your_key_here',
});
async function checkDashboard() {
const trust = await bazaar.getTrustScore();
console.log(`
Trust Score: ${trust.score}/100
Badge: ${trust.badge}
Total Calls: ${trust.totalCalls}
Total Revenue: $${trust.totalRevenue}
Uptime: ${trust.sla.uptimePercent}%
Avg Latency: ${trust.sla.avgLatencyMs}ms
`);
}
checkDashboard();Your MCP server is now listed on Agent Bazaar. AI agents can discover your tools in the catalog, call them through the proxy, and you earn 82% of every paid call.
You changed zero lines of your MCP server code. Bazaar proxies calls to your existing endpoint. Your tools work exactly as before, but now they're metered and monetized.