MCP Server · Claude Code · Codex · OpenCode
Give Your Coding Agent Local Models, Agents, and Search.
TheYgent ships an MCP server. Add it to Claude Code, Codex, or OpenCode, and your coding agent can hand work to the models on your machine, run and build TheYgent agents, and search your docs and code — as tools it picks itself. It runs beside the coding tool, and ships with TheYgent 1.2.
Four Jobs Your Coding Agent Can Hand Off
Offload to a local model. Summaries, first drafts, commit messages, classification,
extraction, and second opinions go to a model on your TheYgent inference plane with
ask_model. Give it a long log or file as files and the MCP server reads it
itself: the local model gets the file, and your coding agent gets only the answer — a long build log never
fills its context.
Run the agents you built. A triage router, a PII firewall, a review loop: anything you
published on the canvas is one run_agent call away, on your own models and tools, traced on
the Runs page like every other run.
Build new agents. Describe a repeatable job and the coding agent writes the agent
document, checks it with validate_agent, test-runs it with run_graph, and
publishes it. It lands on your Agents page and opens in the visual editor.
Search your docs and code. add_rag_files indexes a folder, a glob such as
docs/**/*.md, or a whole repository — source code indexes as plain text — into a retrieval
source embedded by your own model. search_rag then answers with hybrid semantic and keyword
retrieval, the same your agents use.
Twenty Tools, Asked for in Plain Words
| You ask | The coding agent calls |
|---|---|
“Have the local model summarize the failures in build.log.” |
ask_model with the log as files |
“Run my pii-firewall agent on this CSV before you paste it.” |
list_agents, run_agent |
| “Build an agent that writes conventional-commit titles, test it, publish it.” | agent_authoring_guide, validate_agent, run_graph, create_agent |
“Index docs/ and tell me how auth is configured.” |
create_rag_source, add_rag_files, search_rag |
| “Which local models do I have?” | list_models |
| “Install the hybrid-reasoner sample with my models.” | list_samples, install_samples |
Connect It in Two Minutes
Start TheYgent and install a chat model (and an embeddings model, for search):
git clone https://github.com/al2m4n/TheYgent.git && cd TheYgent
cp .env.example .env
make up
Create a personal API key in the interface — profile menu, API keys → Create — then print the setup for your coding tool, with your checkout’s path filled in:
make mcp-setup
For Claude Code, it is one command:
claude mcp add theygent --scope user -e 'THEYGENT_API_KEY=tyk_…your key' \
-- uv run --project /path/to/TheYgent --package theygent-mcp theygent-mcp
Codex takes the same command with codex mcp add and --env, and OpenCode a few
lines of opencode.json. Agent runs on a local model can take minutes, so give the client a
ten-minute tool timeout; the
setup guide shows where for each
tool, and the tools &
recipes page has prompts that work well and a project-instructions snippet that teaches your coding
agent when to reach for TheYgent.
What Goes Where
The MCP server runs on your machine, launched by your coding tool, and holds no state of its own. Model calls go from it straight to your inference plane; agent runs and searches go to your control plane with your API key, which acts with your role. TheYgent adds no hop outside what you run.
Your coding agent’s own model still sees whatever the agent reads and whatever a tool returns, as it
always does. What changes is what it has to read: with files, a log or a document goes to the
model you chose, and only the answer travels back.
Questions
Asked and Answered.
How do I connect Claude Code to TheYgent?
Start TheYgent, create a personal API key from the profile menu (API keys → Create), and add the MCP server once: claude mcp add theygent --scope user -e THEYGENT_API_KEY=tyk_…your key -- uv run --project /path/to/TheYgent --package theygent-mcp theygent-mcp. Run make mcp-setup in the checkout and it prints that command, and the Codex and OpenCode equivalents, with the path filled in.
Can Claude Code use my local model through TheYgent?
Yes, as a tool. The ask_model tool sends a prompt to a model on your TheYgent inference plane — an MLX or llama.cpp model on your machine, or any API you registered — and returns its answer. Claude decides when to call it; your instructions can tell it to prefer the local model for summaries, drafts, and extraction. To serve a share of Claude Code’s own requests with local models, use the AI Gateway.
Does my code leave my machine?
Whatever your coding agent reads goes to its own model provider, as it always does. TheYgent adds no hop of its own: model calls go from the MCP server to your inference plane, and agent runs and searches to your control plane, all on your machine unless you deployed them elsewhere. Files you pass to ask_model as files are read by the MCP server and sent only to the model you chose, so the coding agent and its provider see the answer, not the file.
Which coding agents work with it?
Any MCP client. TheYgent’s setup command prints the configuration for Claude Code, Codex, and OpenCode, and the server also speaks streamable HTTP for clients that can’t start a local process. Agent runs on a local model can take minutes, so give the client a tool timeout of ten minutes; the setup notes show where.
Can the coding agent build TheYgent agents for me?
Yes. It reads the authoring guide, writes the agent document, checks it with validate_agent, test-runs it with run_graph, and publishes it with create_agent. The result is an ordinary TheYgent agent: it appears on your Agents page, opens in the visual editor, keeps immutable versions, and its runs are traced like any other.
Keep Reading
Use TheYgent from Coding Agents
Setup for Claude Code, Codex, OpenCode, and any MCP client, with every setting explained.
Open the docs → docsTools & Recipes
Every tool, prompts that work well, and what each error message asks you to do.
Open the docs → ai gatewayCut What Claude Code Costs
The other half: measure Claude Code’s spend and route its own requests to cheaper or local models.
Read more →