Skip to content

Commit 39c6b0c

Browse files
authored
0.3.5 jacsnpm and observability (#25)
* cleaner example git push * npm scaffold * rough * wrapped * progress * npm untested * add default replay attack time out * use refactored libs in npm * use refactored libs in npm * fmt * hybrid python and rust module * testing inclunding mcp in the jacs python * cleanup * cleanup * fix test * lint * ratatui * try for cli install * change * cargo * makefile * migrate more to reusable cli * finishing refactor * fix refactor * integrate cli with jacspy * npm * packaging node * starting to add mcp * mcp client and server * use proper functions for request response * npm builds * broken again * load agent error * example setups * new error * nope * better request response example * better request response example * update language * pass npm test * fixed bug * change example * more npm examples * setting up http client server * koa and express middleware * express and koa middleware * readme * mcp refactoring * not working npm mpc, starting over * switch to typescript * mcp ts * server responds * s * debug * debug * stuck * mcp * mcp * mcp * mcp * transport only * transport only * ok * server client not working yet * server client not working yet * mcp working * explain a bit more * stdio IO in node * changelog * observability module * tests almost passing * tests pass * test * refactor * consider wasm * refactor, simplification * fixed * more accurate test output * starting using tracing * update documentatino * tracing * get rid of printlns * changelog * push reqs
1 parent 5087221 commit 39c6b0c

File tree

212 files changed

+26641
-2764
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+26641
-2764
lines changed

.github/workflows/python.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ jobs:
4747
cd /workspace/jacspy && \
4848
/opt/python/cp311-cp311/bin/python3.11 -m venv .venv && \
4949
source .venv/bin/activate && \
50-
pip install pytest && \
50+
pip install maturin pytest && \
51+
pip install fastmcp mcp starlette && \
5152
make test-python"
5253
5354
# Job to build wheels, runs ONLY on push to main

AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Welcome.
2+
3+
You may use the top level Cargo.toml to understand the repo.
4+
jacs/ is the directory with the core library.
5+
./jacspy is the python wrapper with functionality for integrations
6+
./jacsnpm is the npm/node wrapper with functionality for integrations
7+
8+
Look for examples in tests for how to use the library.
9+
README.md and CHANGELOG.md may be useful to understand some future goals and what has been done.
10+

CHANGELOG.md

Lines changed: 64 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# PLANNED
22
- machine fingerprinting v2
3+
- passkey-client integration
34
- encrypt files at rest
45
- refine schema usage
56
- more getters and setters for documents recognized by schemas
@@ -8,6 +9,8 @@
89
- use rcgen to sign certs, and register with ACME
910
https://opentelemetry.io/docs/languages/rust/
1011
. ai.pydantic.dev
12+
- secure storage of private key for shared server envs https://crates.io/crates/tss-esapi, https://docs.rs/cryptoki/latest/cryptoki/
13+
1114

1215
## 0.4.0
1316
- Domain integration
@@ -18,6 +21,7 @@
1821
- pass document string or document id - with optional version instead of string
1922
- load document whatever storage config is
2023
- function test output metadata about current config and current agent
24+
2125
## jacs-mcp 0.1.0
2226

2327
- [] use rmcp
@@ -26,47 +30,79 @@
2630
- [] https://github.com/modelcontextprotocol/specification/discussions
2731

2832

29-
3033
--------------------
3134

32-
## 0.3.5
35+
## 0.3.6
3336

34-
### Register agent
37+
### jacsnpm
3538

36-
- [] register agent
37-
- [] remove requirement to store public key type
39+
- [] BUG with STDIO in general
40+
fix issues with Stdio mcp client and server log noise - relates to open telemetry being used at rust layer.
41+
- [] github actions builder for linux varieties
42+
- [] npm install jacs (cli and available to plugin)
43+
- [] a2a integration
44+
- [] integrate cli
45+
46+
### jacspy
47+
- [] publish jacspy to pypi
48+
- [] mcp make sure "list" request is signed?
49+
- [] some integration tests
50+
- [] fastapi, django, flask, guvicorn specific pre-built middleware
51+
- [] auto generate agent doc from MCP server list, auto versions (important for A2A as well)
52+
- [] fastmcp client and server websocket
53+
- [] BUG? demo fastmcp client and server stdio
54+
- [] a2a integration
55+
- [] have jacs cli installed along with wheel
56+
- [] python based instructions for how to create - cli create agent
57+
1. cli create agent
58+
2. config jacspy to load each agent
59+
- [] github actions builder for linux varieties
3860

61+
### JACS core
62+
- [] ensure if a user wants standard logging they can use that
63+
- [] cli install instructions. a .sh command?
64+
- [] expose logging function to jacspy and jacsnpm
65+
- [] create centralized logging output without file output
66+
- [] CA for cert
67+
- [] register public key in d option
68+
- [] register agent
69+
- [] remove requirement to store public key type
3970
- [] upgrade pqcrypto https://github.com/rustpq/pqcrypto/issues/79
40-
- [] RBAC integration with header
4171
- [] diff versions
4272
- [] bucket integration
43-
- [] don't store "jacs_private_key_password": in config, don't display
44-
- [] register public key
45-
- [] CA for cert
46-
- [] add timestamp to prevent timing attacks to request/response features
47-
- [] no_save = false should save document and still return json string instead of message on create document
48-
-
73+
- [] RBAC integration with header
74+
- [] clean io prepping for config of io
75+
- [] don't store "jacs_private_key_password": in config, don't display
76+
- [] minor feature - no_save = false should save document and still return json string instead of message on create document
4977

50-
## jacspy
51-
- [] install jacs cli with the python wheel
52-
- [] python based instructions for how to create - cli create agent
53-
1. cli create agent
54-
2. config jacspy to load each agent
78+
--------------------
5579

56-
- [] auto generate agent doc from MCP server list, auto versions
57-
- [] traceable, verifiable request logs
58-
- [] fastmcp client and server stdio
59-
- [] fastmcp client and server websocket
60-
- [] publish jacspy to pypi
61-
- [] github actions builder for linux
62-
- [] mcp make decorator for @resource
63-
- [] mcp make sure "list" request is signed
80+
## 0.3.5
81+
82+
- [x] Update documentation.
83+
84+
### JACS core
85+
86+
- [x] add timestamp to prevent replay attacks to request/response features
87+
- [x] make cli utils available to other libs
88+
- [x] *** start effort to channel all logging to jacs -> open telemetry -> fs or elsewhere that doesn't write to stdio on
89+
1. the main traffic for sign and verify
90+
2. all logs generated
91+
92+
### jacspy
93+
94+
- [x] install python mcp libs with the python wheel, use python loader to extend/export jacs.so
6495

6596
## jacsnpm
97+
6698
proof of concept
6799

68-
- [] typescript mcp client and server
69-
- [] npm install jacs (cli and available to plugin)
100+
- [x] scaffold
101+
- [x] use refactored agent trait instead of replicating
102+
- [x] typescript mcp client and server tests
103+
- [x] test sse mcp client and server
104+
- [x] node express middleware
105+
70106

71107
--------------------
72108

@@ -86,7 +122,7 @@ proof of concept
86122

87123
- [x] make decorator for easy use in @tools
88124
- [x] new local builder
89-
- [] fastmcp client and server sse
125+
- [x] fastmcp client and server sse
90126
- [x] jacspy test - sign(content) -> (signature, agentid, agentversion, documentid, documentversion)
91127
- [x] jacspy test - verify(content, signature, agentid, agentversion) -> bool, error
92128

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
[workspace]
22
members = [
3-
"jacs",
3+
"jacs",
4+
"jacsnpm",
45
# "mcp-server",
56
"jacspy"
67
]
78
resolver = "3"
89
rust-version = "1.85"
9-
10+
1011

1112
readme = "README.md"
1213
authors = ["HAI.AI <engineering@hai.io>"]

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33

44
build-jacs:
5-
cd jacs && cargo install --path . --force
5+
cd jacs && cargo install --path . --force --features cli
66
~/.cargo/bin/jacs --help
77
~/.cargo/bin/jacs version
88

99
test-jacs:
10-
cd jacs && RUST_BACKTRACE=1 cargo test -- --nocapture
10+
cd jacs && RUST_BACKTRACE=1 cargo test --features cli -- --nocapture
1111

1212
test-jacs-cli:
13-
cd jacs && RUST_BACKTRACE=1 cargo test --test cli_tests -- --nocapture
13+
cd jacs && RUST_BACKTRACE=1 cargo test --features cli --test cli_tests -- --nocapture
1414

1515

1616

1717
publish-jacs:
18-
cargo publish --dry-run -p jacs
18+
cargo publish --features cli --dry-run -p jacs
1919

2020

2121
test: test-jacs test-jacspy

README.md

Lines changed: 64 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,74 @@
11
# JACS
22

3-
Welcome to JACS (JSON Agent Communication Standard). JACS library provides
3+
Welcome to JACS (JSON Agent Communication Standard).
44

5-
1. a way to identify, trust and verify AI agents
6-
2. authorize Agents
7-
3. create, update, and verify documents
5+
JACS is used by agents to validate the source and identity of data. The data may be ephemeral, changing, or idempotent such as files, identities, logs, http requests.
86

9-
This repo and general usage consists of
7+
Example uses:
8+
9+
1. A document is sitting on a server. Where did it come from? Who has access to it?
10+
2. An MCP server gets a request from an unknown agent, the oauth flow doesn't guarantee the identity of the client or the server after the initial handshake.
11+
3. a document is modified by multiple human and AI collaborators. Which one is latest, correct version?
12+
13+
This repo includes JACS available in several languages:
1014

11-
1. a cli tool to bootstrap an agent or documents
12-
2. Rust Library for general integrations
13-
3. Rust MCP server for LLM usage
14-
4. Python MCP server and client integrations for AUTH
15-
5. MORE PLANNED
15+
1. the main [rust jacs lib](./jacs/) and cli to bootstrap an agent or documents
16+
2. [Python library](./jacspy/) for use as middleware in any http and with MCP
17+
3. [Node JS library](./jacsnpm) cli, middleware, and use with MCP
18+
19+
## Python quickstart
20+
21+
Install with `pip install jacs` with example using [fastmcp](https://github.com/jlowin/fastmcp)
22+
23+
```python
24+
# server
25+
import jacs
26+
from jacs.mcp import JACSMCPServer, JACSMCPClient
27+
from mcp.server.fastmcp import FastMCP
28+
29+
# client
30+
# client = JACSMCPClient(server_url)
31+
32+
# setup
33+
jacs_config_path = "jacs.server.config.json"
34+
# set the secret
35+
# os.environ["JACS_PRIVATE_KEY_PASSWORD"] = "hello"
36+
jacs.load(str(jacs_config_path))
37+
38+
mcp = JACSMCPServer(FastMCP("Authenticated Echo Server"))
39+
40+
@mcp.tool()
41+
def add(a: int, b: int) -> int:
42+
"""Add two numbers"""
43+
return a + b
44+
45+
if __name__ == "__main__":
46+
mcp.run()
47+
48+
```
49+
50+
## Node JS
51+
52+
```js
53+
54+
55+
56+
```
57+
58+
59+
## Rust
60+
61+
The core library is used in all other implementations.
62+
63+
`cargo install jacs` is useful for it's cli, but to develop `cargo add jacs` is all that's needed.
64+
65+
1666

67+
## License
1768

18-
For more details see [jacs/README.md](jacs/README.md)
19-
Please note that the [license][./LICENSE] isa *modified* Apache 2.0, with the [Common Clause](https://commonsclause.com/) preamble. In simple terms, unless you are competing with HAI.AI, you can create commercial products with JACS.
69+
The [license][./LICENSE] is a *modified* Apache 2.0, with the [Common Clause](https://commonsclause.com/) preamble.
70+
In simple terms, unless you are directly competing with HAI.AI, you can create commercial products with JACS.
71+
This licensing doesn't work, please reach out to hello@hai.io.
2072

2173
------
2274
2024, 2025 https://hai.ai

jacs/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ debug/
44
target/
55
.idea
66

7+
8+
79
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
810
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
911
Cargo.lock
@@ -17,4 +19,5 @@ Cargo.lock
1719
jacs.config.json
1820
.DS_Store
1921
tests/fixtures/documents/*
20-
tests/scratch/*
22+
tests/scratch/*
23+
opentelemetry-rust

jacs/Cargo.toml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "jacs"
3-
version = "0.3.4"
3+
version = "0.3.5"
44
edition = "2024"
55
rust-version = "1.85"
66
resolver = "3"
@@ -63,7 +63,6 @@ strum = "0.27.1"
6363
strum_macros = "0.27.0"
6464
secrecy = "0.10.3"
6565
aes-gcm = "0.10.3"
66-
clap = { version = "4.5.4", features = ["derive", "cargo"] }
6766
regex = "1.11.1"
6867
mime_guess = "2.0.5"
6968
flate2 = "1.1.1"
@@ -74,10 +73,26 @@ validator = "0.20.0"
7473
uuid = { version = "1.16.0", features = ["v4", "v7", "js"] }
7574
env_logger = "0.11.8"
7675
futures-util = "0.3.31"
77-
referencing = "0.29.1"
76+
referencing = "0.30.0"
7877
futures-executor = "0.3.31"
7978
update = "0.0.0"
8079
getset = "0.1.5"
80+
clap = { version = "4.5.4", features = ["derive", "cargo"], optional = true }
81+
ratatui = { version = "0.29.0", optional = true }
82+
83+
84+
tracing = "0.1"
85+
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
86+
tracing-appender = "0.2"
87+
tracing-opentelemetry = "0.30.0"
88+
opentelemetry = { version = "0.30.0", features = [] }
89+
opentelemetry-otlp = { version = "0.30.0", features = ["http-proto", "reqwest-client"] }
90+
opentelemetry_sdk = { version = "0.30.0", features = ["rt-tokio"] }
91+
metrics = "0.24.2"
92+
metrics-exporter-prometheus = "0.17"
93+
94+
# opentelemetry-prometheus = "0.29.1"
95+
8196

8297
# libp2p = "0.55.0"
8398
# [target.'cfg(target_os = "macos")'.dependencies]
@@ -89,12 +104,12 @@ getset = "0.1.5"
89104

90105
[dev-dependencies]
91106
color-eyre = "0.6"
92-
criterion = "0.5.1"
107+
criterion = "0.6.0"
93108
mdbook = "0.4.48"
94109
assert_cmd = "2.0"
95110
predicates = "3.1"
96111
tempfile = "3.19.1"
97-
serial_test = "0.6.0"
112+
serial_test = "3.2.0"
98113
futures = "0.3"
99114

100115
[lib]
@@ -109,17 +124,22 @@ reqwest = { version ="0.12.12", features = ["blocking", "json"] }
109124
walkdir = "2.5.0"
110125
object_store = { version ="0.12.0", features = ["serde","serde_json", "aws", "http"] }
111126

112-
[target.'cfg(target_arch = "wasm32")'.dependencies]
113-
wasm-bindgen = "0.2.100"
114-
web-sys = { version = "0.3", features = ["Storage", "Window"] }
127+
[target.'cfg(target_arch = "wasm32")'.dependencies]
128+
wasm-bindgen = "0.2.100"
129+
web-sys = { version = "0.3", features = ["Storage", "Window"] }
115130

116131
[[bin]]
117132
name = "jacs"
118133
path = "src/bin/cli.rs"
134+
required-features = ["cli"]
135+
136+
[features]
137+
cli = ["dep:clap", "dep:ratatui"]
119138

120139
[[bench]]
121140
name = "sign_and_check_sig"
122141
harness = false
123142

124143
[package.metadata.cargo-install]
125144
bin = ["jacs"]
145+

0 commit comments

Comments
 (0)