Skip to main content
Glama
emichael72

mcp

by emichael72

Agents

This project builds the same coding agent three ways. Each version uses the same model, tools, and shared instructions, so the comparison is mostly about who manages the work between model calls.

Agent

Language

Agent loop

MCPAgent

Python

Hand-written, with its own MCP tool server

Pydantic AI

Python

Managed by Pydantic AI

Vercel AI SDK

TypeScript

Managed by ToolLoopAgent

Pydantic AI and Vercel AI SDK supply the tool-calling loop, model integrations, and streaming events; MCPAgent implements that work in Python.

I focused on Pydantic because Python is more familiar to me. The TypeScript version follows a similar design and is readable alongside it.

In the demo, the agents and core_dump run on minion. qwen-coder-next runs through LM Studio on an M3 Mac Studio. The agent extends the C program, checks its work, and opens a pull request. A separate service quizzes the developer before the change can merge.

Start an agent

The installer supports Red Hat family Linux distributions with dnf; it has been tested on Rocky Linux 9.4. It needs Python 3.10 or later. The coding tools also need bubblewrap, a C build environment, Doxygen, and the relevant Git/formatting tools.

From the repository root:

./install.sh

This creates a shared Python environment, installs the repository's Python packages in editable mode, and prepares the TypeScript dependencies. If Node is missing or too old, the installer can download a local copy into .node/ on supported Linux systems. Use --skip-vercel for Python only.

Then choose one:

.venv/bin/python mcp/agent.py
.venv/bin/python pydantic/agent.py
node vercel/agent.ts

MCPAgent starts and stops its own tool server. No second terminal is needed. If the installer supplied Node, use .node/bin/node in the last command.

Add -d to see the tool calls and results. On a terminal the answer's Markdown is rendered as it streams (headings, emphasis, lists, tables, highlighted code), and with -d code a tool shows from a file is highlighted, dimmed; --plain prints raw text instead (render in context/output.json). Type exit to finish; /history shows the conversation and /reset clears it.

Related MCP server: AKIMCP

Models and settings

context/models.json holds the profiles shared by all three agents. The local profile points to LM Studio at http://boba:1234/v1 and can discover the loaded model. It names no model of its own, so it never makes LM Studio load one: with nothing loaded, the agent says so and stops.

Each profile also limits a reply's tokens (max_tokens, thinking included) and can set the model's sampling (sampling). The local profile uses Qwen's recommended settings for its thinking models, with a mild repeat penalty against the endless repetition quantized models can fall into. A reply that runs out of tokens while still thinking is asked again once, with a request to think briefly (out_of_tokens_retries in context/agent.json). With -d, the thinking of such a reply is saved in logs/ to show whether the model went in circles.

Use --profile NAME, --model, or --base-url to change a run. The --openai shortcut uses the OpenAI profile and needs OPENAI_API_KEY in the environment. MCPAgent needs a provider with a Responses endpoint; Pydantic and Vercel use chat completions.

The rest of context/ holds shared instructions, allowed folders, formatting settings, and turn limits. Each agent adds its own instructions.json to the global instructions: shared guidance first, then the details of that agent. MCPAgent tells the model to call tools one at a time; Pydantic and Vercel explain that independent calls may run together.

Tools, skills, and memory

The tools read and edit files, build code, check documentation, and submit changes. A tool's tool.json tells the model what it does and defines its arguments. All three agents load the same definitions.

Skills describe a procedure, such as how to make a change and open a PR. The agents see a short list at startup and read the full procedure when needed.

Memory keeps short notes between chats in .memory/. The notes are local and shared by the three agents.

Tool execution

MCPAgent runs tools one at a time. Pydantic and Vercel currently run the calls from one response concurrently; parallel_tool_calls in their own instructions.json controls this. Their instructions tell the model to group independent calls and wait before doing dependent work.

Turn and repeat limits live in context/agent.json. The current settings are 150 for max_tool_calls and 3 for identical consecutive calls; Vercel uses the former to set its step limit.

The pull request gate

The pr tool synchronizes the working copy, checks a proposed change, and opens a PR. It was previously called mr.

The gate service checks the submitted code and asks the model for a quiz about the diff. The gate reuses the agents' shell tool for builds/tests and their doxy script for documentation. You answer in a browser; the Python service grades the answers, stores the result, and reports the developer-quiz status to GitHub. GitHub enforces the required-status rule, and a person merges the PR.

The demo settings allow skipping the quiz. Turn that off to require a perfect score for code changes. See the flow walkthrough for the full handoff.

MIT licensed.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    A
    maintenance
    Exposes a governed suite of 38 tools over a single OAuth-gated MCP endpoint, letting web-based AI clients such as Claude, ChatGPT, and Grok read and edit files, run whitelisted shell commands, search, query SQLite, use Git, automate browsers and DevTools, manage background tasks, reach localhost services, and control the clipboard, notifications, ports, and Postman. This turns remote AI chats into secure operators of a local machine without granting unrestricted shell access.
    -
  • F
    license
    Not graded
    quality
    A
    maintenance
    Exposes a governed suite of 38 tools over one OAuth-gated MCP endpoint, letting web-based AI clients such as Claude, ChatGPT, and Grok read and edit files, run whitelisted shell commands, search content, use Git, inspect SQLite databases and localhost APIs, automate browsers, manage background tasks, and control Postman. It runs locally with a tailnet or public ingress so browser-based chats can act on your own machine without granting unrestricted shell access.
    -
  • F
    license
    Not graded
    quality
    A
    maintenance
    Exposes 38 OAuth-gated tools over one MCP endpoint so web-based AI clients like Claude, ChatGPT, and Grok can read and edit local files, run whitelisted shell commands, search content, use Git, SQLite, browser automation, DevTools, clipboard, notifications, ports, and background jobs on your own machine. A strict command whitelist and folder restrictions keep the local operating surface governable and safe by default.
    -
  • A
    license
    Not graded
    quality
    A
    maintenance
    Exposes a governed suite of 38 tools over a single OAuth-gated MCP endpoint, letting web-based AI chat clients read and edit local files, run whitelisted shell commands, search, use Git, inspect SQLite databases, and drive browser, DevTools, clipboard, and background-task workflows. It requires no system-wide install or admin rights and restricts access to folders and commands approved from a local control panel.
    MIT