r/LocalLLaMA · · 1 min read

I made a local-first MCP tutorial repo with node-llama-cpp and a custom agent loop

Mirrored from r/LocalLLaMA for archival readability. Support the source by reading on the original site.

I just published a repo called MCP from Scratch that teaches the Model Context Protocol by building it step by step in plain Node.js.

Most of the repo is about understanding MCP itself, but the later modules may be relevant here: I added a local-first setup using node-llama-cpp, GGUF models, MCP sampling, and a custom plan -> act -> observe agent loop.

So the repo goes from:

  • raw JSON-RPC and stdio transport
  • to a working MCP server with tools/resources/prompts
  • to local model integration
  • to an agent loop that uses MCP tools with a local GGUF model

There’s also an optional LangChain example, but the main path is intentionally minimal and tries to make the underlying mechanics obvious.

Key points:

  • plain Node.js, minimal abstractions
  • designed as a learning repo, not a production SDK
  • uses shared local GGUF models for the later modules
  • built for people who want to understand what MCP tooling is actually doing under the hood

Repo: https://github.com/pguso/mcp-from-scratch

Would especially love feedback from people here on the local inference side:

  • model choice
  • whether the agent loop examples feel useful or too toy-ish
submitted by /u/purellmagents
[link] [comments]

Discussion (0)

Sign in to join the discussion. Free account, 30 seconds — email code or GitHub.

Sign in →

No comments yet. Sign in and be the first to say something.

More from r/LocalLLaMA