A minimal NestJS app that lets Claude use MCP-style tools backed by hardcoded JSON.
npm installCreate a .env file in the project root:
ANTHROPIC_API_KEY=sk-ant-...your key here...
ANTHROPIC_MODEL=claude-2 # optional override; set this to a model your Anthropic key supports
Start the server:
npx nest start --watch
# or: npm run start:devServer runs on http://localhost:3000
POST http://localhost:3000/ai/ask
Content-Type: application/json
{ "message": "What projects are currently active?" }{ "message": "Give me full details about the Alpha Launch project" }
{ "message": "Search for documents about authentication" }
{ "message": "Who owns the Gamma API project and what's the deadline?" }
{ "message": "List all projects and then show me the detail of the on-hold one" }{
"answer": "There are two active projects:\n1. **Alpha Launch** (p1) — owned by Alice\n2. **Gamma API** (p3) — owned by Carol",
"toolCallsUsed": ["get_project_list"],
"timestamp": "2026-05-18T10:32:00.000Z"
}The toolCallsUsed field shows exactly which MCP tools Claude chose to call.
A log of every tool call is also written to tool-call-log.json in the project root.
src/
ai/
tools.ts ← JSON data + tool definitions + executor
ai.service.ts ← calls Claude API, runs the tool loop, writes logs
ai.controller.ts ← POST /ai/ask endpoint
ai.module.ts
app.module.ts
main.ts
- Postman sends
{ "message": "..." }to POST /ai/ask - NestJS sends message + tool definitions to Claude API
- Claude replies with
stop_reason: "tool_use"and picks a tool - NestJS runs the tool against the hardcoded JSON → gets result
- NestJS writes the call to
tool-call-log.json - NestJS sends the result back to Claude
- Claude gives a final text answer (
stop_reason: "end_turn") - NestJS returns the answer + list of tools used to Postman