{"id":31644545,"url":"https://github.com/blinkzer0/agent-cascade","last_synced_at":"2026-05-09T03:31:51.139Z","repository":{"id":315992657,"uuid":"1061494219","full_name":"BlinkZer0/Agent-Cascade","owner":"BlinkZer0","description":"Allows a LLM to chat with a local model hosted from Ollama or LM Studio | Usable in Windsurf Cascade and like environments","archived":false,"fork":false,"pushed_at":"2025-09-22T04:25:23.000Z","size":7574,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-22T04:31:08.107Z","etag":null,"topics":["ai","cloud-to-local","llm","lmstudio","local","mcp","mcp-server","ollama","server"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlinkZer0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-22T01:57:14.000Z","updated_at":"2025-09-22T04:25:27.000Z","dependencies_parsed_at":"2025-09-22T04:41:13.248Z","dependency_job_id":null,"html_url":"https://github.com/BlinkZer0/Agent-Cascade","commit_stats":null,"previous_names":["blinkzer0/agent-cascade"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/BlinkZer0/Agent-Cascade","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlinkZer0%2FAgent-Cascade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlinkZer0%2FAgent-Cascade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlinkZer0%2FAgent-Cascade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlinkZer0%2FAgent-Cascade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlinkZer0","download_url":"https://codeload.github.com/BlinkZer0/Agent-Cascade/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlinkZer0%2FAgent-Cascade/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278722768,"owners_count":26034461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","cloud-to-local","llm","lmstudio","local","mcp","mcp-server","ollama","server"],"created_at":"2025-10-07T04:53:52.052Z","updated_at":"2025-10-07T04:53:54.755Z","avatar_url":"https://github.com/BlinkZer0.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# agent-cascade (MCP server)\n\n## Overview\n`agent-cascade` bridges Model Context Protocol (MCP) clients to a local language model endpoint (e.g., LM Studio, Ollama-compatible servers). It exposes a single chat-completion tool so you can route requests from Windsurf/Cascade directly to your locally hosted model without relying on hosted APIs.\n\n## Supported capabilities\n- `local_chat` MCP tool - forwards prompts to an LM Studio-compatible `/chat/completions` endpoint and returns the response to the client.\n- `local.chat` request handler - optional direct method (for clients that support invoking custom MCP methods) with the same semantics as the tool.\n\n### Not included\nAutonomous \"continue working\" loops are **not** part of this package. The earlier documentation referenced `cascade.auto`, but that behaviour lives in a different tool and is not shipped here.\n\n## Environment configuration\n| Variable        | Default value              | Purpose                                                 |\n|-----------------|----------------------------|---------------------------------------------------------|\n| `LM_BASE_URL`   | `http://10.5.0.2:11434/v1` | Base URL for the local LM Studio/Ollama-compatible API. |\n| `DEFAULT_MODEL` | `qwen2.5-coder`            | Model used when the caller does not supply one.         |\n\n**Note**: By default, no token limit is imposed on responses. If you need to limit response length, specify `max_tokens` when calling the tool.\n\n## Installation \u0026 build\n```bash\ncd tools/agent-cascade\nnpm install\nnpm run build\n```\nThis compiles `src/server.ts` into `dist/server.js`, which is the entry point you reference from your MCP client configuration.\n\n## Windsurf/Cascade configuration\n1. Open **Cascade panel \u003e Plugins \u003e Manage \u003e View raw config**.\n2. Insert (or update) the server block below and save.\n3. Refresh the Cascade window so the new server loads.\n\n```json\n{\n  \"mcpServers\": {\n    \"agent-cascade\": {\n      \"command\": \"node\",\n      \"args\": [\"./dist/server.js\"],\n      \"env\": {\n        \"LM_BASE_URL\": \"http://10.5.0.2:11434/v1\",\n        \"DEFAULT_MODEL\": \"qwen2.5-coder\"\n      },\n      \"disabled\": false,\n      \"disabledTools\": []\n    }\n  }\n}\n```\n\n\u003e Tip: For a portable setup, build first and then point to the absolute path of your locally built `dist/server.js`. Some environments do not expand `${workspaceFolder}`.\n\n## Self‑Ask / Reflection (Same‑Model Sub‑Calls)\n\n![Yo dawg I heard you like LLMs](./a6t3o9.jpg)\n\nYes — you can point this tool at the very same local model the client is using and have it \"ask itself.\" Nothing special is required on the server side: `agent-cascade` is a thin proxy to your `/chat/completions` endpoint. To keep this safe and predictable, make the reflection a separate, budgeted sub‑call with depth caps and short outputs that you enforce in your orchestrator/agent logic.\n\n- Use small budgets: set `max_tokens` to a low value (e.g., 64–256) and a short `timeout_ms`.\n- Keep it concise: pass a `system` prompt that requires terse outputs.\n- Control recursion in the caller: enforce a max “reflection depth” in your agent; the server does not loop on its own.\n\nExample sub‑call via MCP tools/call:\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"tools/call\",\n  \"params\": {\n    \"name\": \"local_chat\",\n    \"arguments\": {\n      \"system\": \"You are a terse reviewer. Reply in \u003c=5 short bullets.\",\n      \"prompt\": \"Reflect on the draft plan; list obvious risks only.\",\n      \"max_tokens\": 128,\n      \"temperature\": 0.1,\n      \"timeout_ms\": 10000\n    }\n  }\n}\n```\n\nThis snippet is drop‑in and safe: it’s just another call to your local model with a tight budget and constraints. If you’re performing multi‑step workflows, track your own depth/budget in the caller and stop when limits are hit.\n\n## Demo\n\nThe screenshot below shows `agent-cascade` in action, successfully routing a chat completion request through Windsurf/Cascade to a local language model:\n\n![Agent Cascade Demo](./Screenshot%202025-09-21%20215159.png)\n\n*Example: The `local_chat` tool responding with \"Hello! I'm here and ready to help you with any coding questions or tasks you might have.\"*\n\n## Troubleshooting\n- **Timeouts or empty responses** - increase `timeout_ms` when invoking the tool or ensure the model is loaded in LM Studio.\n- **HTTP errors** - the server surfaces the upstream status code and the first 500 characters of the body to highlight configuration issues.\n- **Model not found** - either pass the `model` field in the tool call or update `DEFAULT_MODEL` to match a model served by your local endpoint.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblinkzer0%2Fagent-cascade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblinkzer0%2Fagent-cascade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblinkzer0%2Fagent-cascade/lists"}