Serac Documentation
Serac is an open-source build agent for ServiceNow developers. Bring your approved LLM (Claude, GPT, DeepSeek, or local Ollama), point it at an instance, and ship scoped apps, business rules, and update sets in natural language. Your keys stay yours, your code stays in your repo.
Installation
Requirements
- Node.js 18+ - Required runtime
- npm 8.0+ - Package manager
- ServiceNow instance - With OAuth configured
- LLM provider - API key or local Ollama
Install via npm
# Global installation (recommended) npm install -g @serac-labs/serac # Verify installation serac --version
Serac includes a built-in TUI (Terminal User Interface). Run serac to start the interactive AI development experience.
Quick Start
1. Start Serac
# Start the TUI (auto-initializes on first run) serac # This automatically creates: # - .mcp.json (MCP server configuration) # - CLAUDE.md (AI agent instructions) # - .env (environment configuration)
2. Authenticate (in TUI)
# In the TUI, type /auth to authenticate /auth # This configures: # - LLM provider (Claude, GPT, Gemini, Ollama) # - ServiceNow OAuth credentials # - Enterprise features (optional)
3. Start Building
# Just type your request in natural language: "Create a widget showing high-priority incidents" "Show me all incidents from last week" "Create a business rule for auto-assignment"
Authentication Overview
Serac uses OAuth 2.0 for secure ServiceNow authentication. Credentials are stored securely and automatically refreshed.
Authentication Priority
Serac checks credentials in this order:
- Environment variables - Highest priority
- auth.json - Auto-loaded from the Serac TUI
- .mcp.json credentials - Project-specific
- Interactive login - Via
/authcommand in TUI
ServiceNow OAuth Setup
Create an OAuth application in your ServiceNow instance:
- Navigate to System OAuth → Application Registry
- Click New → Create an OAuth API endpoint for external clients
- Configure:
Name: SeracRedirect URL:http://localhost:3005/callbackRefresh Token Lifespan:0(unlimited)
- Copy the Client ID and Client Secret
Never commit OAuth credentials to version control. Use environment variables or the secure credential storage.
Credential Storage
Serac stores credentials securely at:
~/.local/share/serac/auth.json
This file is:
- Created automatically by
/authcommand in TUI - Contains encrypted OAuth tokens
- Tokens are automatically refreshed
- Never synced to cloud or version control
Environment Variables (Alternative)
# ServiceNow credentials SERVICENOW_INSTANCE_URL=https://your-instance.service-now.com SERVICENOW_CLIENT_ID=your-client-id SERVICENOW_CLIENT_SECRET=your-client-secret # Optional: Pre-configured refresh token SERVICENOW_REFRESH_TOKEN=your-refresh-token
LLM Providers
Serac supports 75+ AI providers via Models.dev. Configure via environment variables:
| Provider | Environment Variable | Notes |
|---|---|---|
| Claude (Anthropic) | ANTHROPIC_API_KEY |
Recommended |
| GPT-4 (OpenAI) | OPENAI_API_KEY |
|
| Gemini (Google) | GOOGLE_API_KEY |
|
| DeepSeek | DEEPSEEK_API_KEY |
|
| Groq | GROQ_API_KEY |
Fast inference |
| OpenRouter | OPENROUTER_API_KEY |
Access to 100+ models |
| Azure OpenAI | AZURE_API_KEY |
Enterprise |
| GitHub Copilot | serac auth login |
OAuth login |
| Together AI | TOGETHER_API_KEY |
|
| Fireworks AI | FIREWORKS_API_KEY |
|
| Mistral AI | MISTRAL_API_KEY |
|
| xAI (Grok) | XAI_API_KEY |
|
| Ollama (Local) | OLLAMA_BASE_URL |
100% Free, runs locally |
Using Ollama (Free, Local)
# Install Ollama curl -fsSL https://ollama.com/install.sh | sh # Pull a model ollama pull llama3.3 # Configure Serac DEFAULT_LLM_PROVIDER=ollama OLLAMA_BASE_URL=http://localhost:11434 DEFAULT_OLLAMA_MODEL=llama3.3
For the complete list of 75+ supported AI providers and models, visit models.dev. Serac uses their unified API to support Claude, GPT, Gemini, DeepSeek, Mistral, Llama, and many more.
Commands Reference
CLI Commands
| Command | Description |
|---|---|
serac |
Start the TUI (auto-initializes on first run) |
serac --version |
Show Serac version |
serac --help |
Show help information |
TUI Commands (inside Serac)
Type / followed by a command name. Most commands have keyboard shortcuts using ctrl+x as the leader key.
| Command | Keybind | Description |
|---|---|---|
/agents |
ctrl+x a |
List and switch between agents |
/auth, /login |
Authenticate with LLM providers and ServiceNow | |
/compact, /summarize |
ctrl+x c |
Compact/summarize current session |
/debug |
Toggle debug mode for troubleshooting | |
/details |
ctrl+x d |
Toggle tool execution details |
/editor |
ctrl+x e |
Open external editor for composing messages |
/exit, /quit, /q |
ctrl+x q |
Exit Serac |
/export |
ctrl+x x |
Export conversation to Markdown |
/help |
ctrl+x h |
Show help dialog |
/init |
ctrl+x i |
Create or update AGENTS.md file |
/models |
ctrl+x m |
List and select AI models |
/new, /clear |
ctrl+x n |
Start a new session |
/redo |
ctrl+x r |
Redo previously undone message (requires Git) |
/report |
Generate session report with token usage and costs | |
/sessions, /resume |
ctrl+x l |
List and switch between sessions |
/share |
ctrl+x s |
Share current session |
/themes |
ctrl+x t |
List and select themes |
/thinking |
Toggle thinking blocks display | |
/timeline, /history |
Show session timeline | |
/undo |
ctrl+x u |
Undo last message and file changes (requires Git) |
/unshare |
Stop sharing current session |
File References & Bash Commands
Use @ to reference files in your messages (fuzzy search). Use ! to run shell commands.
# Reference a file How is auth handled in @src/auth/handler.ts? # Run a shell command !git status # Both outputs are added to the conversation
Editor Setup
The /editor and /export commands use your EDITOR environment variable.
# Add to ~/.bashrc or ~/.zshrc export EDITOR="code --wait" # VS Code export EDITOR="cursor --wait" # Cursor export EDITOR="vim" # Vim export EDITOR="nano" # Nano
Keyboard Shortcuts
Serac uses a leader key pattern (default: ctrl+x) to avoid conflicts with your terminal. Press the leader key first, then the shortcut.
| Action | Default Keybind |
|---|---|
| Help | ctrl+x h |
| Exit | ctrl+c or ctrl+x q |
| New session | ctrl+x n |
| Session list | ctrl+x l |
| Compact session | ctrl+x c |
| Export session | ctrl+x x |
| Share session | ctrl+x s |
| Interrupt | esc |
| Open editor | ctrl+x e |
| Model list | ctrl+x m |
| Cycle recent models | F2 |
| Agent list | ctrl+x a |
| Cycle agents | Tab / Shift+Tab |
| Theme list | ctrl+x t |
| Tool details | ctrl+x d |
| Thinking blocks | ctrl+x b |
| Init AGENTS.md | ctrl+x i |
| Undo | ctrl+x u |
| Redo | ctrl+x r |
| Copy message | ctrl+x y |
| Page up/down | PgUp / PgDown |
| Submit input | Enter |
| New line in input | Shift+Enter or ctrl+j |
Customize Keybinds
Override keybinds in your .mcp.json config. Use <leader> to reference the leader key, or "none" to disable.
{
"$schema": "https://serac.build/config.json",
"keybinds": {
"leader": "ctrl+x",
"app_help": "<leader>h",
"session_compact": "none",
"input_submit": "ctrl+enter"
}
}
Configuration Reference
Configure Serac using .mcp.json (or .mcp.jsonc for comments). Supports JSON Schema for autocomplete.
Config Locations (by precedence)
| Location | Purpose |
|---|---|
SNOW_FLOW_CONFIG env var | Custom config path (highest priority) |
.mcp.json in project | Project-specific settings |
~/.config/serac/.mcp.json | Global settings (themes, providers) |
Main Config Options
{
"$schema": "https://serac.build/config.json",
// Model configuration
"model": "anthropic/claude-sonnet-4-20250514",
"small_model": "anthropic/claude-3-5-haiku-20241022",
// UI settings
"theme": "serac",
"autoupdate": true,
// Tool restrictions
"tools": {
"write": false, // Disable write tool
"bash": false // Disable bash tool
},
// Permission modes: "allow", "ask", "deny"
"permission": {
"edit": "ask",
"bash": "ask"
},
// Sharing: "manual", "auto", "disabled"
"share": "manual",
// Instructions from files
"instructions": ["CONTRIBUTING.md", "docs/*.md"],
// Disable specific providers
"disabled_providers": ["openai", "gemini"],
// Provider configuration
"provider": {},
// Custom agents, commands, keybinds
"agent": {},
"command": {},
"keybinds": {},
// MCP servers
"mcp": {}
}
Variable Substitution
Use {env:VAR_NAME} for environment variables, {file:path} for file contents.
{
"model": "{env:SNOW_FLOW_MODEL}",
"provider": {
"openai": {
"options": {
"apiKey": "{file:~/.secrets/openai-key}"
}
}
}
}
Agents
Serac uses specialized agents for different tasks. Switch agents with /agents or Tab.
Built-in Agents
| Agent | Description |
|---|---|
| Build | General purpose agent for building and implementing. Can read, write, and execute code. |
| Plan | Creates detailed implementation plans before coding. Focuses on architecture and design. |
Custom Agents
Define custom agents in .mcp.json or as markdown files in .serac/agent/.
{
"agent": {
"code-reviewer": {
"description": "Reviews code for best practices",
"model": "anthropic/claude-sonnet-4-20250514",
"prompt": "You are a code reviewer. Focus on security, performance, and maintainability.",
"tools": {
"write": false, // Read-only agent
"edit": false
}
}
}
}
Or create .serac/agent/code-reviewer.md:
--- description: Reviews code for best practices model: anthropic/claude-sonnet-4-20250514 tools: write: false edit: false --- You are a code reviewer. Focus on security, performance, and maintainability.
Custom Commands
Create custom slash commands for repetitive tasks. Define in .mcp.json or as markdown files.
Quick Example
Create .serac/command/test.md:
--- description: Run tests with coverage agent: build --- Run the full test suite with coverage report. Focus on failing tests and suggest fixes.
Now run /test in the TUI.
Command Features
| Feature | Syntax | Example |
|---|---|---|
| Arguments | $ARGUMENTS, $1, $2 | /component Button |
| Shell output | !`command` | !`git log -5` |
| File reference | @path/to/file | @src/api.ts |
Command Locations
- Global:
~/.config/serac/command/ - Per-project:
.serac/command/
IDE Integration
Serac integrates with VS Code, Cursor, Windsurf, and any IDE with a terminal.
Keyboard Shortcuts
| Action | Mac | Windows/Linux |
|---|---|---|
| Quick Launch | Cmd+Esc | Ctrl+Esc |
| New Session | Cmd+Shift+Esc | Ctrl+Shift+Esc |
| File Reference | Cmd+Option+K | Ctrl+Alt+K |
Installation
The extension installs automatically when you run serac in VS Code's integrated terminal.
Manual install: Search for Serac in the Extension Marketplace.
Tool Permissions
By default, Serac allows all operations. Configure granular controls in .mcp.json.
{
"$schema": "https://serac.build/config.json",
"permission": {
"edit": "ask", // Prompt before editing
"bash": "ask", // Prompt before bash commands
"webfetch": "deny" // Disable web fetching
}
}
Permission Values
"allow"— Allow without approval"ask"— Prompt for approval"deny"— Disable the tool
Granular Bash Permissions
{
"permission": {
"bash": {
"git push": "ask",
"git status": "allow",
"terraform *": "deny",
"*": "ask"
}
}
}
Project Rules (AGENTS.md)
Create an AGENTS.md file with custom instructions for Serac. Similar to Cursor rules.
Initialize
Run /init in the TUI to generate an AGENTS.md based on your project structure.
Example AGENTS.md
# My Project Rules ## Project Structure - `packages/` - Workspace packages - `infra/` - Infrastructure definitions ## Code Standards - Use TypeScript with strict mode - Shared code goes in `packages/core/` - Follow ESLint and Prettier configs
Rule Locations
- Project:
AGENTS.mdin project root - Global:
~/.config/serac/AGENTS.md
Custom Instruction Files
Include additional files via .mcp.json:
{
"instructions": ["CONTRIBUTING.md", "docs/*.md", ".cursor/rules/*.md"]
}
Plugins
Extend Serac with JavaScript/TypeScript plugins. Place in .serac/plugin/ or ~/.config/serac/plugin/.
Basic Plugin Structure
// .serac/plugin/example.js
export const MyPlugin = async ({ project, client, $, directory }) => {
console.log("Plugin initialized!")
return {
// Hook into events
event: async ({ event }) => {
if (event.type === "session.idle") {
// Session completed
}
},
// Intercept tool execution
"tool.execute.before": async (input, output) => {
if (input.tool === "read" && output.args.filePath.includes(".env")) {
throw new Error("Do not read .env files")
}
}
}
}
Themes
Select from built-in themes or create custom ones. Use /themes or set in config.
Built-in Themes
| Theme | Description |
|---|---|
serac | Default theme |
system | Adapts to terminal colors |
tokyonight | Popular dark theme |
catppuccin | Pastel color theme |
gruvbox | Retro warm theme |
nord | Arctic blue theme |
matrix | Green on black |
one-dark | Atom One Dark |
Custom Themes
Create JSON files in ~/.config/serac/themes/ or .serac/themes/.
GitHub Integration
Use Serac in GitHub issues and PRs. Mention /serac or /oc in comments.
Features
- Triage issues and explain them
- Fix issues and implement features in a new branch
- Submit PRs with changes
- Runs securely in your GitHub Actions runner
Installation
serac github install
This sets up the GitHub App, workflow file, and secrets.
HTTP Server API
Run a headless HTTP server for programmatic access to Serac.
serac serve --port 4096 --hostname 127.0.0.1
API Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /doc | OpenAPI 3.1 spec |
| GET | /app | Get app info |
| GET | /session | List sessions |
| POST | /session | Create session |
| POST | /session/:id/chat | Send message |
| GET | /config/providers | List providers |
Troubleshooting
Log Files
- macOS/Linux:
~/.local/share/serac/log/ - Windows:
%USERPROFILE%\.local\share\serac\log\
Run with --log-level DEBUG for detailed logs.
Common Issues
| Issue | Solution |
|---|---|
| Won't start | Check logs, run with --print-logs, upgrade with serac upgrade |
| Auth issues | Re-run serac auth login <provider> |
| Model not found | Check model name format: provider/model |
| ProviderInitError | Delete ~/.local/share/serac and re-auth |
| API errors | Clear cache: rm -rf ~/.cache/serac |
| Copy/paste on Linux | Install xclip, xsel, or wl-clipboard |
Getting Help
- GitHub Issues: github.com/serac-labs/serac/issues
- Discord: discord.gg/serac
TUI Workflow
The Serac TUI provides an interactive conversational interface for ServiceNow development:
# Create a widget "Create a dashboard widget for incident metrics" # Automate a process "Create business rule to auto-assign incidents by category" # Query and analyze "Analyze incident trends from the past month" # Complex task with multiple agents "Build a complete workspace for IT support"
Serac automatically creates isolated update sets for each task, ensuring clean deployments and easy rollbacks.
MCP Tools Overview
Serac provides 385+ MCP tools across 80 functional domains, all accessible through natural language commands via the unified MCP architecture.
Complete Tool Reference
Loading the complete tool reference from the source of truth…
MCP Configuration
The .mcp.json file configures MCP servers:
{
"mcp": {
"servicenow-unified": {
"type": "local",
"command": ["node", "dist/mcp/servicenow-mcp-unified/index.js"],
"environment": {
"SERVICENOW_INSTANCE_URL": "{{SNOW_INSTANCE}}",
"SERVICENOW_CLIENT_ID": "{{SNOW_CLIENT_ID}}",
"SERVICENOW_CLIENT_SECRET": "{{SNOW_CLIENT_SECRET}}"
},
"enabled": true
}
}
}
Use With Any AI IDE
Serac works with any MCP-compatible AI tool. When you start Serac for the first time, it automatically generates configuration at .mcp.json and syncs to .snow-code/config.json.
| AI Tool | Config Location | Setup |
|---|---|---|
| Serac TUI Recommended | Built-in | Just run serac |
| Claude Desktop | claude_desktop_config.json |
Copy config with mcpServers key |
| Cursor | .cursor/mcp.json |
Copy .mcp.json to project |
| Windsurf | mcp_config.json |
Copy .mcp.json to project |
| Continue.dev | .continue/config.json |
Add to mcpServers array |
Setup for Claude Desktop
Claude Desktop uses a different key (mcpServers) than other tools:
# macOS config location ~/Library/Application Support/Claude/claude_desktop_config.json # Windows config location %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"servicenow-unified": {
"command": "node",
"args": ["/path/to/serac/dist/mcp/servicenow-mcp-unified/index.js"],
"env": {
"SERVICENOW_INSTANCE_URL": "https://your-instance.service-now.com",
"SERVICENOW_CLIENT_ID": "your-client-id",
"SERVICENOW_CLIENT_SECRET": "your-client-secret"
}
}
}
}
Claude Desktop uses mcpServers with command + args format.
Other tools (Cursor, Windsurf, Continue.dev) use mcp with command array format.
Setup for Cursor
# After starting serac once, copy config to Cursor cp .mcp.json .cursor/mcp.json # Or create .cursor directory first mkdir -p .cursor && cp .mcp.json .cursor/mcp.json
Setup for Windsurf
# After starting serac once, copy config to Windsurf
cp .mcp.json mcp_config.json
Setup for Continue.dev
# Continue.dev config location
~/.continue/config.json
Add the MCP servers to your Continue.dev config:
{
"experimental": {
"modelContextProtocolServers": [
{
"transport": {
"type": "stdio",
"command": "node",
"args": ["/path/to/serac/dist/mcp/servicenow-mcp-unified/index.js"]
}
}
]
}
}
To find the path to your Serac installation:
# Global npm installation npm root -g # Output: /usr/local/lib/node_modules # Full path: /usr/local/lib/node_modules/@serac-labs/serac/dist/mcp/... # Or use which to find the binary which serac
ES5 JavaScript Requirement
ServiceNow runs on Mozilla Rhino (2009), which ONLY supports ES5 JavaScript. Any ES6+ syntax will cause runtime errors.
ES6+ Features That WILL CRASH
// ALL OF THESE BREAK SERVICENOW: const x = 5; // SyntaxError let items = []; // SyntaxError const fn = () => {}; // SyntaxError var msg = `Hello ${name}`; // SyntaxError for (let item of items) {} // SyntaxError var {name, id} = user; // SyntaxError array.map(x => x.id); // SyntaxError class MyClass {} // SyntaxError
Correct ES5 Syntax
// THESE WORK IN SERVICENOW: var x = 5; var items = []; function fn() { return 'result'; } var msg = 'Hello ' + name; for (var i = 0; i < items.length; i++) { var item = items[i]; } var name = user.name; var id = user.id;
Serac automatically validates all scripts for ES5 compliance before deployment.
Update Set Management
Update Sets track ALL changes for deployment between instances. Always create an Update Set before making changes.
Workflow
// 1. Create Update Set FIRST snow_update_set_manage({ action: 'create', name: "Feature: Incident Dashboard", description: "Widget showing incident metrics" }); // 2. Develop (changes auto-tracked) snow_create_artifact({...}); snow_create_business_rule({...}); // 3. Complete Update Set snow_update_set_manage({ action: 'complete', update_set_id: 'sys_id_here' });
Serac uses a service account for API calls. Update Sets are automatically set as current for this account when auto_switch=true (default).
Widget Coherence
ServiceNow widgets require perfect synchronization between Server Script, Client Script, and HTML Template.
The Three-Way Contract
// SERVER SCRIPT - Initialize data data.message = "Hello"; data.items = []; if (input.action === 'loadItems') { data.items = getItems(); } // CLIENT SCRIPT - Handle UI interactions c.loadItems = function() { c.server.get({action: 'loadItems'}).then(function() { console.log(c.data.items); }); }; // HTML TEMPLATE - Display data <button ng-click="loadItems()">Load</button> <div ng-repeat="item in data.items">{{item}}</div>
Coherence Checklist
- Every
data.propertyin server is used in HTML/client - Every
ng-click="method()"in HTML has matchingc.methodin client - Every
c.server.get({action})in client has matchingif(input.action)in server
ServiceNow Permissions
Serac follows the principle of least privilege. Permissions are organized into 5 tiers — grant only what your team needs. We strongly recommend using a development or sandbox instance and following the standard DTAP/OTAP workflow.
Stakeholder Access (Read-Only)
For stakeholders using the portal AI chat or Serac TUI in read-only mode. No data can be created, modified, or deleted.
Required Roles
snc_read_only— or custom role with read ACLsrest_api_explorer— REST API access
API Endpoints (GET only)
GET /api/now/table/*— Table APIGET /api/now/stats/*— Stats APIGET /api/now/attachment— Attachment API
Tables accessed: incident, change_request, problem, sc_request, task_sla, cmdb_ci_*, kb_knowledge, sys_dictionary, sp_widget, sn_customerservice_case, and more.
Developer Access (5-Tier Model)
For developers using Serac to build on ServiceNow. Create a custom ServiceNow role with only the tiers your team needs.
TIER 1 Read Only — ~100 tools
Query incidents, CMDB, knowledge, users, SLAs, logs. No data modification.
Roles: snc_read_only + rest_api_explorer
Endpoints: GET /api/now/table/*, GET /api/now/stats/*
TIER 2 ITSM Write — ~55 tools
Create/update incidents, changes, problems, catalog requests, assets, HR cases, CMDB CIs.
Roles: itil, catalog_admin, asset, cmdb_write
Tables: incident, change_request, problem, sc_request, cmdb_ci_*, alm_asset, kb_knowledge
TIER 3 Development Artifacts — ~130 tools
Create/modify business rules, script includes, widgets, flows, UI policies, reports, workspaces.
Roles: admin, flow_designer, report_admin
Tables: sys_script*, sp_widget, sp_page, sys_hub_flow, sys_ui_*, wf_workflow, sys_report
TIER 4 Script Execution — ~13 tools
Execute server-side JavaScript via GlideRecord. Full instance access — bypasses table-level ACLs.
Roles: admin (required)
All script executions are validated for ES5 compatibility and logged with full audit trails.
TIER 5 System Administration — ~30 tools
System properties, Update Sets, ACLs, user/role management. Changes affect instance-wide behavior.
Roles: admin (required)
Tables: sys_properties, sys_update_set, sys_security_acl, sys_user, sys_user_role, sys_user_group
API Endpoints Used (Developer)
| Endpoint | Methods | Purpose |
|---|---|---|
/api/now/table/* | GET, POST, PUT, PATCH, DELETE | All table operations |
/api/now/stats/* | GET | Aggregate queries |
/api/now/attachment | GET, POST, DELETE | File attachments |
/api/now/v1/batch | POST | Batch operations |
/api/sn_sc/servicecatalog/* | GET, POST | Service Catalog |
/api/now/graphql | POST | Flow Designer |
/api/now/atf/test/* | POST | ATF test execution |
/api/now/v1/ml/* | POST | Machine Learning |
DTAP / OTAP Recommendation
Always develop and test on a sub-production instance first. Promote changes to production via Update Sets. Serac automatically tracks all modifications in Update Sets for review and rollback.
Audit & Compliance
All tool executions are logged with timestamps, user identity, and operation details. Script executions include full audit trails. Update Sets provide complete change tracking with rollback capability.
Enterprise Features Enterprise
Serac Enterprise adds powerful integrations for team workflows:
Integration Setup
# In the TUI, authenticate with enterprise features /auth # Connect Jira # (Follow prompts to authorize) # Then in the TUI, complete a Jira story: "Complete JIRA-1234"
Manage licenses, users, and integrations at dashboard.serac.build