Small Bun CLI agent that talks to OpenRouter and drives tools over the Model Context Protocol (MCP).
Default tool transport in the main controller is @modelcontextprotocol/server-filesystem for the current working directory. An alternate entry (src/controller/index.ts) lists tools from chrome-devtools-mcp instead.
index.html is a static docs lander for the local ./shagent CLI (not a hosted product).
- Bun
- Node/
npxavailable (MCP servers are launched vianpx -y …) OPENROUTER_API_KEYin the environment
Optional:
SHAGENT_MODEL— defaults toopenrouter/free
bun installDependencies (from package.json): @modelcontextprotocol/sdk, zod, dotenv.
export OPENROUTER_API_KEY=sk-or-...
# optional:
# export SHAGENT_MODEL=openrouter/free
./shagent 'list files in this directory'
# or
bun run ./shagent 'your task here'Without a task argument it prints:
Usage: shagent 'task description'
./shagentloadsOPENROUTER_API_KEYand constructsShagent(src/controller/shagent.ts).initialize()connects an MCP client over stdio to:npx -y @modelcontextprotocol/server-filesystem <cwd>executeTask(prompt)lists MCP tools, then loops up to 15 turns:- Calls OpenRouter
chat/completionswith the chosen model - Expects JSON in the model reply:
{"action":"tool_name","args":{…}}or{"message":"…"} - Runs matching tools via MCP and feeds results back into the message list
- Calls OpenRouter
- Stops when the model returns a
message, fails to produce an executable action, or hits the turn cap
| Path | Role |
|---|---|
shagent |
Bun shebang CLI |
src/controller/shagent.ts |
Agent class (filesystem MCP + OpenRouter loop) |
src/controller/index.ts |
Standalone MCP client smoke test against chrome-devtools-mcp |
package.json |
name shagent 1.0.0, ESM, dependencies only (no npm scripts) |
There is no bin field published to npm in this tree; run the local ./shagent file with Bun.
- Model output must be parseable JSON objects; messy replies fall through to raw logging.
- This is an early harness (few commits), not a full agent framework.