A local-first agentic AI system in Go: an LLM-powered ReAct agent that reasons over PDFs, the web, and a MongoDB database — wired together through the Model Context Protocol. It runs fully local on Ollama by default and switches to Anthropic Claude with zero code change.
A short walkthrough of the ideas behind this project — the ReAct reasoning loop, the Model Context Protocol, and why the agent discovers its tools at runtime instead of hardcoding them.
Ask a complex question and watch the ReAct loop work — the agent interleaves reasoning with tool calls across PDF retrieval and live web search, deciding when it has enough context to answer, and when to ask for more.
Most agents wire each capability in by hand. agentic-ai instead exposes its database as a standard MCP server and gives the agent a single mcp tool — the agent learns what that server can do at query time via tools/list. Add a capability to the server and the agent picks it up with no code change.
Reason → Plan → Act → Observe → repeat. The agent thinks, picks an action, executes a tool, reads the observation, and iterates until it has a grounded final answer.
The agent holds a single mcp umbrella tool and discovers concrete operations at runtime via the standard MCP tools/list action — no per-operation pre-registration.
Local Ollama by default; Anthropic Claude when an API key, model, and credit balance are all configured. Both implement one LLMCaller interface — swap with config, not code.
Every tool owns its full definition (name, description, input_schema) through a Schema() method. The registry compiles these into the system prompt — descriptions live in exactly one place.
The MongoDB server speaks plain MCP over SSE. Any compatible client — Claude Desktop, Cursor, or a custom agent — connects with no special headers or auth.
Beyond the database, the agent reasons over local PDF vector search and live web results via the Tavily API — choosing the right source per step.
The system is two decoupled Go services wired together over MCP — the agent (the brain and tools) and a standalone, general-purpose MongoDB MCP server.
The reasoning core. On startup it connects to the MCP server, discovers available DB operations, and builds its system prompt dynamically from each tool's own schema. Runs the ReAct loop against Ollama or Claude and serves a query API + UI.
Browse agents/ →A standalone Model Context Protocol server exposing a MongoDB database as MCP tools over HTTP/SSE. General-purpose — the CRUD tools operate on any collection and any document shape, nothing hardcoded to a schema. Connect any MCP client, agent-agnostic.
Browse mcp/ →Two decoupled Go services and a pluggable LLM brain, joined by an open protocol. The agent reasons; the MCP server exposes data as discoverable tools; nothing is hardcoded between them.
A single endpoint runs the full reason → act → observe cycle, discovering and calling tools over MCP until the LLM produces a grounded final answer.
tools/list, then iterative Thought → Action → Observation until the final answer.Embeds the query in a dynamically-built ReAct prompt, selects the LLM backend from config, and orchestrates tool calls. It knows MCP only as a black box — one mcp tool whose operations it discovers, never hardcodes.
Opens an SSE stream, advertises its tool catalog via tools/list, and executes tools/call requests as MongoDB CRUD against the agentic_mcps database — returning structured CallToolResult payloads.
| Service | Port | Endpoint |
|---|---|---|
| ReAct agent | 8082 | POST /api/agent/query · UI at / |
| MCP server | 8083 | SSE at /sse |
| PDF search (external) | 8081 | POST /api/search |
Three tool sources feed the agent — two local, one discovered over MCP. The MongoDB operations below are advertised by the server at runtime and work against any collection.
| Tool / Operation | Source | What it does |
|---|---|---|
search_pdf | Local | Vector search over PDF documents |
web_search | Tavily API | Live web search for fresh information |
list_collections | MCP · discovered | List all collections with document counts |
query_documents | MCP · discovered | Query documents with an optional filter |
insert_document | MCP · discovered | Insert a new document |
update_document | MCP · discovered | Update matching documents |
delete_document | MCP · discovered | Delete matching documents |
Two decoupled Go modules, each with its own data-flow: the ReAct agent that reasons and calls tools, and the standalone MongoDB MCP server it discovers them from.
search_pdf · web_search · mcp
tools/listA Go-centric, local-first stack built around an open protocol — portable across LLM backends and MCP clients.
Full Go source, per-module READMEs, MCP client setup for Claude Desktop & Cursor, and architecture diagrams live in the repository.