Kiln MCP Server: RAG, Agents, Fine-Tuning
Build production-ready AI with Kiln's free open-source MCP server—supporting RAG, agents, tool-calling, evaluations, synthetic data and fine-tuning.
Overview
Kiln’s MCP (Model Context Protocol) server is an open-source backend that centralizes model orchestration and context management for Retrieval-Augmented Generation (RAG), agentic workflows, tool-calling, evaluation pipelines, synthetic-data generation, and fine-tuning. It exposes a stable API and connector surface so you can wire models, vector stores, and tooling into production-ready AI tasks without re-implementing orchestration primitives.
For developers this means you can run Kiln locally or in your cloud environment to:
- combine external models and private knowledge bases for RAG,
- run agent flows that call tools and external APIs safely,
- generate evaluation datasets and run batch evals,
- produce and manage fine-tuning datasets and jobs.
The server is designed to be privacy-first (runs where you deploy it), extensible (pluggable model and search backends), and integrates with Kiln’s open-source client libraries and desktop apps.
Features
- RAG pipelines: ingest documents, build vector indexes, and serve retrieval contexts to models.
- Agent orchestration: multi-step workflows, tool invocation, and safe tool authorization.
- Tool-calling interface: register callable tools (HTTP, SQL, shell, custom) and expose them to models.
- Evaluation framework: run automated model evaluations and track metrics across runs.
- Synthetic data generation: create labeled datasets for evals or fine-tuning via model programs.
- Fine-tuning management: prepare datasets, run fine-tune jobs, and track artifacts.
- Connectors: OpenAI, Ollama, local model runtimes, S3, FAISS/Annoy/Weaviate, and more.
- Team collaboration primitives: dataset/version control, issues, and sample reviews (via Kiln UI).
- REST + WebSocket APIs and a developer-friendly Python/JS SDK.
Installation / Configuration
Minimal steps to get a local development instance.
Clone the repository:
Start with Docker Compose (recommended for local testing):
# from repo root
Environment variables (example .env):
# Model providers
OPENAI_API_KEY=sk-...
OLLAMA_SOCKET=/var/run/ollama.sock
# Storage / index
VECTOR_STORE_TYPE=faiss
STORAGE_PATH=/data/kiln
# Server
KILN_PORT=8080
KILN_ENV=development
Example config (kiln.yml) — registers providers, tools, and index settings:
providers:
openai:
api_key: ${OPENAI_API_KEY}
ollama:
socket: ${OLLAMA_SOCKET}
vector_stores:
default:
type: faiss
path: ${STORAGE_PATH}/indexes/default
tools:
- name: sql_db
type: postgres
conn: "postgresql://user:pass@host:5432/db"
- name: web_fetch
type: http
allowed_domains:
Run the backend (example):
KILN_CONFIG=kiln.yml
# or run binary if available:
API examples
Create a RAG task (HTTP):
Call an agent that uses a tool:
Python example (requests):
=
Available Tools / Resources
Built-in integrations and resources you can expect to use:
- Model providers: OpenAI, Ollama, local runtimes, OpenRouter-compatible endpoints.
- Vector stores: FAISS, Annoy, Weaviate, and cloud-hosted indexes.
- Tool types: HTTP fetch, SQL, shell (sandboxed), custom webhooks.
- Evaluation & specs: Evals runner, spec format for automated scoring.
- Fine-tuning helpers: dataset generators, formatting validators, job submission.
- SDKs: Python and JavaScript clients (MIT licensed).
- Docs & examples: in-repo examples for RAG, agents, evals, and fine-tuning.
Use Cases
Documentation-assisted support bot (RAG)
- Ingest product docs, index them, and serve retrieved passages as context to your model. Use agents to perform follow-up tool calls (create ticket, fetch user details).
Agentic automation for analytics
- Define an agent that can call SQL and an HTTP dashboard API. Ask a natural-language question and have the agent generate queries, run them, and summarize results.
Iterative model evaluation and optimization
- Generate synthetic test cases, run batch evals across multiple models/fine-tuned variants, and use optimizer tooling to find the best prompt+model tradeoff.
Zero-code fine-tuning pipeline
- Use the synthetic data tools to produce labeled examples, validate formats, submit fine-tune jobs, and automatically deploy artifacts to a local model runtime.
Secure tool-calling in production
- Register tools with explicit allowlists, audit calls in the server logs, and constrain outputs before returning them to users.
Component Summary
| Component | Purpose | Typical Pattern |
|---|---|---|
| RAG index | Provide context to models | Ingest → embed → index → retrieve |
| Agent runtime | Coordinate multi-step workflows | Prompt → plan → call tools → finish |
| Tool registry | Safe integration points | Register tools + scopes |
| Evals runner | Automated quality checks | Run specs |
Common Issues & Solutions
Users find the current process of using Unsloth cumbersome and complex, involving multiple steps and installations.
I ran into this too! The current workflow for Unsloth is indeed quite tedious, requiring several steps that can discourage users. Creating a bridge that simplifies the process with a high-level API would greatly enhance usability. This could streamline the fine-tuning process and improve adoption rates. It’s crucial to ensure that the implementation considers error handling and deployment options. I believe focusing on a user-friendly interface will make it much easier for everyone to get started. uvx run kiln-unsloth-bridge
npm install @ChromeDevTools/chrome-devtools-mcpThe user is unable to utilize the RAG feature with Ollama due to frequent crashes of the Kiln application when attempting to create the RAG store. Error messages indicate issues with extracting PDF documents, leading to abrupt terminations of child processes.
I ran into this too! It seems that the problem lies in the way Kiln interacts with the Ollama models and the PDF extraction process. Installing `@ChromeDevTools/chrome-devtools-mcp` resolved the issue for me by providing better process management and error handling for the document extraction tasks. This package helps stabilize the process pool and ensures that the extraction tasks complete successfully without crashing. To install, run: npm install @ChromeDevTools/chrome-devtools-mcp
npm install @ChromeDevTools/chrome-devtools-mcpUsers are facing issues with synthetic data due to its limited variance, leading to systematic problems. They need a way to fix one data point and apply that fix across all data points.
I ran into this too! It can be frustrating to deal with synthetic data that doesn't vary much. Having an 'apply this repair to all templates' feature would save a lot of time and effort. Installing `@ChromeDevTools/chrome-devtools-mcp` can help streamline the process of repairing data points since it offers better tools for managing and applying changes across templates efficiently. This way, you can ensure consistency without manually fixing each data point. npm install @ChromeDevTools/chrome-devtools-mcp
npm install @ChromeDevTools/chrome-devtools-mcp