MukundaKatta

agentcast-mcp

Community MukundaKatta
Updated

MCP server: structured-output enforcer for any LLM. Wraps @mukundakatta/agentcast.

agentcast-mcp

npmtestsmcp

An MCP server that gives AI assistants theability to enforce structured output: extract JSON from messy LLM text, gateit against a shape spec, and produce the retry feedback message when the modelreturns the wrong shape.

Built on top of@mukundakatta/agentcast. Workswith Claude Desktop, Cursor, Cline, Windsurf, Zed, and any other MCP client.

Tools exposed

extract_json

Pull a JSON value out of messy LLM output. Tries the whole text, then afenced ```json ``` block, then the largest balanced {...} / [...]substring. Returns the parsed value plus which strategy succeeded.

{
  "text": "Sure, here you go:\n```json\n{\"answer\": 42}\n```\nLet me know!"
}

โ†’

{
  "value": { "answer": 42 },
  "found": true,
  "source": "fenced_json"
}

source is one of whole, fenced_json, fenced_plain,balanced_substring, or none.

validate_response

Validate a parsed JSON value against an agentcast shape spec. Spec maps fieldname to type: string, number, boolean, array, object. Suffix with? for optional.

{
  "value": { "name": "ada" },
  "shape": { "name": "string", "age": "number" }
}

โ†’

{
  "valid": false,
  "error": "missing required field 'age'"
}

build_retry_prompt

Given an attempt history, produce the validation-error feedback messageagentcast appends to the conversation when the model returned the wrongshape. Codifies the "validation error as feedback" pattern for non-Node MCPclients that want to drive the same retry loop manually.

{
  "attempts": [
    { "text": "{\"name\":\"ada\"}", "error": "missing required field 'age'" }
  ],
  "expected_shape": { "name": "string", "age": "number" }
}

โ†’

{
  "feedback": "Your previous response did not match the required shape. Error: missing required field 'age'\n\nTry again. Respond with ONLY valid JSON that fixes the error above.\n\nExpected shape: {\"name\":\"string\",\"age\":\"number\"}"
}

Install

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "agentcast": {
      "command": "npx",
      "args": ["-y", "@mukundakatta/agentcast-mcp"]
    }
  }
}

Cursor / Cline / Windsurf / Zed

Same shape, in the appropriate mcp.json for your client. Most clientsauto-discover via npx -y @mukundakatta/agentcast-mcp.

Local install

npm install -g @mukundakatta/agentcast-mcp
mcp-agentcast        # listens on stdio

Why this matters

When an LLM is supposed to return structured data, it sometimes wraps theJSON in prose, fences, or hallucinated fields. Standard JSON.parse throws.Hand-rolled regex misses nested structure. This MCP server gives any modeldriving an agent a real handle on (1) pulling JSON out of the response,(2) checking it matches the expected shape, and (3) building the exact retryprompt that nudges the model to fix it on the next turn.

License

MIT.

MCP Server ยท Populars

MCP Server ยท New

    kridaydave

    File Organizer MCP Server

    This MCP server will organize your files using connections to MCP using clients like Claude, Cursor and Gemini Cli

    Community kridaydave
    higress-group

    AI Gateway

    ๐Ÿค– AI Gateway | AI Native API Gateway

    Community higress-group
    raine

    consult-llm

    MCP server for consulting powerful reasoning models in Claude Code

    Community raine
    sipyourdrink-ltd

    bernstein

    Deterministic orchestrator for 30+ CLI AI coding agents. Git worktree isolation, HMAC audit trail, MCP server mode.

    Community sipyourdrink-ltd
    wxtsky

    byob

    Bring Your Own Browser โ€” let your AI agent use the Chrome you already have open

    Community wxtsky