uer-mcp 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -82
- package/package.json +15 -13
- package/python/README.md +69 -82
- package/python/pyproject.toml +2 -2
- package/python/src/uer/evaluation/__init__.py +4 -0
- package/python/src/uer/llm/config_guide.py +361 -0
- package/python/src/uer/llm/config_registry.py +275 -0
- package/python/src/uer/llm/gateway.py +565 -24
- package/python/src/uer/security/__init__.py +13 -0
- package/python/src/uer/security/prompt_injection.py +293 -0
- package/python/src/uer/server.py +316 -0
- package/python/uv.lock +1 -1
package/README.md
CHANGED
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/uer-mcp)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
**Multi-Provider LLM Gateway • S3-Compatible Storage • MCP Tool Orchestration**
|
|
10
10
|
</div>
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
**Standard config** works in most MCP clients:
|
|
15
|
-
>
|
|
15
|
+
> **Quick Start**: Get a free Cerebras API key at [cloud.cerebras.ai/platform](https://cloud.cerebras.ai/platform) under apikeys or use LM Studio (100% free, local)
|
|
16
|
+
|
|
16
17
|
```json
|
|
17
18
|
{
|
|
18
19
|
"mcpServers": {
|
|
@@ -20,16 +21,21 @@
|
|
|
20
21
|
"command": "npx",
|
|
21
22
|
"args": ["uer-mcp@latest"],
|
|
22
23
|
"env": {
|
|
23
|
-
|
|
24
|
+
// Specific provider key(s)
|
|
25
|
+
"CEREBRAS_API_KEY": "your-key-here",
|
|
26
|
+
"GEMINI_API_KEY": "your-key-here", // etc
|
|
27
|
+
// LM Studio (optional) - requires dummy API key
|
|
28
|
+
"OPENAI_API_BASE": "http://localhost:1234/v1",
|
|
29
|
+
"OPENAI_API_KEY": "sk-local" // any dummy value works
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
>
|
|
36
|
+
> **Storage is optional**: This config works immediately for LLM and MCP features. For storage/context features, see [Storage Configuration Options](#storage-configuration-options) below.
|
|
31
37
|
|
|
32
|
-
>
|
|
38
|
+
> **Required**: Add at least one API key to the `env` section. See [CONFIGURATION.md](CONFIGURATION.md) for all provider links and detailed setup.
|
|
33
39
|
|
|
34
40
|
[<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522uer%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522uer-mcp%2540latest%2522%255D%257D) [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522uer%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522uer-mcp%2540latest%2522%255D%257D) [<img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor">](https://cursor.com/en/install-mcp?name=UER&config=eyJjb21tYW5kIjoibnB4IHVlci1tY3BAbGF0ZXN0In0%3D) [<img src="https://img.shields.io/badge/Windsurf-Windsurf?style=flat-square&label=Install%20Server&color=0B7A8F" alt="Install in Windsurf">](https://windsurf.com)
|
|
35
41
|
|
|
@@ -43,24 +49,24 @@ For Claude Desktop, Goose, Codex, Amp, and other clients, see [CONFIGURATION.md]
|
|
|
43
49
|
---
|
|
44
50
|
|
|
45
51
|
An MCP server that provides:
|
|
46
|
-
1. **
|
|
47
|
-
2. **MCP Tool
|
|
48
|
-
3. **
|
|
49
|
-
4. **
|
|
52
|
+
1. **Multi-Provider LLM Access** - Call 100+ LLM providers (Anthropic, OpenAI, Google, Azure, AWS Bedrock, local models) through LiteLLM
|
|
53
|
+
2. **MCP Tool Integration** - Connect to other MCP servers for extended functionality
|
|
54
|
+
3. **S3-Compatible Storage** - Store context and data in MinIO, AWS S3, or other S3-compatible backends
|
|
55
|
+
4. **Prompt Injection Detection** - Basic content validation and security warnings
|
|
50
56
|
|
|
51
57
|
## Why This Exists
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
- **
|
|
55
|
-
- **
|
|
56
|
-
- **
|
|
57
|
-
- **
|
|
59
|
+
MCP clients often need:
|
|
60
|
+
- **Multiple LLM providers** - Different models for different tasks
|
|
61
|
+
- **Persistent storage** - Save context between sessions
|
|
62
|
+
- **Tool integration** - Connect to specialized MCP servers
|
|
63
|
+
- **Configuration flexibility** - Support cloud and self-hosted solutions
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
65
|
+
UER provides:
|
|
66
|
+
- Unified interface to 100+ LLM providers via LiteLLM
|
|
67
|
+
- S3-compatible storage for context and data
|
|
68
|
+
- MCP client for calling other MCP servers
|
|
69
|
+
- Support for enterprise clouds (Azure, AWS, GCP) and self-hosted (Ollama, LM Studio)
|
|
64
70
|
|
|
65
71
|
## Architecture
|
|
66
72
|
|
|
@@ -80,9 +86,9 @@ graph TB
|
|
|
80
86
|
|
|
81
87
|
subgraph litellm["LiteLLM Gateway"]
|
|
82
88
|
C1["100+ LLM providers"]
|
|
83
|
-
C2["
|
|
84
|
-
C3["
|
|
85
|
-
C4["
|
|
89
|
+
C2["Model routing"]
|
|
90
|
+
C3["Error handling"]
|
|
91
|
+
C4["Response formatting"]
|
|
86
92
|
end
|
|
87
93
|
|
|
88
94
|
subgraph store["Context Store"]
|
|
@@ -142,10 +148,10 @@ llm_call(model="ollama/llama3.1:8b-instruct-q4_K_M", messages=[...])
|
|
|
142
148
|
```
|
|
143
149
|
|
|
144
150
|
Features included:
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
151
|
+
- Unified interface across providers
|
|
152
|
+
- Support for cloud and self-hosted models
|
|
153
|
+
- Automatic model detection and caching
|
|
154
|
+
- Error handling and response formatting
|
|
149
155
|
|
|
150
156
|
### 2. MCP Tool Integration
|
|
151
157
|
|
|
@@ -161,28 +167,25 @@ mcp_call(server="postgres", tool="query", args={"sql": "SELECT * FROM users"})
|
|
|
161
167
|
mcp_call(server="context7", tool="search", args={"query": "LiteLLM API reference"})
|
|
162
168
|
```
|
|
163
169
|
|
|
164
|
-
### 3.
|
|
170
|
+
### 3. S3-Compatible Storage
|
|
165
171
|
|
|
166
|
-
Store data
|
|
172
|
+
Store data in S3-compatible backends:
|
|
167
173
|
|
|
168
174
|
```python
|
|
169
|
-
# Store
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
model="anthropic/claude-sonnet-4-5-20250929",
|
|
175
|
-
task="Analyze the document",
|
|
176
|
-
context_refs=["s3://uer-context/analysis/doc_001.json"]
|
|
175
|
+
# Store data in MinIO, AWS S3, or other S3-compatible storage
|
|
176
|
+
storage_put(
|
|
177
|
+
key="analysis/doc_001.json",
|
|
178
|
+
content={"content": large_document},
|
|
179
|
+
bucket="uer-context"
|
|
177
180
|
)
|
|
178
181
|
|
|
179
|
-
#
|
|
180
|
-
|
|
181
|
-
|
|
182
|
+
# Retrieve data
|
|
183
|
+
data = storage_get(
|
|
184
|
+
key="analysis/doc_001.json",
|
|
185
|
+
bucket="uer-context"
|
|
186
|
+
)
|
|
182
187
|
```
|
|
183
188
|
|
|
184
|
-
**Token savings: 99.9%** for multi-agent workflows.
|
|
185
|
-
|
|
186
189
|
**Storage backends:**
|
|
187
190
|
- **Local:** MinIO (S3-compatible, Docker-based)
|
|
188
191
|
- **Cloud:** AWS S3, Azure Blob Storage, NetApp StorageGRID
|
|
@@ -263,33 +266,14 @@ With storage disabled:
|
|
|
263
266
|
|
|
264
267
|
The server will start successfully without storage, and LLMs won't see storage-related tools in their tool list.
|
|
265
268
|
|
|
266
|
-
### 4.
|
|
269
|
+
### 4. Prompt Injection Detection
|
|
267
270
|
|
|
268
|
-
|
|
271
|
+
Basic content validation and security warnings:
|
|
269
272
|
|
|
270
273
|
```python
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
{"role": "system", "content": "You are a code reviewer..."},
|
|
275
|
-
{"role": "user", "content": "Review this code for security issues"},
|
|
276
|
-
{"role": "assistant", "content": "I'll analyze the code..."},
|
|
277
|
-
{"role": "user", "content": "Focus on SQL injection risks"}
|
|
278
|
-
],
|
|
279
|
-
tools=[...], # MCP tools available to subagent
|
|
280
|
-
context_refs=["registry://context/codebase"] # Large context via URI
|
|
281
|
-
)
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### 5. Continuation Across Sessions
|
|
285
|
-
|
|
286
|
-
Complex tasks can span multiple messages and sessions:
|
|
287
|
-
|
|
288
|
-
```
|
|
289
|
-
Message 1: Start analysis → Progress: 20% → {{continuation: registry://plan/001}}
|
|
290
|
-
Message 2: Continue → Progress: 60% → {{continuation: registry://plan/001}}
|
|
291
|
-
[Next day]
|
|
292
|
-
Message 3: Continue → Complete! Here's your report...
|
|
274
|
+
# Detects potential prompt injection patterns
|
|
275
|
+
# Provides risk assessment and warnings
|
|
276
|
+
# Helps identify suspicious content in user inputs
|
|
293
277
|
```
|
|
294
278
|
|
|
295
279
|
## Usage
|
|
@@ -327,12 +311,15 @@ User: "Ask both Gemini and Claude Sonnet to write a haiku about programming"
|
|
|
327
311
|
→ Returns both haikus for comparison
|
|
328
312
|
```
|
|
329
313
|
|
|
330
|
-
**3. Store and
|
|
314
|
+
**3. Store and Retrieve Data:**
|
|
331
315
|
```
|
|
332
|
-
User: "Store this
|
|
333
|
-
→
|
|
334
|
-
→
|
|
335
|
-
|
|
316
|
+
User: "Store this configuration in S3"
|
|
317
|
+
→ storage_put(key="config/settings.json", content={...})
|
|
318
|
+
→ Returns: Confirmation with storage details
|
|
319
|
+
|
|
320
|
+
User: "Retrieve the configuration"
|
|
321
|
+
→ storage_get(key="config/settings.json")
|
|
322
|
+
→ Returns: Configuration data
|
|
336
323
|
```
|
|
337
324
|
|
|
338
325
|
## Troubleshooting
|
|
@@ -364,25 +351,25 @@ User: "Store this document in the registry and have Gemini summarize it"
|
|
|
364
351
|
| Tool | Description |
|
|
365
352
|
|------|-------------|
|
|
366
353
|
| `llm_call` | Call any LLM via LiteLLM (100+ providers) |
|
|
354
|
+
| `llm_list_models` | List available models from configured providers |
|
|
355
|
+
| `llm_config_guide` | Get configuration help for LLM providers |
|
|
367
356
|
| `mcp_call` | Call any configured MCP server tool |
|
|
368
|
-
| `
|
|
369
|
-
| `
|
|
370
|
-
| `
|
|
371
|
-
| `
|
|
372
|
-
| `
|
|
373
|
-
| `
|
|
357
|
+
| `mcp_list_tools` | List available MCP tools |
|
|
358
|
+
| `mcp_servers` | List configured MCP servers |
|
|
359
|
+
| `storage_put` | Store data in S3-compatible storage |
|
|
360
|
+
| `storage_get` | Retrieve data from storage |
|
|
361
|
+
| `storage_list` | List stored objects |
|
|
362
|
+
| `storage_delete` | Delete stored objects |
|
|
374
363
|
|
|
375
364
|
## LiteLLM Integration
|
|
376
365
|
|
|
377
366
|
This project uses [LiteLLM](https://github.com/BerriAI/litellm) as the unified LLM gateway, providing:
|
|
378
367
|
|
|
379
368
|
- **100+ LLM providers** through single interface
|
|
380
|
-
- **
|
|
381
|
-
- **
|
|
382
|
-
- **
|
|
383
|
-
- **
|
|
384
|
-
- **Fallbacks** between providers on failure
|
|
385
|
-
- **Tool/function calling** normalized across providers
|
|
369
|
+
- **Unified API format** across all providers
|
|
370
|
+
- **Support for cloud and self-hosted models**
|
|
371
|
+
- **Automatic model detection** and caching
|
|
372
|
+
- **Error handling** and response formatting
|
|
386
373
|
|
|
387
374
|
### Supported Providers
|
|
388
375
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uer-mcp",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"description": "Universal Expert Registry - Multi-
|
|
3
|
+
"version": "4.2.0",
|
|
4
|
+
"description": "Universal Expert Registry - Multi-provider LLM gateway, S3-compatible storage, and MCP tool orchestration with multi-agent safety monitoring",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"uer-mcp": "bin/uer-mcp.js"
|
|
@@ -51,15 +51,17 @@
|
|
|
51
51
|
"mcp": {
|
|
52
52
|
"displayName": "Universal Expert Registry",
|
|
53
53
|
"icon": "img/uer.jpg",
|
|
54
|
-
"description": "Multi-
|
|
54
|
+
"description": "Multi-provider LLM gateway with 100+ providers, S3-compatible storage, MCP tool orchestration, multi-agent safety monitoring, and sandbagging detection.",
|
|
55
55
|
"features": [
|
|
56
56
|
"Multi-Agent Safety Monitoring - 15+ behavior patterns (AgentVerse, sycophancy, deception, sandbagging)",
|
|
57
57
|
"Sandbagging Detection - Multi-method detection with consistency testing and capability elicitation",
|
|
58
58
|
"Multi-Agent Simulation - Full conversation orchestration with personas, audit trails, and manipulation detection",
|
|
59
59
|
"Universal LLM Access - Call any LLM through LiteLLM (Claude, GPT, Gemini, Bedrock, Azure, local models)",
|
|
60
60
|
"MCP Tool Orchestration - Connect to 1000+ MCP servers (filesystem, databases, browsers, etc.)",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
61
|
+
"S3-Compatible Storage - Persistent context storage with MinIO, AWS S3, or Azure Blob",
|
|
62
|
+
"Prompt Injection Detection - Basic content validation and security warnings",
|
|
63
|
+
"LM Studio Support - Local model hosting with OpenAI-compatible API",
|
|
64
|
+
"Model Query & Caching - Automatic model detection for Anthropic, Cerebras, OpenAI, Gemini"
|
|
63
65
|
],
|
|
64
66
|
"tools": [
|
|
65
67
|
{
|
|
@@ -91,20 +93,20 @@
|
|
|
91
93
|
"description": "Quick sandbagging screening test"
|
|
92
94
|
},
|
|
93
95
|
{
|
|
94
|
-
"name": "
|
|
95
|
-
"description": "Store data in
|
|
96
|
+
"name": "storage_put",
|
|
97
|
+
"description": "Store data in S3-compatible storage"
|
|
96
98
|
},
|
|
97
99
|
{
|
|
98
|
-
"name": "
|
|
99
|
-
"description": "Retrieve data from
|
|
100
|
+
"name": "storage_get",
|
|
101
|
+
"description": "Retrieve data from S3-compatible storage"
|
|
100
102
|
},
|
|
101
103
|
{
|
|
102
|
-
"name": "
|
|
103
|
-
"description": "
|
|
104
|
+
"name": "llm_list_models",
|
|
105
|
+
"description": "List available models from configured providers"
|
|
104
106
|
},
|
|
105
107
|
{
|
|
106
|
-
"name": "
|
|
107
|
-
"description": "
|
|
108
|
+
"name": "llm_config_guide",
|
|
109
|
+
"description": "Get configuration help for LLM providers"
|
|
108
110
|
}
|
|
109
111
|
],
|
|
110
112
|
"configuration": {
|
package/python/README.md
CHANGED
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/uer-mcp)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
**Multi-Provider LLM Gateway • S3-Compatible Storage • MCP Tool Orchestration**
|
|
10
10
|
</div>
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
**Standard config** works in most MCP clients:
|
|
15
|
-
>
|
|
15
|
+
> **Quick Start**: Get a free Cerebras API key at [cloud.cerebras.ai/platform](https://cloud.cerebras.ai/platform) under apikeys or use LM Studio (100% free, local)
|
|
16
|
+
|
|
16
17
|
```json
|
|
17
18
|
{
|
|
18
19
|
"mcpServers": {
|
|
@@ -20,16 +21,21 @@
|
|
|
20
21
|
"command": "npx",
|
|
21
22
|
"args": ["uer-mcp@latest"],
|
|
22
23
|
"env": {
|
|
23
|
-
|
|
24
|
+
// Specific provider key(s)
|
|
25
|
+
"CEREBRAS_API_KEY": "your-key-here",
|
|
26
|
+
"GEMINI_API_KEY": "your-key-here", // etc
|
|
27
|
+
// LM Studio (optional) - requires dummy API key
|
|
28
|
+
"OPENAI_API_BASE": "http://localhost:1234/v1",
|
|
29
|
+
"OPENAI_API_KEY": "sk-local" // any dummy value works
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
>
|
|
36
|
+
> **Storage is optional**: This config works immediately for LLM and MCP features. For storage/context features, see [Storage Configuration Options](#storage-configuration-options) below.
|
|
31
37
|
|
|
32
|
-
>
|
|
38
|
+
> **Required**: Add at least one API key to the `env` section. See [CONFIGURATION.md](CONFIGURATION.md) for all provider links and detailed setup.
|
|
33
39
|
|
|
34
40
|
[<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522uer%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522uer-mcp%2540latest%2522%255D%257D) [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522uer%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522uer-mcp%2540latest%2522%255D%257D) [<img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor">](https://cursor.com/en/install-mcp?name=UER&config=eyJjb21tYW5kIjoibnB4IHVlci1tY3BAbGF0ZXN0In0%3D) [<img src="https://img.shields.io/badge/Windsurf-Windsurf?style=flat-square&label=Install%20Server&color=0B7A8F" alt="Install in Windsurf">](https://windsurf.com)
|
|
35
41
|
|
|
@@ -43,24 +49,24 @@ For Claude Desktop, Goose, Codex, Amp, and other clients, see [CONFIGURATION.md]
|
|
|
43
49
|
---
|
|
44
50
|
|
|
45
51
|
An MCP server that provides:
|
|
46
|
-
1. **
|
|
47
|
-
2. **MCP Tool
|
|
48
|
-
3. **
|
|
49
|
-
4. **
|
|
52
|
+
1. **Multi-Provider LLM Access** - Call 100+ LLM providers (Anthropic, OpenAI, Google, Azure, AWS Bedrock, local models) through LiteLLM
|
|
53
|
+
2. **MCP Tool Integration** - Connect to other MCP servers for extended functionality
|
|
54
|
+
3. **S3-Compatible Storage** - Store context and data in MinIO, AWS S3, or other S3-compatible backends
|
|
55
|
+
4. **Prompt Injection Detection** - Basic content validation and security warnings
|
|
50
56
|
|
|
51
57
|
## Why This Exists
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
- **
|
|
55
|
-
- **
|
|
56
|
-
- **
|
|
57
|
-
- **
|
|
59
|
+
MCP clients often need:
|
|
60
|
+
- **Multiple LLM providers** - Different models for different tasks
|
|
61
|
+
- **Persistent storage** - Save context between sessions
|
|
62
|
+
- **Tool integration** - Connect to specialized MCP servers
|
|
63
|
+
- **Configuration flexibility** - Support cloud and self-hosted solutions
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
65
|
+
UER provides:
|
|
66
|
+
- Unified interface to 100+ LLM providers via LiteLLM
|
|
67
|
+
- S3-compatible storage for context and data
|
|
68
|
+
- MCP client for calling other MCP servers
|
|
69
|
+
- Support for enterprise clouds (Azure, AWS, GCP) and self-hosted (Ollama, LM Studio)
|
|
64
70
|
|
|
65
71
|
## Architecture
|
|
66
72
|
|
|
@@ -80,9 +86,9 @@ graph TB
|
|
|
80
86
|
|
|
81
87
|
subgraph litellm["LiteLLM Gateway"]
|
|
82
88
|
C1["100+ LLM providers"]
|
|
83
|
-
C2["
|
|
84
|
-
C3["
|
|
85
|
-
C4["
|
|
89
|
+
C2["Model routing"]
|
|
90
|
+
C3["Error handling"]
|
|
91
|
+
C4["Response formatting"]
|
|
86
92
|
end
|
|
87
93
|
|
|
88
94
|
subgraph store["Context Store"]
|
|
@@ -142,10 +148,10 @@ llm_call(model="ollama/llama3.1:8b-instruct-q4_K_M", messages=[...])
|
|
|
142
148
|
```
|
|
143
149
|
|
|
144
150
|
Features included:
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
151
|
+
- Unified interface across providers
|
|
152
|
+
- Support for cloud and self-hosted models
|
|
153
|
+
- Automatic model detection and caching
|
|
154
|
+
- Error handling and response formatting
|
|
149
155
|
|
|
150
156
|
### 2. MCP Tool Integration
|
|
151
157
|
|
|
@@ -161,28 +167,25 @@ mcp_call(server="postgres", tool="query", args={"sql": "SELECT * FROM users"})
|
|
|
161
167
|
mcp_call(server="context7", tool="search", args={"query": "LiteLLM API reference"})
|
|
162
168
|
```
|
|
163
169
|
|
|
164
|
-
### 3.
|
|
170
|
+
### 3. S3-Compatible Storage
|
|
165
171
|
|
|
166
|
-
Store data
|
|
172
|
+
Store data in S3-compatible backends:
|
|
167
173
|
|
|
168
174
|
```python
|
|
169
|
-
# Store
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
model="anthropic/claude-sonnet-4-5-20250929",
|
|
175
|
-
task="Analyze the document",
|
|
176
|
-
context_refs=["s3://uer-context/analysis/doc_001.json"]
|
|
175
|
+
# Store data in MinIO, AWS S3, or other S3-compatible storage
|
|
176
|
+
storage_put(
|
|
177
|
+
key="analysis/doc_001.json",
|
|
178
|
+
content={"content": large_document},
|
|
179
|
+
bucket="uer-context"
|
|
177
180
|
)
|
|
178
181
|
|
|
179
|
-
#
|
|
180
|
-
|
|
181
|
-
|
|
182
|
+
# Retrieve data
|
|
183
|
+
data = storage_get(
|
|
184
|
+
key="analysis/doc_001.json",
|
|
185
|
+
bucket="uer-context"
|
|
186
|
+
)
|
|
182
187
|
```
|
|
183
188
|
|
|
184
|
-
**Token savings: 99.9%** for multi-agent workflows.
|
|
185
|
-
|
|
186
189
|
**Storage backends:**
|
|
187
190
|
- **Local:** MinIO (S3-compatible, Docker-based)
|
|
188
191
|
- **Cloud:** AWS S3, Azure Blob Storage, NetApp StorageGRID
|
|
@@ -263,33 +266,14 @@ With storage disabled:
|
|
|
263
266
|
|
|
264
267
|
The server will start successfully without storage, and LLMs won't see storage-related tools in their tool list.
|
|
265
268
|
|
|
266
|
-
### 4.
|
|
269
|
+
### 4. Prompt Injection Detection
|
|
267
270
|
|
|
268
|
-
|
|
271
|
+
Basic content validation and security warnings:
|
|
269
272
|
|
|
270
273
|
```python
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
{"role": "system", "content": "You are a code reviewer..."},
|
|
275
|
-
{"role": "user", "content": "Review this code for security issues"},
|
|
276
|
-
{"role": "assistant", "content": "I'll analyze the code..."},
|
|
277
|
-
{"role": "user", "content": "Focus on SQL injection risks"}
|
|
278
|
-
],
|
|
279
|
-
tools=[...], # MCP tools available to subagent
|
|
280
|
-
context_refs=["registry://context/codebase"] # Large context via URI
|
|
281
|
-
)
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### 5. Continuation Across Sessions
|
|
285
|
-
|
|
286
|
-
Complex tasks can span multiple messages and sessions:
|
|
287
|
-
|
|
288
|
-
```
|
|
289
|
-
Message 1: Start analysis → Progress: 20% → {{continuation: registry://plan/001}}
|
|
290
|
-
Message 2: Continue → Progress: 60% → {{continuation: registry://plan/001}}
|
|
291
|
-
[Next day]
|
|
292
|
-
Message 3: Continue → Complete! Here's your report...
|
|
274
|
+
# Detects potential prompt injection patterns
|
|
275
|
+
# Provides risk assessment and warnings
|
|
276
|
+
# Helps identify suspicious content in user inputs
|
|
293
277
|
```
|
|
294
278
|
|
|
295
279
|
## Usage
|
|
@@ -327,12 +311,15 @@ User: "Ask both Gemini and Claude Sonnet to write a haiku about programming"
|
|
|
327
311
|
→ Returns both haikus for comparison
|
|
328
312
|
```
|
|
329
313
|
|
|
330
|
-
**3. Store and
|
|
314
|
+
**3. Store and Retrieve Data:**
|
|
331
315
|
```
|
|
332
|
-
User: "Store this
|
|
333
|
-
→
|
|
334
|
-
→
|
|
335
|
-
|
|
316
|
+
User: "Store this configuration in S3"
|
|
317
|
+
→ storage_put(key="config/settings.json", content={...})
|
|
318
|
+
→ Returns: Confirmation with storage details
|
|
319
|
+
|
|
320
|
+
User: "Retrieve the configuration"
|
|
321
|
+
→ storage_get(key="config/settings.json")
|
|
322
|
+
→ Returns: Configuration data
|
|
336
323
|
```
|
|
337
324
|
|
|
338
325
|
## Troubleshooting
|
|
@@ -364,25 +351,25 @@ User: "Store this document in the registry and have Gemini summarize it"
|
|
|
364
351
|
| Tool | Description |
|
|
365
352
|
|------|-------------|
|
|
366
353
|
| `llm_call` | Call any LLM via LiteLLM (100+ providers) |
|
|
354
|
+
| `llm_list_models` | List available models from configured providers |
|
|
355
|
+
| `llm_config_guide` | Get configuration help for LLM providers |
|
|
367
356
|
| `mcp_call` | Call any configured MCP server tool |
|
|
368
|
-
| `
|
|
369
|
-
| `
|
|
370
|
-
| `
|
|
371
|
-
| `
|
|
372
|
-
| `
|
|
373
|
-
| `
|
|
357
|
+
| `mcp_list_tools` | List available MCP tools |
|
|
358
|
+
| `mcp_servers` | List configured MCP servers |
|
|
359
|
+
| `storage_put` | Store data in S3-compatible storage |
|
|
360
|
+
| `storage_get` | Retrieve data from storage |
|
|
361
|
+
| `storage_list` | List stored objects |
|
|
362
|
+
| `storage_delete` | Delete stored objects |
|
|
374
363
|
|
|
375
364
|
## LiteLLM Integration
|
|
376
365
|
|
|
377
366
|
This project uses [LiteLLM](https://github.com/BerriAI/litellm) as the unified LLM gateway, providing:
|
|
378
367
|
|
|
379
368
|
- **100+ LLM providers** through single interface
|
|
380
|
-
- **
|
|
381
|
-
- **
|
|
382
|
-
- **
|
|
383
|
-
- **
|
|
384
|
-
- **Fallbacks** between providers on failure
|
|
385
|
-
- **Tool/function calling** normalized across providers
|
|
369
|
+
- **Unified API format** across all providers
|
|
370
|
+
- **Support for cloud and self-hosted models**
|
|
371
|
+
- **Automatic model detection** and caching
|
|
372
|
+
- **Error handling** and response formatting
|
|
386
373
|
|
|
387
374
|
### Supported Providers
|
|
388
375
|
|
package/python/pyproject.toml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "uer"
|
|
3
|
-
version = "4.
|
|
4
|
-
description = "UER - Universal Expert Registry: Multi-
|
|
3
|
+
version = "4.2.0"
|
|
4
|
+
description = "UER - Universal Expert Registry: Multi-provider LLM gateway, S3-compatible storage, and MCP tool orchestration"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
7
7
|
license = { text = "MIT" }
|
|
@@ -8,6 +8,8 @@ from .sandbagging import (
|
|
|
8
8
|
CapabilityElicitation,
|
|
9
9
|
ConsistencyTest,
|
|
10
10
|
DifficultyProfile,
|
|
11
|
+
Question,
|
|
12
|
+
Response,
|
|
11
13
|
SandbaggingDetector,
|
|
12
14
|
SandbaggingReport,
|
|
13
15
|
)
|
|
@@ -18,4 +20,6 @@ __all__ = [
|
|
|
18
20
|
"DifficultyProfile",
|
|
19
21
|
"CapabilityElicitation",
|
|
20
22
|
"SandbaggingReport",
|
|
23
|
+
"Question",
|
|
24
|
+
"Response",
|
|
21
25
|
]
|