[claude] Set up MCP bridge for Qwen3 via Ollama (#1067) #1081

Merged
Rockachopa merged 1 commits from claude/issue-1067 into main 2026-03-23 15:09:12 +00:00
Collaborator

Fixes #1067

Summary

  • New module src/timmy/mcp_bridge.py — Lightweight MCP bridge that connects Qwen3 models in Ollama directly to Timmy's tool ecosystem via Ollama's native /api/chat tool-calling API
  • Gitea tools: list_issues, create_issue, read_issue — direct REST API calls
  • Shell tool: shell_exec — uses existing ShellHand with allow-list safety
  • Tool-call loop: Handles multi-round tool calling with safety valve (max 10 rounds)
  • Graceful degradation: Connection errors, HTTP errors, unknown tools all handled
  • 24 unit tests covering schema conversion, bridge lifecycle, tool execution, error paths
  • Documentation at docs/mcp-setup.md with architecture diagram, bridge option evaluation, setup guide
  • Config: mcp_bridge_timeout setting (60s default)

Bridge Option Evaluation

Option Verdict Reason
Direct Ollama /api/chat Selected Zero extra deps, native Qwen3 tool support, full control
qwen-agent MCP Rejected Heavy dependency, overlaps with Agno
ollmcp Rejected External Go binary, limited error handling
mcphost Rejected Generic, doesn't integrate with tool safety
ollama-mcp-bridge Rejected Unmaintained, Node.js dependency

Test plan

  • 24 unit tests pass (no Ollama required)
  • Pre-existing test failures unchanged
  • Code formatted with black/isort

🤖 Generated with Claude Code

Fixes #1067 ## Summary - **New module `src/timmy/mcp_bridge.py`** — Lightweight MCP bridge that connects Qwen3 models in Ollama directly to Timmy's tool ecosystem via Ollama's native `/api/chat` tool-calling API - **Gitea tools**: `list_issues`, `create_issue`, `read_issue` — direct REST API calls - **Shell tool**: `shell_exec` — uses existing `ShellHand` with allow-list safety - **Tool-call loop**: Handles multi-round tool calling with safety valve (max 10 rounds) - **Graceful degradation**: Connection errors, HTTP errors, unknown tools all handled - **24 unit tests** covering schema conversion, bridge lifecycle, tool execution, error paths - **Documentation** at `docs/mcp-setup.md` with architecture diagram, bridge option evaluation, setup guide - **Config**: `mcp_bridge_timeout` setting (60s default) ## Bridge Option Evaluation | Option | Verdict | Reason | |--------|---------|--------| | Direct Ollama /api/chat | **Selected** | Zero extra deps, native Qwen3 tool support, full control | | qwen-agent MCP | Rejected | Heavy dependency, overlaps with Agno | | ollmcp | Rejected | External Go binary, limited error handling | | mcphost | Rejected | Generic, doesn't integrate with tool safety | | ollama-mcp-bridge | Rejected | Unmaintained, Node.js dependency | ## Test plan - [x] 24 unit tests pass (no Ollama required) - [x] Pre-existing test failures unchanged - [x] Code formatted with black/isort 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude added 1 commit 2026-03-23 13:59:55 +00:00
feat: add MCP bridge for Qwen3 via Ollama (#1067)
Some checks failed
Tests / lint (pull_request) Failing after 59s
Tests / test (pull_request) Has been skipped
498d3d7061
Implements a lightweight MCP bridge that connects Qwen3 models in Ollama
directly to Timmy's tool ecosystem (Gitea, shell) via Ollama's native
/api/chat tool-calling API. This complements the existing Agno-based
MCP integration with a simpler, standalone path for direct tool calling.

- src/timmy/mcp_bridge.py: MCPBridge class with tool-call loop, Gitea
  tools (list/create/read issues), and shell execution via ShellHand
- tests/timmy/test_mcp_bridge.py: 24 unit tests covering tool schema
  conversion, bridge lifecycle, tool-call loop, error handling
- docs/mcp-setup.md: architecture, bridge option evaluation, setup guide
- config.py: mcp_bridge_timeout setting (60s default)

Fixes #1067

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rockachopa merged commit 6a674bf9e0 into main 2026-03-23 15:09:12 +00:00
Rockachopa deleted branch claude/issue-1067 2026-03-23 15:09:12 +00:00
Owner

[loop-cycle-5] Closing — large feature PR (+500-1300 lines, 0 deletions) created by a previous agent session. Lines of code are a liability. These features need to be broken into smaller, well-tested increments if they are still wanted. Reopen the linked issue if needed.

[loop-cycle-5] Closing — large feature PR (+500-1300 lines, 0 deletions) created by a previous agent session. Lines of code are a liability. These features need to be broken into smaller, well-tested increments if they are still wanted. Reopen the linked issue if needed.
Owner

[loop-cycle-5] Closing — large feature PR from a previous agent session. Lines of code are a liability. Features need smaller, tested increments. Reopen linked issue if still wanted.

[loop-cycle-5] Closing — large feature PR from a previous agent session. Lines of code are a liability. Features need smaller, tested increments. Reopen linked issue if still wanted.
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1081