Repository navigation
MCP Server
Checked against v0.7.6 on November 13, 2026.
Kestrel can expose your pipeline to an MCP client such as an AI assistant you already use. The server is built with fastmcp and speaks SSE. It registers 15 tools: 10 that read and 5 that make small local changes (kestrel/mcp/server.py, build_mcp). Related pages: REST API, CLI reference.
Kestrel never submits an application or sends a message for you, and no MCP tool does either. The five action tools write only to Kestrel's own database or put work on its own queue. Their docstrings say so ("Reads handed-over content; never crawls or acts externally", "Only enqueues"). An assistant connected to this server can read your pipeline and move records around inside Kestrel. It cannot apply, email, or message anyone through Kestrel.
The server is off by default (mcp.enabled: false and mcp.port: 9110 in kestrel/resources/config/settings.yml). There are two ways to run it.
Inside the app. The Settings page has an MCP on/off switch (GET and POST /settings/mcp, kestrel/web/pages/settings.py). The switch writes the mcp.enabled setting row and starts or stops the server at once in a running app, with no restart. The app also starts it at launch when mcp.enabled is on (kestrel/web/app.py, _start_mcp_if_enabled). The desktop app and kestrel serve (with the worker) can host it. A process that cannot host it, such as a UI-only process, saves the setting and says "Restart Kestrel to apply." If the port is taken, the switch refuses with Port N is in use by another program. Change mcp.port in settings, or close the program using it. (kestrel/mcp/runtime.py, start).
MCP is optional, so a server that cannot start never stops Kestrel from starting. If the server fails at launch (_start_mcp_if_enabled catches any exception), note_start_failure in kestrel/mcp/runtime.py logs the real error with context and keeps a plain sentence, Kestrel turns the mcp.enabled switch off, and Settings says "MCP was turned off because it could not start: ... Turn it on again to retry." The technical text sits under Show details. The installed app ships the package metadata fastmcp reads at import (copy_metadata in packaging/kestrel.spec), which is what failed in 0.7.4. Roles that came from Remotive are left out of the read tools, as its terms ask.
On its own. kestrel mcp starts only the MCP server in the foreground and stops on Ctrl+C. --port overrides mcp.port.
uv run kestrel mcp
uv run kestrel mcp --port 9111It prints kestrel mcp serving SSE on 127.0.0.1:<port> (Ctrl+C to stop).
kestrel doctor checks that the configured port is free when MCP is enabled. When MCP is disabled the check passes with disabled (would use <port>) (kestrel/doctor.py, _check_mcp_port).
The server binds 127.0.0.1 unless LAN access (server.bind_all) is on, in which case it binds all interfaces and kestrel/mcp/server.py requires the LAN shared secret (X-Kestrel-Key, from Settings, LAN) of every non-loopback peer. A local client on the same machine needs no key. With no secret generated, an off-machine client is refused. The SSE address is:
http://127.0.0.1:9110/sse
SSE_PATH is /sse (kestrel/mcp/runtime.py). Use your own port if you changed mcp.port. The Settings switch shows the address to paste.
The repository ships no client-specific configuration. Any client that supports the SSE transport can use the address above. To confirm the server is the right one, list its tools (the check tests/test_mcp.py makes):
import asyncio
from fastmcp import Client
async def main() -> None:
async with Client("http://127.0.0.1:9110/sse") as c:
tools = await c.list_tools()
print(sorted(t.name for t in tools)) # 15 names
status = await c.call_tool("get_run_status", {})
print(status.data)
asyncio.run(main())pyproject.toml requires fastmcp>=3.4.10,<4, and uv.lock pins 3.4.10.
Two request-path guards protect the port against DNS rebinding (kestrel/mcp/server.py, sse_app). A request with an unexpected Host header is refused with 421, and a foreign Origin with 403. With LAN access on, both allowlists are pinned to the addresses this machine answers on, never to any name. A client should send the address exactly as shown in Settings.
All read tools return JSON. A missing record returns {"error": "not found"} instead of raising. Parameters marked required have no default.
| Tool | Parameters | Returns |
|---|---|---|
list_opportunities |
track, stage, verdict, score_min (all optional), limit (default 50, capped at 200) |
List of summaries: id, title, org, track, stage, verdict, score, ghost_score, liveness, closed_reason, url. |
get_opportunity |
opportunity_id (required) |
The summary plus description_md, and dimensions, blocks and legitimacy from the latest evaluation when one exists. |
search_opportunities |
query (required), track, limit (default 10) |
Semantic search results ranked by cosine similarity: opportunity_id, title, org_name, track, score, verdict, eval_score. |
get_shortlist |
track, limit (default 50, capped at 200) |
Items whose latest Tier 2 verdict is apply or pursue, ordered by score. Summaries as above. |
get_pursuits |
track |
Pursuits with pursuit_id, opportunity_id, track, status, next_action, next_action_at, title, org. |
get_org |
org_id (required) |
Organization with size_band, sector, ownership, signals, latest research (summary_md, signals, unknowns) and contacts (name, title, type). |
get_story_bank |
none | Canonical interview stories (id, title, themes, use_count, operator_edited) and a coverage block with total, gaps, covered and note. |
get_comp_intel |
title (required), geo_bucket, org_size_band, currency (default USD) |
Compensation range with n, sufficient, scope, median, p25, p75, low, high and an insufficiency message. Fewer than five observations is reported as insufficient, with a message such as "not enough data yet (3 of the 5 needed)". |
get_analytics |
track (default employment) |
{"track", "funnel", "score_vs_outcome"} with sample sizes. |
get_run_status |
none | Live pipeline activity: tasks, latest_run, quarantined. |
search_opportunities embeds your query with the same embedding model that indexed the postings, then ranks the stored vectors (kestrel/intelligence/search.py). It returns an empty list for a blank query or an empty index. Postings embedded by a different model are skipped.
get_comp_intel passes title to the comp corpus as given, without normalizing it.
When confidential mode is on, the tools that return opportunity, org, pursuit or search text replace your current employer's name with a placeholder, including in descriptions, evaluation prose, research and contacts. The module comment gives the reason: an MCP client is usually a hosted model, so this is the last place the employer should leak.
None of these contacts anyone outside Kestrel or acts on a third-party site. They change Kestrel's own records or queue work for its local worker.
| Tool | Parameters | What it does |
|---|---|---|
ingest_opportunity |
url, text, title, org_name (all optional, but one of url or text is needed), track (default employment) |
Adds a posting you hand over, as POST /api/opportunities/ingest does. Returns {"id", "title", "stage", "track"}, or {"error": "provide a url or text"}. |
trigger_scan |
source_name (required) |
Enqueues a scrape task for the named source. Later, the worker reads the source's public pages, as a scheduled scan would. Returns {"enqueued": true, "source_id": n}. Unknown names and manual sources return an error. |
trigger_evaluation |
opportunity_id (required) |
Resets the opportunity's stage to new so Tier 0 sweeps it again, and discards any one-run model choice. Returns {"id", "requeued": true}. |
set_pursuit_status |
pursuit_id, status (required), note
|
Moves a pursuit to a new status and writes a status event. Rejects a status that is not valid for the pursuit's track. |
add_note |
pursuit_id, note (required) |
Appends a timestamped line to the pursuit's notes. Returns {"pursuit_id", "noted": true}. |
Valid pursuit statuses come from PURSUIT_STATUS in kestrel/db/enums.py:
| Track | Statuses |
|---|---|
employment |
shortlisted, preparing, applied, screening, interviewing, final, offer, accepted, rejected, withdrawn, ghosted
|
consulting |
shortlisted, researching, outreach_sent, conversation, scoping, proposal_sent, negotiating, won, lost, no_response
|
set_pursuit_status with applied or outreach_sent records that you did the thing. It does not do it. The same applies to a note.
trigger_scan and trigger_evaluation change what the worker will do next. They do not run a scan or an evaluation inside the tool call, so get_run_status is how you watch the result.
Tools are registered inside build_mcp() with the @mcp.tool decorator. Every tool reuses the query and ingest code the web UI uses, so a new tool should call the same function rather than reimplementing it. TOOL_NAMES at the top of server.py lists the names, and tests/test_mcp.py::test_tools_list_matches_spec asserts that the server's tool list equals it, so update both together. Keep to the hard rule: a tool must not transmit anything to a third party on your behalf. If a change would, it is out of scope (CLAUDE.md, hard rule 1).
A tool test seeds a temporary database and calls the tool in memory:
from fastmcp import Client
from kestrel.mcp.server import build_mcp
async with Client(build_mcp()) as c:
result = await c.call_tool("get_shortlist", {})
rows = result.dataThe Chrome and Edge extension in the repository's extension/ folder does not use this server. It calls the web API on the app's own port (GET /health, POST /api/opportunities/ingest and POST /api/opportunities/lookup) and carries the same LAN shared secret in X-Kestrel-Key. See REST API.
Start here
Interfaces
Extending Kestrel
How it works
- Prompts and context budgets
- Document engine
- Learning loop internals
- Analytics internals
- Task queue and concurrency
- Database schema
Shipping and safety
- Packaging and releases
- Preflight and diagnostics
- Security and privacy model
- Outbound calls
- Benchmarking
Workarounds and Troubleshooting