8000 mcp-client JSON.parse error for local ollama · Issue #1502 · huggingface/huggingface.js · GitHub
[go: up one dir, main page]

Skip to content
mcp-client JSON.parse error for local ollama #1502
@alexdconf

Description

@alexdconf

I am trying to get a local ollama-backed tiny-agent, with playwright, to work. I have llama3.1:latest working with ollama. I have a working tiny-agent which I execute via npx @huggingface/tiny-agents run ./my-agent and such that my agent.json looks like


{
  "model": "llama3.1:latest",
  "endpointUrl": "http://localhost:11434",
  "servers": [
    {
      "type": "sse",
      "config": {
        "url": "http://localhost:8931/sse"
      }
    }
  ]
}

I spin up playwright, before running the agent, manually via this command npx @playwright/mcp --port 8931.
The agent starts and I get a cursor, but when I enter a prompt, I always get some version of this error (JSON parse error):


Agent loaded with 25 tools:
- browser_close
- browser_resize
- browser_console_messages
- browser_handle_dialog
- browser_file_upload
- browser_install
- browser_press_key
- browser_navigate
- browser_navigate_back
- browser_navigate_forward
- browser_network_requests
- browser_pdf_save
- browser_take_screenshot
- browser_snapshot
- browser_click
- browser_drag
- browser_hover
- browser_type
- browser_select_option
- browser_tab_list
- browser_tab_new
- browser_tab_select
- browser_tab_close
- browser_generate_playwright_test
- browser_wait_for
> Close browser

browser_close {}
/home/.../playground/repos/huggingface.js/packages/tiny-agents/dist/cli.js:118
    throw err;
    ^

SyntaxError: Unexpected token { in JSON at position 2
    at JSON.parse ()
    at Agent.processSingleTurnWithTools (/home/.../playground/repos/huggingface.js/packages/mcp-client/dist/src/index.js:233:71)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Agent.run (/home/.../playground/repos/huggingface.js/packages/mcp-client/dist/src/index.js:328:9)
    at async mainCliLoop (/home/.../playground/repos/huggingface.js/packages/tiny-agents/dist/cli.js:129:22)
    at async main (/home/.../playground/repos/huggingface.js/packages/tiny-agents/dist/cli.js:343:5)

Node.js v18.19.1

I think the issue has to do with JSON.parse calls. I've tried stdio, http and sse for connecting to playwright, including letting the tiny-agent software issue the npx command for me. I think it's something to do with my leveraging a local model? This is why I'm here, I couldn't figure it out. Any and all assistance is appreciated.
My versions of packages are:


dependencies:
@huggingface/tiny-agents link:../repos/huggingface.js/packages/tiny-agents
@modelcontextprotocol/sdk 1.12.0
@playwright/mcp 0.0.27
express 5.1.0
ollama 0.5.15

(I was originally on @huggingface/tiny-agents v0.2.3, but I pulled down the repo, built and installed it to see if that would work, it didn't.)
I'm running Ubuntu 24.04.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0