@run-iq/mcp-server 0.1.0 → 0.1.1
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 +167 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# @run-iq/mcp-server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server that exposes the **Parametric Policy Engine (PPE)** to LLMs. Connects to Claude Desktop, Cursor, VS Code, and any MCP-compatible client via stdio.
|
|
4
|
+
|
|
5
|
+
Plugin-aware: the server dynamically adapts its tools, resources, and prompts to whatever plugins are loaded — zero hardcoding required.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @run-iq/mcp-server
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or run directly with npx:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @run-iq/mcp-server
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Configuration
|
|
20
|
+
|
|
21
|
+
### Claude Desktop
|
|
22
|
+
|
|
23
|
+
Add to `claude_desktop_config.json`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"run-iq": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["@run-iq/mcp-server"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Cursor / VS Code
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"mcpServers": {
|
|
41
|
+
"run-iq": {
|
|
42
|
+
"command": "npx",
|
|
43
|
+
"args": ["@run-iq/mcp-server"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Custom plugins
|
|
50
|
+
|
|
51
|
+
Load your own plugins from a directory:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"run-iq": {
|
|
57
|
+
"command": "npx",
|
|
58
|
+
"args": ["@run-iq/mcp-server", "--plugins-dir", "/path/to/plugins"]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Each `.js` or `.mjs` file in the directory must export a `PluginBundle`:
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import type { PluginBundle } from '@run-iq/plugin-sdk';
|
|
68
|
+
|
|
69
|
+
const bundle: PluginBundle = {
|
|
70
|
+
plugin: new MyPlugin(),
|
|
71
|
+
descriptor: myDescriptor,
|
|
72
|
+
dsls: [new MyDslEvaluator()],
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default bundle;
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Tools (8)
|
|
79
|
+
|
|
80
|
+
| Tool | Description |
|
|
81
|
+
|------|-------------|
|
|
82
|
+
| `evaluate` | Evaluate rules against input data (always dry-run) |
|
|
83
|
+
| `simulate` | Compare N scenarios side-by-side with the same rules |
|
|
84
|
+
| `validate_rules` | Verify rule structure, checksum, model params, and plugin fields |
|
|
85
|
+
| `create_rule` | Generate a valid Rule JSON with auto-computed SHA-256 checksum |
|
|
86
|
+
| `inspect_rule` | Analyze a single rule in detail (validity, active status, errors) |
|
|
87
|
+
| `explain_result` | Human-readable explanation of an EvaluationResult |
|
|
88
|
+
| `list_models` | List available calculation models with parameter schemas |
|
|
89
|
+
| `create_checksum` | Compute SHA-256 checksum for a params object |
|
|
90
|
+
|
|
91
|
+
All tools with plugin-specific fields (e.g. `create_rule`, `validate_rules`) dynamically adapt their schemas based on loaded plugins.
|
|
92
|
+
|
|
93
|
+
## Resources (3)
|
|
94
|
+
|
|
95
|
+
| URI | Description |
|
|
96
|
+
|-----|-------------|
|
|
97
|
+
| `schema://rules` | Complete rule schema: base fields, plugin extensions, model params, input variables, JSONLogic syntax, and examples |
|
|
98
|
+
| `models://catalog` | Markdown documentation of all calculation models with parameters and usage examples |
|
|
99
|
+
| `plugins://loaded` | Information about loaded plugins, DSL evaluators, and descriptor status |
|
|
100
|
+
|
|
101
|
+
## Prompts (2)
|
|
102
|
+
|
|
103
|
+
| Prompt | Description |
|
|
104
|
+
|--------|-------------|
|
|
105
|
+
| `domain-expert` | Domain-specific expertise adapted to loaded plugins: scenario comparison, result explanation, recommendations |
|
|
106
|
+
| `analyze-text` | Translate regulatory/policy text into Run-IQ rule definitions with all required plugin fields |
|
|
107
|
+
|
|
108
|
+
Both prompts dynamically inject plugin metadata, guidelines, and examples.
|
|
109
|
+
|
|
110
|
+
## Plugin-aware architecture
|
|
111
|
+
|
|
112
|
+
The server adapts to any loaded plugin through the `PluginDescriptor` contract (from `@run-iq/plugin-sdk`):
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
Plugin loads → descriptor provides metadata → server adapts everything
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
- **Tools**: `create_rule` adds plugin-required fields to its Zod schema. `validate_rules` checks plugin-specific constraints.
|
|
119
|
+
- **Resources**: `schema://rules` documents plugin extension fields, input variables, and examples.
|
|
120
|
+
- **Prompts**: `domain-expert` becomes a fiscal/social/payroll expert based on what's loaded. `analyze-text` injects plugin-specific model guidance and examples.
|
|
121
|
+
|
|
122
|
+
### Default behavior
|
|
123
|
+
|
|
124
|
+
Without `--plugins-dir`, the server loads `@run-iq/plugin-fiscal` + `@run-iq/dsl-jsonlogic` by default, providing 6 fiscal calculation models (FLAT_RATE, PROGRESSIVE_BRACKET, MINIMUM_TAX, THRESHOLD_BASED, FIXED_AMOUNT, COMPOSITE).
|
|
125
|
+
|
|
126
|
+
### Writing a custom plugin
|
|
127
|
+
|
|
128
|
+
A plugin describes itself via `PluginDescriptor`:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import type { PluginDescriptor } from '@run-iq/plugin-sdk';
|
|
132
|
+
|
|
133
|
+
export const socialDescriptor: PluginDescriptor = {
|
|
134
|
+
name: '@run-iq/plugin-social',
|
|
135
|
+
version: '0.1.0',
|
|
136
|
+
domainLabel: 'social',
|
|
137
|
+
description: 'Social benefits calculation plugin',
|
|
138
|
+
ruleExtensions: [
|
|
139
|
+
{ name: 'benefitType', type: 'string', required: true,
|
|
140
|
+
enum: ['ALLOCATION', 'AIDE', 'EXONERATION'], description: '...' },
|
|
141
|
+
],
|
|
142
|
+
inputFields: [
|
|
143
|
+
{ name: 'householdIncome', type: 'number', description: '...', examples: [150000] },
|
|
144
|
+
],
|
|
145
|
+
examples: [/* concrete rule examples */],
|
|
146
|
+
promptGuidelines: [
|
|
147
|
+
'Consider household composition when creating rules',
|
|
148
|
+
'Use THRESHOLD model for means-tested benefits',
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The MCP server will automatically expose `benefitType` in `create_rule`, validate it in `validate_rules`, document it in `schema://rules`, and inject the guidelines into prompts.
|
|
154
|
+
|
|
155
|
+
## Safety
|
|
156
|
+
|
|
157
|
+
- **Always dry-run**: the engine never persists snapshots — safe for AI experimentation
|
|
158
|
+
- **Read-only**: no mutations to external state
|
|
159
|
+
- **Checksum verification**: SHA-256 integrity checks on rule params
|
|
160
|
+
|
|
161
|
+
## Requirements
|
|
162
|
+
|
|
163
|
+
- Node.js >= 20
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
MIT — Abdou-Raouf ATARMLA
|