File size: 10,758 Bytes
57a6a0a
40809f9
d4aea08
 
 
57a6a0a
17b0be1
57a6a0a
d4aea08
57a6a0a
1bfce08
57a6a0a
 
2add32c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1a033fc
 
 
2add32c
46b04f4
2add32c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dcd6c26
2add32c
 
46b04f4
2add32c
 
46b04f4
2add32c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1a033fc
2add32c
 
1a033fc
2add32c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3024225
2add32c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a80a671
2add32c
 
a80a671
 
 
 
 
 
 
 
 
 
 
 
 
2add32c
 
 
 
46b04f4
2add32c
 
 
 
 
 
 
 
1a033fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2add32c
 
 
 
dcd6c26
2add32c
 
 
dcd6c26
2add32c
 
 
 
 
 
 
 
 
 
 
 
3024225
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
---
title: Nymbo Tools MCP
emoji: ⚙️
colorFrom: green
colorTo: gray
sdk: gradio
sdk_version: 6.2.0
app_file: app.py
pinned: true
license: apache-2.0
short_description: All-in-one hub of general purpose tools useful for any agent
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

## Nymbo-Tools MCP Server

All-in-one hub of general-purpose tools useful for any agent. Run it as a Gradio web app, or connect to it remotely as a Model Context Protocol (MCP) server to call its tools programmatically.

Live Space: https://huggingface.co/spaces/Nymbo/Tools

### What’s inside

- Web Fetch: Turn any webpage into clean Markdown with optional link-only scraping, CSS selector stripping, length limits, and pagination via cursor offset.
- Web Search: DuckDuckGo-backed search across text, news, images, videos, and books with readable, paginated output.
- Code Interpreter: Execute small Python snippets and capture stdout.
- Memory Manager: Lightweight JSON-based memory store with save/list/search/delete and tag filters.
- Generate Speech: Kokoro‑82M TTS with 54 voices and adjustable speed (CPU or CUDA if available).
- Generate Image: Text-to-image via Hugging Face serverless inference (choose model, steps, CFG, size, seed).
- Generate Video: Text-to-video via Hugging Face serverless inference (model, steps, guidance, size, fps, duration, seed).
- Deep Research: Multi-query web research pipeline (DDG search + parallel fetch + LLM report synthesis) with downloadable report.
- Agent Skills: Discover, inspect, and access specialized agent skills and resources.
- Agent Terminal: Execute Python code to chain multiple tools together (e.g., fetch -> summarize -> save) efficiently.
- Obsidian Vault: Read-only access to an Obsidian vault (list, read, search notes) with safelisted paths.
- File System: Safe, sandboxed filesystem operations under a tool root.
- Shell Command: Run shell commands inside the same safe root as File System.

## Quick start

Run the following commands in sequence to run the server locally:

```shell
git clone https://huggingface.co/spaces/Nymbo/Tools
cd Tools
python -m venv env
source env/bin/activate
pip install -r requirements.txt
python app.py
```

Defaults:
- The Gradio UI typically serves on http://127.0.0.1:7860
- The MCP endpoint is available at http://127.0.0.1:7860/gradio_api/mcp/

## Using it as an MCP server

Remote MCP (hosted):
- Base URL: https://mcp.nymbo.net/gradio_api/mcp/
- SSE endpoint (for clients that need it): https://mcp.nymbo.net/gradio_api/mcp/sse

Local MCP (when you run app.py):
- Base URL: http://127.0.0.1:7860/gradio_api/mcp/
- SSE endpoint: http://127.0.0.1:7860/gradio_api/mcp/sse

Example client config (JSON):

```json
{
	"mcpServers": {
		"nymbo-tools": {
			"url": "https://mcp.nymbo.net/gradio_api/mcp/"
		}
	}
}
```

## Environment variables (optional but recommended)

- HF_READ_TOKEN: Enables Image Generation, Video Generation, and Deep Research (Hugging Face serverless inference). These tools stay visible to MCP clients but calls require a valid token to succeed.
- HF_TOKEN: Alternative token fallback used by some providers (also enables Deep Research/Video).
- NYMBO_TOOLS_ROOT: Overrides the File System/Shell working root. Defaults to Nymbo-Tools/Filesystem.
- UNSAFE_ALLOW_ABS_PATHS=1: Allow absolute paths in File System and Shell Command (off by default for safety).

Notes:
- Without a HF API key, you can still use Web Fetch, Web Search, Code Interpreter, Memory Manager, File System, Shell Command, and Generate Speech.
- Generate Speech requires the kokoro package and its dependencies; it works on CPU and uses CUDA if available. Doesn't require an API key because it's computed on the server itself.

## Persistence and privacy

- Memory Manager stores entries in `memories.json` at the Nymbo-Tools folder root when running locally.
- File System defaults to the `Filesystem/` directory under Nymbo-Tools.
- In the public demo Space, storage is ephemeral and visible to anyone using the Space; avoid personal or sensitive data.

## Tool reference (signatures and behavior)

Below are the MCP tool parameters summarized by inputs, outputs, and notable behaviors.

### Web_Fetch (Webpages, converted to Markdown)
Inputs:
- url (str): Absolute URL to fetch (must return HTML).
- max_chars (int, default 3000): 0 = full page; otherwise truncates with a next_cursor notice.
- strip_selectors (str): Comma-separated CSS selectors to remove (e.g., .header, .footer, nav).
- mode (str): "markdown" (default), "html", or "url_scraper" (returns list of links).
- offset (int): Character offset for pagination; pass the previous next_cursor to continue.

Output: Markdown string, raw HTML, or link list. If truncated, includes a next_cursor to continue.

### Web_Search (DuckDuckGo backend)
Inputs:
- query (str): DuckDuckGo query (supports site:, quotes, OR).
- max_results (int 1–20, default 5)
- page (int, default 1) or offset (int) for precise continuation
- search_type (str): "text" | "news" | "images" | "videos" | "books"

Output: Readable text with pagination hints and next_offset.

### Code_Interpreter (Python)
Inputs:
- code (str): Python source; stdout is captured.

Output: Captured stdout or the exception text.

### Memory_Manager (Simple JSON store)
Inputs:
- action: "save" | "list" | "search" | "delete"
- text (save only), tags (save only)
- query (search only): supports tag:name terms and AND/OR
- limit (list/search): default 20
- memory_id (delete): full UUID or unique prefix
- include_tags (bool): include tags when listing/searching

Output: Confirmation string, listing, search matches, or structured error text.

### Generate_Speech (Kokoro-82M)
Inputs:
- text (str)
- speed (float 0.5–2.0, default 1.25)
- voice (str): One of 54 voices (e.g., af_heart, am_liam, bf_alice, zf_xiaoyi…)

Output: (sample_rate:int, waveform:np.ndarray) – rendered as downloadable WAV in the UI.

### Generate_Image (HF inference)
Requires: HF_READ_TOKEN

Inputs:
- prompt (str)
- model_id (str): e.g., black-forest-labs/FLUX.1-Krea-dev
- negative_prompt (str)
- steps (1–100), cfg_scale (1–20), sampler (UI label), seed (-1=random), width/height

Output: PIL.Image. In UI, displayed and downloadable. Errors guide you to provide a token or fix model id.

### Generate_Video (HF inference)
Requires: HF_READ_TOKEN or HF_TOKEN

Inputs:
- prompt (str)
- model_id (str): default Wan-AI/Wan2.2-T2V-A14B
- negative_prompt (str)
- steps (1–100), cfg_scale, seed, width/height, fps, duration (s)

Output: Temporary MP4 file path; UI shows a playable/downloadable video.

### Deep_Research (HF inference)
Requires: HF_READ_TOKEN or HF_TOKEN

Inputs:
- summary (str): One or more sentences describing the research task.
- query1..query5 (str) with max1..max5 (1–50). Total requested results across queries are capped at 50.

Behavior:
- Parallel DDG searches → fetch pages in budget → filter candidate sources with an LLM → synthesize a long, well-structured Markdown report and list of sources.

Output: (report_md, fetched_links_text, report_file_path)

### File_System (safe root)
Root:
- Defaults to `Nymbo-Tools/Filesystem` (or NYMBO_TOOLS_ROOT). Absolute paths disabled unless UNSAFE_ALLOW_ABS_PATHS=1.

Actions:
- list, read, write, append, edit, mkdir, move, copy, delete, info, help

Key fields:
- path, content (write/append/edit), dest_path (move/copy), recursive, show_hidden, max_entries, offset, max_chars, create_dirs, overwrite

Edit format (SEARCH/REPLACE blocks):
```
<<<<<<< SEARCH
[exact content to find]
=======
[new content to replace with]
>>>>>>> REPLACE
```
- Multiple blocks can be included; each is applied in order
- Search text must match exactly (whitespace, indentation)
- Only the first occurrence of each search text is replaced

Output:
- Human-readable listings or JSON-like error strings with code/message/hint.

### Shell_Command (same safe root)
Inputs:
- command (str): Single-string shell command (pipelines supported by the host shell).
- workdir (str): Relative to the root.
- timeout (s)

Output:
- Combined header + STDOUT/STDERR. Absolute paths disabled by default. Shell is detected automatically (PowerShell on Windows when available; bash/sh on POSIX).

### Agent_Skills (Skill Discovery)
Inputs:
- action: "discover" | "info" | "resources" | "validate" | "search" | "help"
- skill_name (str): Required for info/resources/validate.
- resource_path (str): Specific file to read within a skill.
- query (str): Search term for "search" action.
- max_chars (int), offset (int)

Output:
- Detailed skill metadata, SKILL.md content, resource file content, or validation reports.

### Agent_Terminal (Tool Chaining)
Inputs:
- input (str): Python source code to execute.
    - Can call any other tool (e.g., `Web_Fetch(...)`, `File_System(...)`).
    - Use `search_tools("query")` to find tools.
    - Call a tool with no args to get its usage guide.

Output:
- Captured STDOUT validation of the script.

### Obsidian_Vault (Read-only Note Access)
Root:
- Defaults to `Tools/Obsidian` (or OBSIDIAN_VAULT_ROOT).

Inputs:
- action: "list" | "read" | "info" | "search" | "help"
- path (str): Relative to vault root (start with /).
- query (str): For search action.
- recursive (bool), show_hidden (bool), max_entries (int)
- offset (int), max_chars (int)

Output:
- File listings, note content, or search results (with context).

## Running on Hugging Face Spaces

1) Duplicate the Space at https://huggingface.co/spaces/Nymbo/Tools.
2) In Space Settings → Secrets, add HF_READ_TOKEN (and/or HF_TOKEN) for model access.
3) Both the UI and MCP clients will list every tool. Image/Video/Deep Research still need a valid token when invoked.

## Troubleshooting

- Image/Video/Deep Research calls fail immediately:
	- Provide HF_READ_TOKEN (and optionally HF_TOKEN). Restart the app/Space.
- 401/403 when calling generation tools:
	- Token missing/insufficient permissions. Ensure your token can read the chosen model.
- Kokoro not found:
	- Install kokoro>=0.9.4. CPU works; CUDA used if available. Torch may be skipped on Apple Silicon by design.
- Windows PowerShell activation policy blocks venv activation:
	- Run PowerShell as Admin and set a suitable execution policy for the current user (e.g., RemoteSigned), or manually run `python app.py` after installing dependencies.
- File System or Shell path errors:
	- Paths are relative to the tool root. Set NYMBO_TOOLS_ROOT to customize. Set UNSAFE_ALLOW_ABS_PATHS=1 only if you fully trust the environment.

## License

Apache-2.0 (see Space metadata). If you duplicate the Space or use these tools, ensure your usage complies with the licenses and terms of the underlying models and providers.