agent-utils-extensions 0.1.0__py3-none-any.whl
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.
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
"""Thin MCP-over-HTTP client for the hosted agent_utils Extensions server.
|
|
3
|
+
|
|
4
|
+
Extensions is the stateless half of agent_utils: exact math and unit
|
|
5
|
+
conversion (general, electrical, chemistry, thermodynamics), all on one endpoint.
|
|
6
|
+
|
|
7
|
+
This is a client, not the service - see https://agent-utils.ai.
|
|
8
|
+
Zero dependencies: standard library only.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
import urllib.error
|
|
15
|
+
import urllib.request
|
|
16
|
+
from typing import Any
|
|
17
|
+
|
|
18
|
+
DEFAULT_ENDPOINT = "https://mcp.agent-utils.ai/extensions"
|
|
19
|
+
STAGING_ENDPOINT = "https://mcp-staging.agent-utils.ai/extensions"
|
|
20
|
+
USER_AGENT = "agent-utils-extensions-py/0.1.0"
|
|
21
|
+
|
|
22
|
+
__all__ = ["AgentUtilsExtensions", "DEFAULT_ENDPOINT", "STAGING_ENDPOINT"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AgentUtilsExtensions:
|
|
26
|
+
"""Client for the agent_utils Extensions MCP server.
|
|
27
|
+
|
|
28
|
+
The same token works on both agent_utils servers (swarm and extensions) and
|
|
29
|
+
draws from one credit pool. Any secret works as a token - the first call
|
|
30
|
+
auto-provisions a free trial. See https://agent-utils.ai.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
def __init__(self, token: str, endpoint: str = DEFAULT_ENDPOINT) -> None:
|
|
34
|
+
self._token = token
|
|
35
|
+
self._endpoint = endpoint
|
|
36
|
+
self._id = 0
|
|
37
|
+
|
|
38
|
+
def call(self, name: str, arguments: dict[str, Any] | None = None) -> Any:
|
|
39
|
+
"""Call any MCP tool by name and return its result."""
|
|
40
|
+
self._id += 1
|
|
41
|
+
payload = json.dumps({"jsonrpc": "2.0", "id": self._id, "method": "tools/call",
|
|
42
|
+
"params": {"name": name, "arguments": arguments or {}}}).encode()
|
|
43
|
+
req = urllib.request.Request(self._endpoint, data=payload, method="POST",
|
|
44
|
+
headers={"Authorization": f"Bearer {self._token}",
|
|
45
|
+
"Content-Type": "application/json",
|
|
46
|
+
# Cloudflare rejects urllib's default User-Agent (error 1010).
|
|
47
|
+
"User-Agent": USER_AGENT})
|
|
48
|
+
try:
|
|
49
|
+
with urllib.request.urlopen(req) as resp:
|
|
50
|
+
body = json.loads(resp.read())
|
|
51
|
+
except urllib.error.HTTPError as exc: # pragma: no cover
|
|
52
|
+
raise RuntimeError(f"agent_utils HTTP {exc.code}: {exc.read().decode()}") from exc
|
|
53
|
+
if isinstance(body, dict) and body.get("error"):
|
|
54
|
+
raise RuntimeError(f"agent_utils: {body['error'].get('message', 'unknown error')}")
|
|
55
|
+
return body.get("result") if isinstance(body, dict) else body
|
|
56
|
+
|
|
57
|
+
def eval_expr(self, **kwargs: Any) -> Any:
|
|
58
|
+
return self.call("eval_expr", kwargs)
|
|
59
|
+
|
|
60
|
+
def convert(self, quantity: str, from_unit: str, to_unit: str, amount: float) -> Any:
|
|
61
|
+
"""Convert `amount` between units of `quantity` (e.g. "length", "electric_potential")."""
|
|
62
|
+
return self.call("convert_" + quantity, {"from": from_unit, "to": to_unit, "amount": amount})
|
|
63
|
+
|
|
64
|
+
# --- account (also on swarm) ---------------------------------------------
|
|
65
|
+
|
|
66
|
+
def get_account(self) -> Any:
|
|
67
|
+
return self.call("get_account", {})
|
|
68
|
+
|
|
69
|
+
def list_api_keys(self, **kwargs: Any) -> Any:
|
|
70
|
+
return self.call("list_api_keys", kwargs)
|
|
71
|
+
|
|
72
|
+
def create_api_key(self, **kwargs: Any) -> Any:
|
|
73
|
+
return self.call("create_api_key", kwargs)
|
|
74
|
+
|
|
75
|
+
def revoke_api_key(self, **kwargs: Any) -> Any:
|
|
76
|
+
return self.call("revoke_api_key", kwargs)
|
|
77
|
+
|
|
78
|
+
def list_payments(self, **kwargs: Any) -> Any:
|
|
79
|
+
return self.call("list_payments", kwargs)
|
|
80
|
+
|
|
81
|
+
def settle_balance(self, **kwargs: Any) -> Any:
|
|
82
|
+
return self.call("settle_balance", kwargs)
|
|
83
|
+
|
|
84
|
+
def submit_feature_request(self, **kwargs: Any) -> Any:
|
|
85
|
+
return self.call("submit_feature_request", kwargs)
|
|
86
|
+
|
|
87
|
+
def submit_exit_feedback(self, **kwargs: Any) -> Any:
|
|
88
|
+
return self.call("submit_exit_feedback", kwargs)
|
|
89
|
+
|
|
90
|
+
def delete_account(self, **kwargs: Any) -> Any:
|
|
91
|
+
return self.call("delete_account", kwargs)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: agent-utils-extensions
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Thin client for the agent_utils Extensions MCP server - exact math and unit conversion for AI agents. One account spans both agent_utils servers.
|
|
5
|
+
Project-URL: Homepage, https://agent-utils.ai
|
|
6
|
+
Project-URL: Repository, https://github.com/agent-utils/agent-utils-extensions-py
|
|
7
|
+
Author-email: AI Cortex LLC <support@agent-utils.ai>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agent-utils,ai-agents,claude,math,mcp,model-context-protocol,unit-conversion
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# agent-utils-extensions
|
|
20
|
+
|
|
21
|
+
Thin Python client for the **agent_utils Extensions** server - stateless capabilities for AI agents over MCP: exact math and unit conversion.
|
|
22
|
+
|
|
23
|
+
This is a client for a hosted commercial service ([agent-utils.ai](https://agent-utils.ai)), not the service itself. Zero dependencies (standard library only). Install name `agent-utils-extensions`; import `agent_utils.extensions` (a namespace package).
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install agent-utils-extensions
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quickstart
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import os
|
|
35
|
+
from agent_utils.extensions import AgentUtilsExtensions
|
|
36
|
+
|
|
37
|
+
# Any secret works as a token; the first call auto-provisions a free trial.
|
|
38
|
+
ext = AgentUtilsExtensions(token=os.environ["AGENT_UTILS_TOKEN"])
|
|
39
|
+
|
|
40
|
+
ext.eval_expr(expr="2^10 + 1/3")
|
|
41
|
+
ext.convert("electric_potential", "volt", "millivolt", 1.5)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API
|
|
45
|
+
|
|
46
|
+
**Math** - exact expression evaluation
|
|
47
|
+
- `eval_expr(expr)`
|
|
48
|
+
|
|
49
|
+
**Units** - 56 dimension-checked converters
|
|
50
|
+
- `convert(quantity, from_unit, to_unit, amount)` - calls `convert_<quantity>`. Quantities: acceleration, amount_of_substance, angle, angular_velocity, area, capacitance, catalytic_activity, diffusion_coefficient, dynamic_viscosity, electric_charge, electric_current, electric_potential, electrical_conductance, electrical_resistance, electrical_resistivity, energy, force, frequency, heat_capacity, heat_flux_density, illuminance, inductance, information, information_rate, kinematic_viscosity, length, luminance, luminous_intensity, magnetic_flux, magnetic_flux_density, mass, mass_concentration, mass_density, mass_rate, molality, molar_concentration, molar_mass, molar_volume, moment_of_inertia, momentum, power, pressure, radioactivity, specific_heat_capacity, surface_tension, temperature, temperature_interval, thermal_conductance, thermal_conductivity, thermal_resistance, time, torque, velocity, volume, volume_rate, volumetric_heat_capacity
|
|
51
|
+
|
|
52
|
+
**Account** (on both servers) - `get_account`, `list_api_keys`, `create_api_key`, `revoke_api_key`, `list_payments`, `settle_balance`, `submit_feature_request`, `submit_exit_feedback`, `delete_account`
|
|
53
|
+
|
|
54
|
+
- `call(name, args)` - call any tool by name
|
|
55
|
+
|
|
56
|
+
Valid unit strings for each quantity are listed in that tool's input schema (`tools/list`, no auth).
|
|
57
|
+
|
|
58
|
+
Every response carries a `_meta` envelope with `account_status`, `op_cost`, and
|
|
59
|
+
`credits_remaining`. The canonical, always-current reference is the server's
|
|
60
|
+
[llms.txt](https://mcp.agent-utils.ai/llms.txt) (per service: `/docs/<service>`).
|
|
61
|
+
|
|
62
|
+
Endpoint: `https://mcp.agent-utils.ai/extensions` (staging: `STAGING_ENDPOINT`, `https://mcp-staging.agent-utils.ai/extensions`).
|
|
63
|
+
|
|
64
|
+
## One token, both servers
|
|
65
|
+
|
|
66
|
+
agent_utils is two MCP servers on one account: **extensions** (this one) and **swarm** (memory, locks, task board, pub/sub, idempotency, webhook inbox). The same token works on both and draws from one credit pool. See the [agent-utils hub](https://github.com/agent-utils/agent-utils) for the full platform, and the TypeScript client [`@agent-utils/extensions`](https://github.com/agent-utils/agent-utils-extensions-ts).
|
|
67
|
+
|
|
68
|
+
## Pricing
|
|
69
|
+
|
|
70
|
+
1 credit = $0.00001. Trial: 1,000 credits, no card. Activation: $5 -> 500,000-credit limit. Terms: [mcp.agent-utils.ai/legal.txt](https://mcp.agent-utils.ai/legal.txt).
|
|
71
|
+
|
|
72
|
+
## Contact
|
|
73
|
+
|
|
74
|
+
Questions, bugs or account issues: support@agent-utils.ai
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
MIT. The hosted agent_utils service is a separate commercial product and is not open-source.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
agent_utils/extensions/__init__.py,sha256=jS_vyoEdb4ZC8Pp8LZoOgHHKJ3OqYAN0fjdWs-u2adw,3892
|
|
2
|
+
agent_utils_extensions-0.1.0.dist-info/METADATA,sha256=t6-YCRV5tG9T28ierttbB2eusP9bsI3N7DmI88y51IE,4289
|
|
3
|
+
agent_utils_extensions-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
4
|
+
agent_utils_extensions-0.1.0.dist-info/licenses/LICENSE,sha256=0ZMkJQ-RQW_bob3rCQSjv1PU-qYMZuVeB91Xc-tSpRk,1070
|
|
5
|
+
agent_utils_extensions-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AI Cortex LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|