MCP Server

MCP Server & SDK

BiOS provides three ways to automate fine-tuning programmatically: an MCP server for AI assistants (Claude, Cursor, Windsurf), a TypeScript SDK and Python SDK for application code, and a REST API (documented in previous sections). All three use API keys created from your dashboard.

API Keys

All programmatic access requires an API key. Each key is scoped to a workspace with fine-grained permissions. You only need the API key itself. Org and workspace are resolved automatically.

  1. Go to your dashboard and click API Keys in the sidebar
  2. Click Create API Key, name it, and choose a permission preset (Read Only, Training, Full Access, or Custom)
  3. Optionally set an expiration (30, 60, 90, 180 days, or 1 year)
  4. Copy the key immediately; it is only shown once
  5. Set the key as USFBIOS_API_KEY. Nothing else is needed

Permission Scopes

models:readdatasets:readdatasets:writetraining:readtraining:writedeployments:readdeployments:writebilling:readanalytics:readintegrations:readintegrations:write

Call GET /api/api-keys/introspect with your key to see exactly what it can do: permissions, workspace, allowed tools, and rate limits.

i
API keys use the X-API-Key header. The key embeds your org and workspace, no separate IDs needed. If a member is removed from a workspace, all their keys for that workspace are automatically revoked.

MCP Server

The Model Context Protocol (MCP) is an open standard that lets AI assistants call external tools. The BiOS MCP server gives your AI assistant 38 tools covering the entire fine-tuning workflow, from datasets to training to inference. It works with Claude Desktop, Claude Code, Cursor, Windsurf, Cline, VS Code, Zed, Devin, and any MCP-compatible client.

Web and mobile apps such as claude.ai and ChatGPT connect through the hosted connector at https://mcp.usbios.ai/mcp instead: you sign in with your BiOS account and approve the connection, with no install and no API key.

For local setups, install globally or run with npx:

bash
npm install -g @usfbios/mcp-server
# or run directly:
npx @usfbios/mcp-server

Client Setup Guides

We publish a dedicated step-by-step guide for every major MCP client, each with the exact config file location, verification steps, and troubleshooting:

Or start from the MCP server overview for the quick start that applies to any client.

Configuration

Add to your AI client's configuration.

Claude Desktop / Claude Code

Add this to your claude_desktop_config.json or the project's .mcp.json:

json
{
  "mcpServers": {
    "usfbios": {
      "command": "npx",
      "args": ["@usfbios/mcp-server"],
      "env": {
        "USFBIOS_API_KEY": "sk_live_your_api_key"
      }
    }
  }
}

Cursor / Windsurf

Add the same configuration to your .cursor/mcp.json or the IDE's MCP settings panel.

Environment Variables

VariableRequiredDescription
USFBIOS_API_KEYRequiredYour scoped API key from the dashboard (starts with sk_live_). Org and workspace are resolved automatically.
USFBIOS_BASE_URLOptionalAPI base URL (default: https://api.usbios.ai)
i
One environment variable is all it takes. Create a scoped API key at Dashboard → API Keys with the permissions you need.

Available Tools

The MCP server exposes 38 tools organized by category. The most used ones are documented below; the inference tools mirror the Inference API. Your AI assistant can call any of them:

Context(2 tools)

get_platform_guide

Complete platform guide with 9 topics: overview, quick_start, models, datasets, training_methods, gpu_selection, hyperparameters, monitoring, cost_optimization. Call this FIRST so your AI assistant understands the full platform.

NameTypeRequiredDescription
topicstringOptional"overview" | "quick_start" | "models" | "datasets" | "training_methods" | "gpu_selection" | "hyperparameters" | "monitoring" | "cost_optimization"
introspect_api_key

Discover what this API key can do. Returns permissions (scopes), bound org/workspace, allowed MCP tools, allowed SDK methods, rate limits, and expiration. Call this to understand your access level.

Billing(1 tools)

get_wallet_balance

Check wallet balance, available credits, pending charges, and auto top-up status. Call before training to verify you have enough credits.

Models(2 tools)

search_models

Search 250+ base models. Filter by name, provider, or max parameter count.

NameTypeRequiredDescription
querystringOptionalModel name (e.g., "llama", "mistral")
providerstringOptionalProvider (e.g., "meta-llama")
max_paramsstringOptionalMax params (e.g., "13B")
get_model_config

Get training config recommendations for a model: supported methods, recommended GPU, default hyperparameters, estimated cost.

NameTypeRequiredDescription
modelstringRequiredFull model name

GPU(2 tools)

get_gpu_pricing

All GPU types with per-second pricing, VRAM, and availability. No auth required.

get_recommended_gpu

Optimal GPU for a model+adapter combo. Returns minimum GPU, recommended GPU, estimated time, and estimated cost.

NameTypeRequiredDescription
modelstringRequiredModel name
adapterstringOptional"lora" | "qlora" | "full"
dataset_rowsnumberOptionalRow count for cost estimation
epochsnumberOptionalPlanned epochs

Datasets(5 tools)

list_datasets

List all datasets: ID, name, format, row count, size, columns, date.

upload_dataset

Upload a local file (JSONL/Parquet/CSV, max 500MB). Auto-validates format and schema.

NameTypeRequiredDescription
file_pathstringRequiredAbsolute path to file
namestringOptionalDisplay name
preview_dataset

Preview first rows to verify structure and content before training.

NameTypeRequiredDescription
dataset_idstringRequiredDataset ID
rowsnumberOptionalRows to preview (max 50)
delete_dataset

Permanently delete a dataset. Active training jobs are not affected.

NameTypeRequiredDescription
dataset_idstringRequiredDataset ID
import_huggingface_dataset

Import from HuggingFace Hub (public or private if HF account connected).

NameTypeRequiredDescription
repo_idstringRequiredHF repo (e.g., "databricks/dolly-15k")
splitstringOptionalSplit (default: "train")
max_samplesnumberOptionalMax rows
namestringOptionalDisplay name

Training(8 tools)

create_training_job

Launch a fine-tuning job. Bills per-second. Only model, dataset_id, and method are required; everything else has sensible defaults.

NameTypeRequiredDescription
modelstringRequiredBase model name
dataset_idstringRequiredDataset ID
methodstringRequired"sft" | "dpo" | "simpo" | "orpo" | "cpo" | "kto" | "cpt" | "vlm"
adapterstringOptional"lora" | "qlora" | "full" (default: "lora")
gpu_typestringOptionalGPU type (auto-selected if omitted)
epochsnumberOptionalEpochs (default: 3)
learning_ratenumberOptionalLR (default: 2e-4)
batch_sizenumberOptionalBatch size (default: 4)
lora_ranknumberOptionalLoRA rank (default: 16)
job_namestringOptionalDisplay name
list_training_jobs

List all jobs with status, progress, model, method, GPU, cost, timestamps.

NameTypeRequiredDescription
statusstringOptional"running" | "completed" | "stopped" | "queued"
get_training_status

Detailed status: progress %, step/total, loss, LR, elapsed time, ETA, GPU utilization.

NameTypeRequiredDescription
job_idstringRequiredJob ID
get_training_metrics

Metrics history: loss curve, eval loss, learning rate schedule, eval results.

NameTypeRequiredDescription
job_idstringRequiredJob ID
get_training_logs

Raw training output logs. Shows progress, warnings, checkpoint saves, eval results.

NameTypeRequiredDescription
job_idstringRequiredJob ID
tailnumberOptionalRecent lines (default: 100)
stop_training_job

Stop a running job. Checkpoints preserved, billing stops instantly. Can resume later.

NameTypeRequiredDescription
job_idstringRequiredJob ID
resume_training_job

Resume from last checkpoint. No data lost, no epochs repeated.

NameTypeRequiredDescription
job_idstringRequiredJob ID
get_training_checkpoints

List saved checkpoints with step number, metrics, and download URL.

NameTypeRequiredDescription
job_idstringRequiredJob ID

Usage Examples

Once connected, you can ask your AI assistant to perform fine-tuning tasks in natural language. Here are some example prompts:

"Search for Llama models under 13B parameters"

Tools used: search_models

"Upload my customer-support.jsonl dataset and start an SFT job on Llama 3.1 8B with LoRA"

Tools used: upload_dataset → create_training_job

"What's the status of my running training jobs?"

Tools used: list_training_jobs

"Show me the training loss for job job_abc123"

Tools used: get_training_metrics

"Import the databricks/dolly-15k dataset from HuggingFace and fine-tune Mistral 7B using DPO"

Tools used: import_huggingface_dataset → create_training_job

"Stop the training job that's been running longest"

Tools used: list_training_jobs → stop_training_job

End-to-End Fine-Tuning Example

This example shows the complete flow, from finding a model to launching a training job, as a single conversation with your AI assistant:

text
User: I have a customer support dataset at ~/data/support-qa.jsonl.
      Fine-tune Llama 3.1 8B on it using SFT with LoRA. Use default hyperparameters.

Assistant calls: search_models(query="Llama 3.1 8B")
  → Found: meta-llama/Llama-3.1-8B-Instruct (8B params)

Assistant calls: upload_dataset(file_path="~/data/support-qa.jsonl")
  → Uploaded: ds_abc123 (12,450 rows, JSONL, validated)

Assistant calls: get_gpu_pricing()
  → Recommended: A100 80GB at $2.49/hr for 8B model

Assistant calls: create_training_job(
    model="meta-llama/Llama-3.1-8B-Instruct",
    dataset_id="ds_abc123",
    method="sft",
    adapter="lora",
    gpu_type="A100_80GB"
  )
  → Job launched: job_def456 (estimated 2-3 hours, ~$6.50)

TypeScript / JavaScript SDK

For application code, use the @usfbios/sdk package:

bash
npm install @usfbios/sdk
typescript
import { USFBios } from '@usfbios/sdk';

const client = new USFBios({
  apiKey: 'sk_live_...',        // from Dashboard → API Keys (that's all you need)
});

// Discover what your key can do
const info = await client.introspect();
console.log(info.scopes);       // ['models:read', 'datasets:write', ...]
console.log(info.org.name);     // "Arpit's Org"

// Search models
const models = await client.models.search({ query: 'llama 8B' });

// Upload a dataset
const ds = await client.datasets.upload({
  filePath: './support-qa.jsonl',
  name: 'Customer Support QA'
});

// Check wallet balance
const balance = await client.wallet.getBalance();

// Get GPU recommendation
const gpu = await client.gpu.getRecommended(
  'meta-llama/Llama-3.1-8B-Instruct'
);

// Launch fine-tuning
const job = await client.training.create({
  model: 'meta-llama/Llama-3.1-8B-Instruct',
  datasetId: ds.id,
  method: 'sft',
  adapter: 'lora',
});

// Monitor progress
const status = await client.training.get(job.id);
const metrics = await client.training.getMetrics(job.id);

// Stop / resume
await client.training.stop(job.id);
await client.training.resume(job.id);

The SDK supports both API key and JWT authentication. It works in Node.js, edge runtimes, and any JavaScript environment with native fetch.

All SDK Methods

NamespaceMethodDescription
clientintrospect()Discover API key permissions, scopes, bound org/workspace, and allowed tools
modelssearch(params?)Search base models by name/provider/size
modelsgetConfig(model)Recommended GPU, methods, and hyperparameters
datasetslist()List all datasets in workspace
datasetsupload(params)Upload a local file (JSONL/Parquet/CSV)
datasetspreview(id, params?)Preview first N rows
datasetsdelete(id)Delete a dataset
datasetsimportFromHuggingFace(params)Import from HuggingFace Hub
trainingcreate(params)Create and launch a training job
traininglist(params?)List all training jobs
trainingget(id)Get detailed job status
traininggetMetrics(id)Get loss curves and eval metrics
traininggetLogs(id, params?)Get training output logs
traininggetCheckpoints(id)List saved checkpoints
trainingstop(id)Stop a running job
trainingresume(id)Resume a stopped job
walletgetBalance()Wallet balance and pending charges
gpugetPricing()All GPU types with pricing
gpugetRecommended(model)Best GPU for a model+adapter

Python SDK

For Python applications, use the usfbios package:

bash
pip install usfbios
python
from usfbios import USFBios

client = USFBios(api_key="sk_live_...")

# Search models
models = client.models.search(query="llama 8B")

# Upload a dataset
ds = client.datasets.upload(file_path="./data.jsonl", name="My Dataset")

# Launch fine-tuning
job = client.training.create(
    model="meta-llama/Llama-3.1-8B-Instruct",
    dataset_id=ds.id,
    method="sft",
    adapter="lora",
)

# Monitor progress
metrics = client.training.get_metrics(job.id)
print(f"Loss: {metrics.current_loss}")

The Python SDK mirrors the TypeScript SDK method-for-method using snake_case naming. Async support is available via AsyncUSFBios. See the full Python SDK docs in the sidebar for complete usage, type hints, and async examples.

BiOS Documentation. Need help? Email help-bios@us.inc