mathmethods-mcp 0.1.0__tar.gz → 0.2.0__tar.gz
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.
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/PKG-INFO +122 -34
- mathmethods_mcp-0.1.0/mathmethods_mcp.egg-info/PKG-INFO → mathmethods_mcp-0.2.0/README.md +114 -51
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/__init__.py +1 -1
- mathmethods_mcp-0.2.0/mathmethods/plots.py +583 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/server.py +202 -87
- mathmethods_mcp-0.1.0/README.md → mathmethods_mcp-0.2.0/mathmethods_mcp.egg-info/PKG-INFO +139 -33
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods_mcp.egg-info/SOURCES.txt +2 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods_mcp.egg-info/requires.txt +3 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/pyproject.toml +18 -1
- mathmethods_mcp-0.2.0/tests/test_plots.py +191 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/LICENSE +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/__main__.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/compiler.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/__init__.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/differentiation.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/dynamic_1d.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/dynamic_2d_conservative.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/dynamic_2d_lanchester.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/dynamic_2d_linear.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/dynamic_2d_non_homogeneous.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/dynamic_2d_nonlinear.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/integration.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/interpolation.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/monte_carlo.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/ode.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/root_finding.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods/core/utils.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods_mcp.egg-info/dependency_links.txt +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods_mcp.egg-info/entry_points.txt +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/mathmethods_mcp.egg-info/top_level.txt +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/setup.cfg +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/tests/test_dynamic_tools.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/tests/test_extended_tools.py +0 -0
- {mathmethods_mcp-0.1.0 → mathmethods_mcp-0.2.0}/tests/test_tools.py +0 -0
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mathmethods-mcp
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: MCP server exposing numerical-methods tools: bisection, Simpson 1/3, Runge-Kutta 4, Lagrange interpolation
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Repository, https://github.com/agmonetti/mathmethods-mcp
|
|
7
|
+
Keywords: mcp,model-context-protocol,numerical-methods,mathematics,calculus,scientific-computing
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
7
12
|
Requires-Python: >=3.10
|
|
8
13
|
Description-Content-Type: text/markdown
|
|
9
14
|
License-File: LICENSE
|
|
@@ -14,14 +19,19 @@ Requires-Dist: scipy>=1.11.0
|
|
|
14
19
|
Provides-Extra: dev
|
|
15
20
|
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
16
21
|
Requires-Dist: ruff>=0.8.0; extra == "dev"
|
|
22
|
+
Provides-Extra: viz
|
|
23
|
+
Requires-Dist: matplotlib>=3.8; extra == "viz"
|
|
17
24
|
Dynamic: license-file
|
|
18
25
|
|
|
19
|
-
#
|
|
26
|
+
# Mathematical/Numerical Methods - MCP Server
|
|
20
27
|
|
|
21
28
|
[](https://modelcontextprotocol.io/introduction)
|
|
22
29
|
[](LICENSE)
|
|
23
30
|
[](https://github.com/agmonetti/mathmethods-mcp/actions/workflows/ci.yml)
|
|
31
|
+
[](https://www.npmjs.com/package/@agmonetti/mathmethods-mcp)
|
|
24
32
|
[](https://pypi.org/project/mathmethods-mcp/)
|
|
33
|
+
[](https://m8ven.ai/mcp/agmonetti-mathmethods-mcp-1l7999)
|
|
34
|
+
[](https://aiagentslisting.com/mcp/mathmethods-mcp)
|
|
25
35
|
|
|
26
36
|
A [Model Context Protocol](https://modelcontextprotocol.io) server that exposes a
|
|
27
37
|
numerical-methods core as tools an LLM agent can call directly from a chat
|
|
@@ -30,17 +40,70 @@ numerical-methods engine of the academic project `modeladoYsimulacion-web`
|
|
|
30
40
|
(UADE); the math core is **vendored** into this repository so the server is
|
|
31
41
|
fully self-contained.
|
|
32
42
|
|
|
33
|
-
##
|
|
43
|
+
## Installation and Usage
|
|
34
44
|
|
|
45
|
+
### 1. Run with NPX (Recommended)
|
|
46
|
+
|
|
47
|
+
Runs on-demand without any global installation:
|
|
48
|
+
|
|
49
|
+
#### Claude Code (One-liner CLI)
|
|
35
50
|
```bash
|
|
36
|
-
claude mcp add mathmethods
|
|
51
|
+
claude mcp add mathmethods npx -y @agmonetti/mathmethods-mcp
|
|
37
52
|
```
|
|
38
53
|
|
|
39
|
-
|
|
40
|
-
|
|
54
|
+
#### Claude Desktop & Cursor (JSON Configuration)
|
|
55
|
+
Add to your `claude_desktop_config.json` or `.cursor/mcp.json`:
|
|
41
56
|
|
|
42
57
|
```json
|
|
43
|
-
{
|
|
58
|
+
{
|
|
59
|
+
"mcpServers": {
|
|
60
|
+
"mathmethods": {
|
|
61
|
+
"command": "npx",
|
|
62
|
+
"args": ["-y", "@agmonetti/mathmethods-mcp"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### 2. Install Globally from NPM
|
|
71
|
+
|
|
72
|
+
Ideal for instant startup without network latency on every invocation:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install -g @agmonetti/mathmethods-mcp
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"mcpServers": {
|
|
81
|
+
"mathmethods": {
|
|
82
|
+
"command": "mathmethods-mcp"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### 3. Run with UVX (Direct Python)
|
|
91
|
+
|
|
92
|
+
Any MCP client can also run the Python package directly with Astral's `uvx`:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
claude mcp add mathmethods-mcp -- uvx mathmethods-mcp
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"mcpServers": {
|
|
101
|
+
"mathmethods": {
|
|
102
|
+
"command": "uvx",
|
|
103
|
+
"args": ["mathmethods-mcp"]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
44
107
|
```
|
|
45
108
|
|
|
46
109
|
<details>
|
|
@@ -48,14 +111,14 @@ Any MCP client registers the server with the same one-liner command —
|
|
|
48
111
|
|
|
49
112
|
```bash
|
|
50
113
|
git clone https://github.com/agmonetti/mathmethods-mcp.git
|
|
51
|
-
cd mathmethods
|
|
114
|
+
cd mathmethods-mcp
|
|
52
115
|
uv sync --extra dev
|
|
53
|
-
uv run
|
|
116
|
+
uv run server.py
|
|
54
117
|
```
|
|
55
118
|
|
|
56
|
-
Every client config
|
|
119
|
+
Every client config above also works with
|
|
57
120
|
`uv run --frozen --project <checkout> python <checkout>/server.py` in place of
|
|
58
|
-
`uvx mathmethods-mcp`.
|
|
121
|
+
`npx -y @agmonetti/mathmethods-mcp` or `uvx mathmethods-mcp`.
|
|
59
122
|
</details>
|
|
60
123
|
|
|
61
124
|
## Tools
|
|
@@ -124,13 +187,38 @@ Math expressions use Python/SymPy syntax: `x**2`, `sin(x)`, `exp(x)`,
|
|
|
124
187
|
and the caret `^` for powers. The Greek combat parameters of Lanchester use the
|
|
125
188
|
Unicode symbols `α β γ ε μ δ`.
|
|
126
189
|
|
|
190
|
+
## Plots (optional)
|
|
191
|
+
|
|
192
|
+
Every tool accepts a `plot=False | True` flag. With `plot=True` the response
|
|
193
|
+
contains the usual JSON **plus** a rendered PNG (an MCP image content block):
|
|
194
|
+
phase portraits, solution curves, bifurcation diagrams, Monte Carlo
|
|
195
|
+
convergence, and so on.
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
"Solve y' = y, y(0)=1 on [0,1] with RK4 and show me the plot."
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Plotting needs the optional `viz` extra (Matplotlib), which is **not** part of
|
|
202
|
+
the default install so the stdio server startup stays light:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
pip install "mathmethods-mcp[viz]" # pip
|
|
206
|
+
uvx --from "mathmethods-mcp[viz]" mathmethods-mcp # uv
|
|
207
|
+
uv sync --extra viz # from a checkout
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
If `plot=True` is used without the extra, the tool returns a clear error telling
|
|
211
|
+
you how to install it. Clients that do not render images still receive the JSON
|
|
212
|
+
result alongside the image, so nothing is lost.
|
|
213
|
+
|
|
127
214
|
## Project layout
|
|
128
215
|
|
|
129
216
|
```
|
|
130
|
-
|
|
217
|
+
mathmethods-mcp/
|
|
131
218
|
├── server.py # FastMCP app + all tools
|
|
132
219
|
├── mathmethods/
|
|
133
220
|
│ ├── compiler.py # hardened expression validation (whitelist, caps)
|
|
221
|
+
│ ├── plots.py # optional PNG rendering (plot=True), lazy matplotlib
|
|
134
222
|
│ ├── server.py # FastMCP app and tool definitions
|
|
135
223
|
│ └── core/ # vendored math core (from modeladoYsimulacion-web)
|
|
136
224
|
│ ├── root_finding.py ├── integration.py
|
|
@@ -140,7 +228,7 @@ modelo-mat-mcp/
|
|
|
140
228
|
│ ├── dynamic_2d_non_homogeneous.py ├── dynamic_2d_nonlinear.py
|
|
141
229
|
│ ├── dynamic_2d_conservative.py ├── dynamic_2d_lanchester.py
|
|
142
230
|
│ └── utils.py
|
|
143
|
-
├── tests/ # test_tools.py + test_dynamic_tools.py
|
|
231
|
+
├── tests/ # test_tools.py + test_dynamic_tools.py + test_plots.py
|
|
144
232
|
├── mcp.example.json # server registration template (copy to .vscode/mcp.json)
|
|
145
233
|
├── requirements.txt
|
|
146
234
|
└── pyproject.toml
|
|
@@ -149,7 +237,7 @@ modelo-mat-mcp/
|
|
|
149
237
|
## Install
|
|
150
238
|
|
|
151
239
|
```bash
|
|
152
|
-
cd
|
|
240
|
+
cd mathmethods-mcp
|
|
153
241
|
python3 -m venv venv
|
|
154
242
|
source venv/bin/activate
|
|
155
243
|
pip install -r requirements.txt
|
|
@@ -198,12 +286,12 @@ Create `.vscode/mcp.json` (git-ignored) — or copy `mcp.example.json`:
|
|
|
198
286
|
```json
|
|
199
287
|
{
|
|
200
288
|
"servers": {
|
|
201
|
-
"
|
|
289
|
+
"mathmethods-stdio": {
|
|
202
290
|
"type": "stdio",
|
|
203
|
-
"command": "
|
|
204
|
-
"args": ["mathmethods"]
|
|
291
|
+
"command": "npx",
|
|
292
|
+
"args": ["-y", "@agmonetti/mathmethods-mcp"]
|
|
205
293
|
},
|
|
206
|
-
"
|
|
294
|
+
"mathmethods-http": {
|
|
207
295
|
"type": "http",
|
|
208
296
|
"url": "http://127.0.0.1:8000/mcp"
|
|
209
297
|
}
|
|
@@ -225,9 +313,9 @@ Add the entry under `context_servers` (note: **not** `mcp_servers`) in
|
|
|
225
313
|
```json
|
|
226
314
|
{
|
|
227
315
|
"context_servers": {
|
|
228
|
-
"
|
|
229
|
-
"command": "
|
|
230
|
-
"args": ["mathmethods"]
|
|
316
|
+
"mathmethods": {
|
|
317
|
+
"command": "npx",
|
|
318
|
+
"args": ["-y", "@agmonetti/mathmethods-mcp"]
|
|
231
319
|
}
|
|
232
320
|
}
|
|
233
321
|
}
|
|
@@ -247,9 +335,9 @@ global `~/.config/opencode/opencode.jsonc`:
|
|
|
247
335
|
```json
|
|
248
336
|
{
|
|
249
337
|
"mcp": {
|
|
250
|
-
"
|
|
338
|
+
"mathmethods": {
|
|
251
339
|
"type": "local",
|
|
252
|
-
"command": ["
|
|
340
|
+
"command": ["npx", "-y", "@agmonetti/mathmethods-mcp"],
|
|
253
341
|
"enabled": true
|
|
254
342
|
}
|
|
255
343
|
}
|
|
@@ -259,7 +347,7 @@ global `~/.config/opencode/opencode.jsonc`:
|
|
|
259
347
|
Or register it with the CLI (equivalent):
|
|
260
348
|
|
|
261
349
|
```bash
|
|
262
|
-
opencode mcp add
|
|
350
|
+
opencode mcp add mathmethods -- npx -y @agmonetti/mathmethods-mcp
|
|
263
351
|
```
|
|
264
352
|
|
|
265
353
|
For a remote server running on `http://127.0.0.1:8000/mcp`:
|
|
@@ -267,7 +355,7 @@ For a remote server running on `http://127.0.0.1:8000/mcp`:
|
|
|
267
355
|
```json
|
|
268
356
|
{
|
|
269
357
|
"mcp": {
|
|
270
|
-
"
|
|
358
|
+
"mathmethods": {
|
|
271
359
|
"type": "remote",
|
|
272
360
|
"url": "http://127.0.0.1:8000/mcp",
|
|
273
361
|
"enabled": true
|
|
@@ -289,9 +377,9 @@ Add the entry under `mcpServers` in the Antigravity config file, typically
|
|
|
289
377
|
```json
|
|
290
378
|
{
|
|
291
379
|
"mcpServers": {
|
|
292
|
-
"
|
|
293
|
-
"command": "
|
|
294
|
-
"args": ["mathmethods"]
|
|
380
|
+
"mathmethods": {
|
|
381
|
+
"command": "npx",
|
|
382
|
+
"args": ["-y", "@agmonetti/mathmethods-mcp"]
|
|
295
383
|
}
|
|
296
384
|
}
|
|
297
385
|
}
|
|
@@ -315,9 +403,9 @@ then inside the session:
|
|
|
315
403
|
|
|
316
404
|
```text
|
|
317
405
|
/mcp add
|
|
318
|
-
Server name:
|
|
406
|
+
Server name: mathmethods
|
|
319
407
|
Server type: 1 (Local/STDIO)
|
|
320
|
-
Command:
|
|
408
|
+
Command: npx -y @agmonetti/mathmethods-mcp
|
|
321
409
|
```
|
|
322
410
|
|
|
323
411
|
Press `Ctrl+S` to save. The settings are stored in
|
|
@@ -333,15 +421,15 @@ Both use the `mcpServers` format. In Claude Desktop, edit
|
|
|
333
421
|
`claude_desktop_config.json`; in Claude Code:
|
|
334
422
|
|
|
335
423
|
```bash
|
|
336
|
-
claude mcp add mathmethods
|
|
424
|
+
claude mcp add mathmethods npx -y @agmonetti/mathmethods-mcp
|
|
337
425
|
```
|
|
338
426
|
|
|
339
427
|
```json
|
|
340
428
|
{
|
|
341
429
|
"mcpServers": {
|
|
342
|
-
"
|
|
343
|
-
"command": "
|
|
344
|
-
"args": ["mathmethods"]
|
|
430
|
+
"mathmethods": {
|
|
431
|
+
"command": "npx",
|
|
432
|
+
"args": ["-y", "@agmonetti/mathmethods-mcp"]
|
|
345
433
|
}
|
|
346
434
|
}
|
|
347
435
|
}
|
|
@@ -1,27 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
Name: mathmethods-mcp
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: MCP server exposing numerical-methods tools: bisection, Simpson 1/3, Runge-Kutta 4, Lagrange interpolation
|
|
5
|
-
License-Expression: MIT
|
|
6
|
-
Project-URL: Repository, https://github.com/agmonetti/mathmethods-mcp
|
|
7
|
-
Requires-Python: >=3.10
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Requires-Dist: mcp[cli]==1.14.1
|
|
11
|
-
Requires-Dist: numpy>=1.26.0
|
|
12
|
-
Requires-Dist: sympy>=1.12.0
|
|
13
|
-
Requires-Dist: scipy>=1.11.0
|
|
14
|
-
Provides-Extra: dev
|
|
15
|
-
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
16
|
-
Requires-Dist: ruff>=0.8.0; extra == "dev"
|
|
17
|
-
Dynamic: license-file
|
|
18
|
-
|
|
19
|
-
# MathematicalMethods MCP Server
|
|
1
|
+
# Mathematical/Numerical Methods - MCP Server
|
|
20
2
|
|
|
21
3
|
[](https://modelcontextprotocol.io/introduction)
|
|
22
4
|
[](LICENSE)
|
|
23
5
|
[](https://github.com/agmonetti/mathmethods-mcp/actions/workflows/ci.yml)
|
|
6
|
+
[](https://www.npmjs.com/package/@agmonetti/mathmethods-mcp)
|
|
24
7
|
[](https://pypi.org/project/mathmethods-mcp/)
|
|
8
|
+
[](https://m8ven.ai/mcp/agmonetti-mathmethods-mcp-1l7999)
|
|
9
|
+
[](https://aiagentslisting.com/mcp/mathmethods-mcp)
|
|
25
10
|
|
|
26
11
|
A [Model Context Protocol](https://modelcontextprotocol.io) server that exposes a
|
|
27
12
|
numerical-methods core as tools an LLM agent can call directly from a chat
|
|
@@ -30,17 +15,70 @@ numerical-methods engine of the academic project `modeladoYsimulacion-web`
|
|
|
30
15
|
(UADE); the math core is **vendored** into this repository so the server is
|
|
31
16
|
fully self-contained.
|
|
32
17
|
|
|
33
|
-
##
|
|
18
|
+
## Installation and Usage
|
|
34
19
|
|
|
20
|
+
### 1. Run with NPX (Recommended)
|
|
21
|
+
|
|
22
|
+
Runs on-demand without any global installation:
|
|
23
|
+
|
|
24
|
+
#### Claude Code (One-liner CLI)
|
|
35
25
|
```bash
|
|
36
|
-
claude mcp add mathmethods
|
|
26
|
+
claude mcp add mathmethods npx -y @agmonetti/mathmethods-mcp
|
|
37
27
|
```
|
|
38
28
|
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
#### Claude Desktop & Cursor (JSON Configuration)
|
|
30
|
+
Add to your `claude_desktop_config.json` or `.cursor/mcp.json`:
|
|
41
31
|
|
|
42
32
|
```json
|
|
43
|
-
{
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"mathmethods": {
|
|
36
|
+
"command": "npx",
|
|
37
|
+
"args": ["-y", "@agmonetti/mathmethods-mcp"]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### 2. Install Globally from NPM
|
|
46
|
+
|
|
47
|
+
Ideal for instant startup without network latency on every invocation:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install -g @agmonetti/mathmethods-mcp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"mathmethods": {
|
|
57
|
+
"command": "mathmethods-mcp"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### 3. Run with UVX (Direct Python)
|
|
66
|
+
|
|
67
|
+
Any MCP client can also run the Python package directly with Astral's `uvx`:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
claude mcp add mathmethods-mcp -- uvx mathmethods-mcp
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"mathmethods": {
|
|
77
|
+
"command": "uvx",
|
|
78
|
+
"args": ["mathmethods-mcp"]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
44
82
|
```
|
|
45
83
|
|
|
46
84
|
<details>
|
|
@@ -48,14 +86,14 @@ Any MCP client registers the server with the same one-liner command —
|
|
|
48
86
|
|
|
49
87
|
```bash
|
|
50
88
|
git clone https://github.com/agmonetti/mathmethods-mcp.git
|
|
51
|
-
cd mathmethods
|
|
89
|
+
cd mathmethods-mcp
|
|
52
90
|
uv sync --extra dev
|
|
53
|
-
uv run
|
|
91
|
+
uv run server.py
|
|
54
92
|
```
|
|
55
93
|
|
|
56
|
-
Every client config
|
|
94
|
+
Every client config above also works with
|
|
57
95
|
`uv run --frozen --project <checkout> python <checkout>/server.py` in place of
|
|
58
|
-
`uvx mathmethods-mcp`.
|
|
96
|
+
`npx -y @agmonetti/mathmethods-mcp` or `uvx mathmethods-mcp`.
|
|
59
97
|
</details>
|
|
60
98
|
|
|
61
99
|
## Tools
|
|
@@ -124,13 +162,38 @@ Math expressions use Python/SymPy syntax: `x**2`, `sin(x)`, `exp(x)`,
|
|
|
124
162
|
and the caret `^` for powers. The Greek combat parameters of Lanchester use the
|
|
125
163
|
Unicode symbols `α β γ ε μ δ`.
|
|
126
164
|
|
|
165
|
+
## Plots (optional)
|
|
166
|
+
|
|
167
|
+
Every tool accepts a `plot=False | True` flag. With `plot=True` the response
|
|
168
|
+
contains the usual JSON **plus** a rendered PNG (an MCP image content block):
|
|
169
|
+
phase portraits, solution curves, bifurcation diagrams, Monte Carlo
|
|
170
|
+
convergence, and so on.
|
|
171
|
+
|
|
172
|
+
```text
|
|
173
|
+
"Solve y' = y, y(0)=1 on [0,1] with RK4 and show me the plot."
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Plotting needs the optional `viz` extra (Matplotlib), which is **not** part of
|
|
177
|
+
the default install so the stdio server startup stays light:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
pip install "mathmethods-mcp[viz]" # pip
|
|
181
|
+
uvx --from "mathmethods-mcp[viz]" mathmethods-mcp # uv
|
|
182
|
+
uv sync --extra viz # from a checkout
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
If `plot=True` is used without the extra, the tool returns a clear error telling
|
|
186
|
+
you how to install it. Clients that do not render images still receive the JSON
|
|
187
|
+
result alongside the image, so nothing is lost.
|
|
188
|
+
|
|
127
189
|
## Project layout
|
|
128
190
|
|
|
129
191
|
```
|
|
130
|
-
|
|
192
|
+
mathmethods-mcp/
|
|
131
193
|
├── server.py # FastMCP app + all tools
|
|
132
194
|
├── mathmethods/
|
|
133
195
|
│ ├── compiler.py # hardened expression validation (whitelist, caps)
|
|
196
|
+
│ ├── plots.py # optional PNG rendering (plot=True), lazy matplotlib
|
|
134
197
|
│ ├── server.py # FastMCP app and tool definitions
|
|
135
198
|
│ └── core/ # vendored math core (from modeladoYsimulacion-web)
|
|
136
199
|
│ ├── root_finding.py ├── integration.py
|
|
@@ -140,7 +203,7 @@ modelo-mat-mcp/
|
|
|
140
203
|
│ ├── dynamic_2d_non_homogeneous.py ├── dynamic_2d_nonlinear.py
|
|
141
204
|
│ ├── dynamic_2d_conservative.py ├── dynamic_2d_lanchester.py
|
|
142
205
|
│ └── utils.py
|
|
143
|
-
├── tests/ # test_tools.py + test_dynamic_tools.py
|
|
206
|
+
├── tests/ # test_tools.py + test_dynamic_tools.py + test_plots.py
|
|
144
207
|
├── mcp.example.json # server registration template (copy to .vscode/mcp.json)
|
|
145
208
|
├── requirements.txt
|
|
146
209
|
└── pyproject.toml
|
|
@@ -149,7 +212,7 @@ modelo-mat-mcp/
|
|
|
149
212
|
## Install
|
|
150
213
|
|
|
151
214
|
```bash
|
|
152
|
-
cd
|
|
215
|
+
cd mathmethods-mcp
|
|
153
216
|
python3 -m venv venv
|
|
154
217
|
source venv/bin/activate
|
|
155
218
|
pip install -r requirements.txt
|
|
@@ -198,12 +261,12 @@ Create `.vscode/mcp.json` (git-ignored) — or copy `mcp.example.json`:
|
|
|
198
261
|
```json
|
|
199
262
|
{
|
|
200
263
|
"servers": {
|
|
201
|
-
"
|
|
264
|
+
"mathmethods-stdio": {
|
|
202
265
|
"type": "stdio",
|
|
203
|
-
"command": "
|
|
204
|
-
"args": ["mathmethods"]
|
|
266
|
+
"command": "npx",
|
|
267
|
+
"args": ["-y", "@agmonetti/mathmethods-mcp"]
|
|
205
268
|
},
|
|
206
|
-
"
|
|
269
|
+
"mathmethods-http": {
|
|
207
270
|
"type": "http",
|
|
208
271
|
"url": "http://127.0.0.1:8000/mcp"
|
|
209
272
|
}
|
|
@@ -225,9 +288,9 @@ Add the entry under `context_servers` (note: **not** `mcp_servers`) in
|
|
|
225
288
|
```json
|
|
226
289
|
{
|
|
227
290
|
"context_servers": {
|
|
228
|
-
"
|
|
229
|
-
"command": "
|
|
230
|
-
"args": ["mathmethods"]
|
|
291
|
+
"mathmethods": {
|
|
292
|
+
"command": "npx",
|
|
293
|
+
"args": ["-y", "@agmonetti/mathmethods-mcp"]
|
|
231
294
|
}
|
|
232
295
|
}
|
|
233
296
|
}
|
|
@@ -247,9 +310,9 @@ global `~/.config/opencode/opencode.jsonc`:
|
|
|
247
310
|
```json
|
|
248
311
|
{
|
|
249
312
|
"mcp": {
|
|
250
|
-
"
|
|
313
|
+
"mathmethods": {
|
|
251
314
|
"type": "local",
|
|
252
|
-
"command": ["
|
|
315
|
+
"command": ["npx", "-y", "@agmonetti/mathmethods-mcp"],
|
|
253
316
|
"enabled": true
|
|
254
317
|
}
|
|
255
318
|
}
|
|
@@ -259,7 +322,7 @@ global `~/.config/opencode/opencode.jsonc`:
|
|
|
259
322
|
Or register it with the CLI (equivalent):
|
|
260
323
|
|
|
261
324
|
```bash
|
|
262
|
-
opencode mcp add
|
|
325
|
+
opencode mcp add mathmethods -- npx -y @agmonetti/mathmethods-mcp
|
|
263
326
|
```
|
|
264
327
|
|
|
265
328
|
For a remote server running on `http://127.0.0.1:8000/mcp`:
|
|
@@ -267,7 +330,7 @@ For a remote server running on `http://127.0.0.1:8000/mcp`:
|
|
|
267
330
|
```json
|
|
268
331
|
{
|
|
269
332
|
"mcp": {
|
|
270
|
-
"
|
|
333
|
+
"mathmethods": {
|
|
271
334
|
"type": "remote",
|
|
272
335
|
"url": "http://127.0.0.1:8000/mcp",
|
|
273
336
|
"enabled": true
|
|
@@ -289,9 +352,9 @@ Add the entry under `mcpServers` in the Antigravity config file, typically
|
|
|
289
352
|
```json
|
|
290
353
|
{
|
|
291
354
|
"mcpServers": {
|
|
292
|
-
"
|
|
293
|
-
"command": "
|
|
294
|
-
"args": ["mathmethods"]
|
|
355
|
+
"mathmethods": {
|
|
356
|
+
"command": "npx",
|
|
357
|
+
"args": ["-y", "@agmonetti/mathmethods-mcp"]
|
|
295
358
|
}
|
|
296
359
|
}
|
|
297
360
|
}
|
|
@@ -315,9 +378,9 @@ then inside the session:
|
|
|
315
378
|
|
|
316
379
|
```text
|
|
317
380
|
/mcp add
|
|
318
|
-
Server name:
|
|
381
|
+
Server name: mathmethods
|
|
319
382
|
Server type: 1 (Local/STDIO)
|
|
320
|
-
Command:
|
|
383
|
+
Command: npx -y @agmonetti/mathmethods-mcp
|
|
321
384
|
```
|
|
322
385
|
|
|
323
386
|
Press `Ctrl+S` to save. The settings are stored in
|
|
@@ -333,15 +396,15 @@ Both use the `mcpServers` format. In Claude Desktop, edit
|
|
|
333
396
|
`claude_desktop_config.json`; in Claude Code:
|
|
334
397
|
|
|
335
398
|
```bash
|
|
336
|
-
claude mcp add mathmethods
|
|
399
|
+
claude mcp add mathmethods npx -y @agmonetti/mathmethods-mcp
|
|
337
400
|
```
|
|
338
401
|
|
|
339
402
|
```json
|
|
340
403
|
{
|
|
341
404
|
"mcpServers": {
|
|
342
|
-
"
|
|
343
|
-
"command": "
|
|
344
|
-
"args": ["mathmethods"]
|
|
405
|
+
"mathmethods": {
|
|
406
|
+
"command": "npx",
|
|
407
|
+
"args": ["-y", "@agmonetti/mathmethods-mcp"]
|
|
345
408
|
}
|
|
346
409
|
}
|
|
347
410
|
}
|