foxtana 0.1.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.
- foxtana-0.1.0/.gitignore +4 -0
- foxtana-0.1.0/PKG-INFO +22 -0
- foxtana-0.1.0/README.md +8 -0
- foxtana-0.1.0/pyproject.toml +22 -0
- foxtana-0.1.0/src/foxtana/__init__.py +2 -0
- foxtana-0.1.0/src/foxtana/cli.py +63 -0
foxtana-0.1.0/.gitignore
ADDED
foxtana-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: foxtana
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Native .jos AI CLI, stdio MCP server, and Agent2Agent contract runner for JOSFOX Cloud.
|
|
5
|
+
Project-URL: Homepage, https://jos.mx
|
|
6
|
+
Project-URL: Repository, https://github.com/josfox-jos/jos
|
|
7
|
+
Project-URL: Cloud, https://josfox.cloud
|
|
8
|
+
Author: JOSFOX LLC
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
Keywords: a2a,ai-agents,foxtana,jos,josfox,mcp,model-context-protocol,prompt-caching
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Requires-Dist: jos-core<3.0.0,>=2.1.1
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# foxtana (Python / `uvx foxtana`)
|
|
16
|
+
|
|
17
|
+
Native `.jos` AI CLI, stdio Model Context Protocol (MCP) server, and Agent2Agent (`application/vnd.jos+json`) runner for [JOSFOX Cloud](https://josfox.cloud).
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uvx foxtana --version
|
|
21
|
+
uvx foxtana --mcp
|
|
22
|
+
```
|
foxtana-0.1.0/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "foxtana"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Native .jos AI CLI, stdio MCP server, and Agent2Agent contract runner for JOSFOX Cloud."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [{ name = "JOSFOX LLC" }]
|
|
13
|
+
keywords = ["foxtana", "jos", "josfox", "mcp", "model-context-protocol", "a2a", "ai-agents", "prompt-caching"]
|
|
14
|
+
dependencies = ["jos-core>=2.1.1,<3.0.0"]
|
|
15
|
+
|
|
16
|
+
[project.scripts]
|
|
17
|
+
foxtana = "foxtana.cli:main"
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
Homepage = "https://jos.mx"
|
|
21
|
+
Repository = "https://github.com/josfox-jos/jos"
|
|
22
|
+
Cloud = "https://josfox.cloud"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Native Python CLI & stdio MCP server for `uvx foxtana` (`<= 95` LOC)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
import urllib.request
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
DEFAULT_HUB = os.environ.get("FOXTANA_HUB", "https://josfox.cloud")
|
|
11
|
+
|
|
12
|
+
MCP_TOOLS = [
|
|
13
|
+
{"name": "foxtana_cloud_context", "description": "Load portable .jos context, Josts & Store crystal savings.", "inputSchema": {"type": "object", "properties": {"hub": {"type": "string"}, "handle": {"type": "string"}}}},
|
|
14
|
+
{"name": "foxtana_run_intention", "description": "Run a guarded .jos intention (local $0, hub quota, or BYOK).", "inputSchema": {"type": "object", "properties": {"hub": {"type": "string"}, "handle": {"type": "string"}, "prompt": {"type": "string"}, "mode": {"type": "string"}}, "required": ["prompt"]}},
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _req(hub: str, method: str, path: str, body: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
19
|
+
raw = json.dumps(body).encode("utf-8") if body is not None else None
|
|
20
|
+
req = urllib.request.Request(f"{hub.rstrip('/')}{path}", data=raw, method=method, headers={"Content-Type": "application/json"} if raw else {})
|
|
21
|
+
with urllib.request.urlopen(req, timeout=8) as r:
|
|
22
|
+
return json.loads(r.read().decode("utf-8"))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _serve_mcp(hub: str) -> int:
|
|
26
|
+
for line in sys.stdin:
|
|
27
|
+
if not line.strip():
|
|
28
|
+
continue
|
|
29
|
+
msg = json.loads(line)
|
|
30
|
+
mid, method, params = msg.get("id"), msg.get("method"), msg.get("params") or {}
|
|
31
|
+
if method == "initialize":
|
|
32
|
+
res: Any = {"protocolVersion": "2024-11-05", "capabilities": {"tools": {}}, "serverInfo": {"name": "foxtana-py-mcp", "version": "0.1.0"}}
|
|
33
|
+
elif method == "tools/list":
|
|
34
|
+
res = {"tools": MCP_TOOLS}
|
|
35
|
+
elif method == "tools/call":
|
|
36
|
+
args = params.get("arguments") or {}
|
|
37
|
+
thub = args.get("hub") or hub
|
|
38
|
+
if params.get("name") == "foxtana_cloud_context":
|
|
39
|
+
data = _req(thub, "GET", f"/v1/cloud/ide/context?handle={args.get('handle', 'jos')}")
|
|
40
|
+
else:
|
|
41
|
+
data = _req(thub, "POST", "/v1/cloud/foxtana/run", {"handle": args.get("handle", "jos"), "prompt": args.get("prompt", ""), "mode": args.get("mode", "local")})
|
|
42
|
+
res = {"content": [{"type": "text", "text": json.dumps(data)}]}
|
|
43
|
+
else:
|
|
44
|
+
res = {}
|
|
45
|
+
if mid is not None:
|
|
46
|
+
sys.stdout.write(json.dumps({"jsonrpc": "2.0", "id": mid, "result": res}) + "\n")
|
|
47
|
+
sys.stdout.flush()
|
|
48
|
+
return 0
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def main(argv: list[str] | None = None) -> int:
|
|
52
|
+
args = list(sys.argv[1:] if argv is None else argv)
|
|
53
|
+
if "--mcp" in args:
|
|
54
|
+
return _serve_mcp(DEFAULT_HUB)
|
|
55
|
+
if "--version" in args or (args and args[0] == "version"):
|
|
56
|
+
print(json.dumps({"package": "foxtana", "runtime": "python", "version": "0.1.0", "default_hub": DEFAULT_HUB}))
|
|
57
|
+
return 0
|
|
58
|
+
print("foxtana 0.1.0 (Python / uvx) — Usage: uvx foxtana [--version | --mcp]")
|
|
59
|
+
return 0
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if __name__ == "__main__":
|
|
63
|
+
raise SystemExit(main())
|