ToolSmith Agent MCP Server

ToolSmith Agent MCP Server

A multi-tool task agent MCP server with file search, SQLite query, calculator, and report writing tools. Enables Claude Code, Claude Desktop, or Cursor to control the same tools used by the agent, with guardrails for safety.

Category
访问服务器

README

🛠️ ToolSmith Agent — a hand-built ReAct agent + MCP server, provable offline

CI python offline MCP

A multi-tool task agent whose one tool layer (file search · read-only SQLite/text-to-SQL · safe calculator · report writer) is driven three ways from a single source of truth:

  1. a deterministic mock brain → 100% offline, zero secrets, CI-gated;
  2. an optional Groq free-tier model (one env var);
  3. a real MCP server so Claude Code / Claude Desktop / Cursor can reason over the exact same tools — real NL→tool reasoning, for free.

No paid API is needed to prove the engineering. The mock makes the whole agent reproducible and testable offline; the MCP path shows a real model driving the identical tools + guardrails at zero cost.

Results (offline mock brain, python -m eval.simple_eval)

Metric Score
Task Success Rate 6/6 = 1.00
Tool-Trajectory accuracy 6/6 = 1.00
Self-correction / recovery (injected tool errors) 2/2 = 1.00
Unit tests (guardrails, loop, MCP parity, matcher) 21 passing

Trajectory is asserted, not just the final answer — a right answer via the wrong tool still fails. See the honesty notes below on what these numbers do and don't mean.

What one run looks like

▶ TASK (mock): List the top 3 products by revenue and save a report
  ├─ step 0 · db_schema()
  │    ↳ CREATE TABLE products ( id INTEGER PRIMARY KEY, name TEXT ... )
  ├─ step 1 · query_db(sql="SELECT p.name, SUM(s.amount) AS revenue ...")
  │    ↳ name | revenue  Gadget | 600.0  Widget | 375.0  Gizmo | 90.0
  ├─ step 2 · write_report(filename="top_products.md", ...)
  │    ↳ Wrote 79 chars to reports/top_products.md.
  └─ FINAL: Saved top_products.md. Gadget leads with 600.0 in revenue.

Self-correction (the count_orders task queries a table that doesn't exist): db_schema → query_db(orders) → ERROR → query_db(sales) → "There are 5 sales records."

Architecture — one tool layer, three brains, two surfaces

                         tools/  ← THE single source of truth (REGISTRY)
              search_files · db_schema · query_db · calculator · write_report
              (sandbox · read-only SQL · AST calc · write-gate guardrails)
                          │                │                    │
        ┌─────────────────┘                │                    └───────────────┐
        ▼                                   ▼                                     ▼
  agent/loop.py (ReAct)              Groq schema export                   mcp_server/server.py
  reason→act→observe                 (same schemas)                       (FastMCP, stdio)
        │                                                                        │
  LLMProvider seam  ── LLM_PROVIDER=mock (default) | groq ──┐          Claude Code / Desktop / Cursor
        │                                                    │          drive the SAME tools (real model)
  mock_llm (offline, CI) ─────────────────────────────────── groq_llm (free tier)
  • Hand-written ReAct loop (no create_react_agent): reason → tool-select → validate args → execute → observe → repeat, under a max-steps cap with identical-action loop detection. Self-correction is emergent: a ToolError becomes an ERROR: observation the model re-plans from.
  • Two-tier memory (scratchpad + persistent SQLite thread store) and a JSONL trace of every step.
  • Guardrails as tested code: path-sandbox, read-only SQL (sqlglot + mode=ro), AST calculator (no eval), write-gate, and <untrusted> wrapping of tool output (prompt-injection defense). See DECISIONS.md.

Quickstart (offline — no API key)

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt -r requirements-dev.txt

pytest -q                          # 21 tests, guardrail attacks included
python -m eval.simple_eval         # the agent eval gate (offline, deterministic)

python -m agent.run "What is the 8% sales commission on our total revenue?"
python scripts/render_trace.py     # pretty-print the latest ReAct trace

Use it from Claude Code / Claude Desktop / Cursor (real model, free)

The MCP server exposes the same tools. Point a real client at it:

Claude Code (from the project dir):

claude mcp add toolsmith -- /absolute/path/to/toolsmith-agent/.venv/bin/python \
                             /absolute/path/to/toolsmith-agent/mcp_server/server.py
# then, inside Claude Code:  /mcp   (and ask a multi-tool question)

A committed .mcp.json (uv-based) also works automatically if you have uv installed.

Claude Desktop — add to ~/Library/Application Support/Claude/claude_desktop_config.json, then restart:

{
  "mcpServers": {
    "toolsmith": {
      "command": "/absolute/path/to/toolsmith-agent/.venv/bin/python",
      "args": ["/absolute/path/to/toolsmith-agent/mcp_server/server.py"]
    }
  }
}

Cursor — same block in .cursor/mcp.json.

Inspect the server (Tools / Resources / Prompts UI):

npx @modelcontextprotocol/inspector .venv/bin/python mcp_server/server.py

Try calling query_db with DROP TABLE sales and watch it come back a clean, guardrailed error.

Optional: drive the standalone loop with a real model (Groq free tier)

pip install -r requirements-groq.txt
cp .env.example .env     # set GROQ_API_KEY, LLM_PROVIDER=groq
python -m agent.run "Which product earned the most, and what's 8% of it?"

The provider seam swaps with zero changes to the loop.

Honest notes (because measuring is the point)

  • The mock proves the loop's control flow, tool selection/dispatch, arg validation, termination + loop-detection, that every guardrail fires, that an ERROR observation triggers recovery, MCP tool parity, tracing, and full offline CI — not that a model reasons or generalizes.
  • Real reasoning is covered, for free, by the MCP-in-Claude-Code path (identical tools + guardrails) and by the optional Groq provider.
  • pass^k is trivially 1.0 under the deterministic mock; it's only meaningful re-run over a real model. This README does not headline it as a reliability number.

Tech

Python 3.12 · MCP (official SDK / FastMCP) · Pydantic · sqlglot · SQLite · stdlib (ast, pathlib) · pytest · GitHub Actions · Docker · optional Groq. Deliberately torch-free. Sibling project: GroundedQA (RAG) — github.com/e-akgul/groundedqa.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选