Build your first MCP agent in 5 minutes
This is the shortest path from a fresh clone to an agent that calls real tools via the Model Context Protocol. No API keys, no Ollama, no setup.
By the end you'll have:
- L2M running locally with a Studio UI at
http://localhost:5173. - A working multi-tool agent that calls MCP tools (
get_current_time,calculator) on your prompts. - A clear next step for swapping the bundled echo provider for a real LLM and the in-process mock MCP server for a real one (filesystem, git, postgres, etc.).
0. Prerequisites
- Node.js 20+
- pnpm 10+
1. Clone and install (≈ 60 s)
git clone https://github.com/TensorGreed/ai-orchestrator.git
cd ai-orchestrator
pnpm install2. Configure (≈ 20 s)
Generate a master key for secret encryption:
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"Create a .env:
cp .env.example .envOpen .env and set:
SECRET_MASTER_KEY_BASE64=<paste the key from above>
BOOTSTRAP_ADMIN_EMAIL=you@example.com
BOOTSTRAP_ADMIN_PASSWORD=ChangeMe123!
SEED_SAMPLE_WORKFLOWS=trueYou don't need to set OPENAI_API_KEY, OLLAMA_BASE_URL, or anything else for this tutorial.
3. Run (≈ 60 s for first cold start)
pnpm devWait for the API to log listening on 4000 and the Web UI to log Local: http://localhost:5173/, then open http://localhost:5173 in your browser and log in with the admin credentials from your .env.
4. Open the MCP Agent Quickstart template (≈ 30 s)
In the Studio:
- Click Templates in the top nav.
- Filter by category Getting Started.
- Open MCP Agent Quickstart and click Use template.
What you should see on the canvas:
Manual Trigger ──▶ Agent ──▶ Output
│
├── chat_model: Chat Model (echo)
├── tool: MCP: get_current_time
└── tool: MCP: calculatorThe three nodes hanging off the agent are attachment ports, not DAG steps — the agent runtime consumes them at execution time. See the agent loop for the mental model.
5. Run it (≈ 30 s)
Click the Run button in the top-right of the canvas. In the dialog:
user_prompt: What time is it in UTC, and what is 12 times 7?Click Run.
Open the Execution history panel (left sidebar). The most recent run shows:
- Manual Trigger → success
- Agent → success
- MCP: get_current_time → success (called by the agent, with the model's chosen
tzargument) - MCP: calculator → success (with
expression: "12*7") - Output → success
Click the agent node to inspect the iteration trace: you'll see the model's tool-call requests and the tool responses interleaved. The bundled echo provider is not a real LLM, so it doesn't actually reason — but the runtime still drives the tool-calling loop, which is what we want to verify.
6. Make it real
You have two swaps to make. Both take a minute.
Swap the chat model for a real LLM
In Studio: open the Chat Model (echo) node, change the Provider dropdown from echo to openai (or anthropic, gemini, ollama).
For OpenAI:
- Settings → Secrets → New → name
OPENAI_API_KEY, provideropenai, paste your key. - Back on the node, set Model to
gpt-4o-miniand pick the secret you just created. - Save the workflow and re-run with the same prompt.
You'll see the model actually reason about which tools to call, in what order, with what arguments — instead of the echo placeholder.
Swap the mock MCP for a real MCP server
The mock-mcp adapter is in-process and ships with three demo tools. To plug in a community MCP server (e.g. @modelcontextprotocol/server-filesystem for filesystem access):
- Replace one of the
MCP: …nodes with a new MCP Tool node. - Set the connection:
- Transport:
stdio - Command:
npx - Args:
["-y", "@modelcontextprotocol/server-filesystem", "/path/to/your/safe/dir"]
- Transport:
- Click Test connection — Studio will spawn the server, list its tools, and let you pick one.
- Save and re-run with a prompt like
List files in the project root and tell me which ones look like documentation.
That's the whole loop: visual workflow + agent runtime + MCP tool calls. See the MCP integration page for transport options and best practices, and agent loop for the iteration semantics.
What if it didn't work
- Browser shows "blank page" or "API unreachable" → make sure both the API (
pnpm --filter @ai-orchestrator/api dev) and Web (pnpm --filter @ai-orchestrator/web dev) processes are running.pnpm devruns both, but your terminal needs to stay open. - Login fails → the
BOOTSTRAP_ADMIN_*env vars only seed the admin user on first boot when the user table is empty. If you've already logged in once with different credentials, those persist inapps/api/data/orchestrator.db. Delete the file and restart to re-seed. - Templates panel is empty → set
SEED_SAMPLE_WORKFLOWS=truein.envand restart. Seeding only runs when the workflow table is empty. - Anything else → see common issues or open an issue on GitHub.