Angular CLI工具代理

一个基于LangGraph ReAct代理的Angular CLI工具客户端,使用Ollama支持的LLM进行推理和响应提示。

  • by nnaghera
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 nnaghera/langgraph-angular-mcp

使用说明

angular-cli-mcp-client

Run a LangGraph ReAct agent wired to an MCP client that exposes Angular CLI tools. The agent uses an Ollama-backed LLM to reason about prompts and (read-only) Angular CLI tool outputs.

Prerequisites

  • Python 3.10+
  • Node.js 18+ (for npx and @angular/cli)
  • Ollama installed and running locally
    • Example model used: llama3.2:latest
  • PowerShell or any shell (examples use PowerShell on Windows)

Environment

Create a .env file in the project root:

MODEL_URL=http://localhost:11434
  • MODEL_URL should point to your Ollama server.

Installation

# From the project root
python -m venv .venv
. .venv\Scripts\Activate.ps1
pip install -r requirements.txt

Running the demo

# Activate the virtual environment if not already active
. .venv\Scripts\Activate.ps1

# Run the agent demo
python main.py

What it does:

  • Starts an MCP client that launches the Angular CLI via npx @angular/cli mcp --read-only over stdio
  • Discovers exposed tools
  • Builds a LangGraph ReAct agent with an Ollama-backed LLM
  • Sends a single demo prompt: “What are Angular's best practices?”

The agent may call tools as needed (read-only) to answer the prompt.

Project structure

.
├─ main.py               # Entrypoint; creates the agent and runs a demo prompt
├─ requirements.txt      # Python dependencies
└─ README.md             # This file

Common issues and fixes

  • npx not found
    • Ensure Node.js 18+ is installed and available on PATH
  • SSL or proxy issues
    • Set MODEL_URL to http:// with the correct host/port for local Ollama

Customizing

  • Change the model: edit model="llama3.2:latest" in main.py
  • Change the prompt: edit the HumanMessage content in main.py
  • Enable additional MCP servers: extend the MultiServerMCPClient mapping in main.py