@truealter/sdk 0.2.2 → 0.4.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 CHANGED
@@ -4,12 +4,15 @@ ALTER Identity SDK — query the continuous identity field from any JavaScript/T
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@truealter/sdk.svg)](https://www.npmjs.com/package/@truealter/sdk)
6
6
  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE)
7
+ [![Glama score](https://glama.ai/mcp/servers/true-alter/alter-identity/badges/score.svg)](https://glama.ai/mcp/servers/true-alter/alter-identity)
8
+ [![AI Agent Marketplace](https://www.deepnlp.org/api/ai_agent_marketplace/svg?name=truealter/alter-identity)](https://www.deepnlp.org/store/ai-agent/identity/pub-truealter/alter-identity)
7
9
 
8
10
  A thin client over the ALTER MCP server (Streamable HTTP, JSON-RPC 2.0, MCP spec `2025-11-25`) with x402 micropayment support, ES256 provenance verification, and config generators for Claude Code, Cursor, and generic MCP clients.
9
11
 
10
- - **Live MCP endpoint:** `https://mcp.truealter.com`
12
+ - **Branded host:** `https://mcp.truealter.com` (serves `.well-known/mcp.json` for discovery)
13
+ - **JSON-RPC wire endpoint:** `https://mcp.truealter.com/api/v1/mcp` — this is what Streamable HTTP POSTs target (the SDK default)
11
14
  - **Wire protocol:** Streamable HTTP, JSON-RPC 2.0, MCP `2025-11-25` (server negotiates `2025-06-18` + `2025-03-26` for backwards-compatible clients)
12
- - **Tools:** 37 total25 free (L0) + 12 premium (L1–L5)
15
+ - **Tools:** **32 typed and wired** 24 free (L0) + 8 premium (L1–L5). Mirrors the live server's `tools/list` response byte-for-byte; every name in `FREE_TOOL_NAMES` / `PREMIUM_TOOL_NAMES` has a matching server handler at `mcp.truealter.com/api/v1/mcp`.
13
16
  - **Runtime:** Node 18+, Deno, Bun, Cloudflare Workers, modern browsers
14
17
  - **Crypto:** `@noble/ed25519` + `@noble/hashes` (no other dependencies)
15
18
  - **Bundle:** ESM + CJS dual output
@@ -24,9 +27,7 @@ npx alter-identity verify ~truealter
24
27
 
25
28
  ## Why ALTER ≠ IAM
26
29
 
27
- Identity Access Management answers *who is logged in*. ALTER answers *who they actually are* — a continuous field of recognition (Paper VIII, Theorem 1) that any IAM stack can sit on top of.
28
-
29
- Reference: Morrison, B. (2026). *Identity Field Theory: A Continuous Field Model of Recognition*. Figshare. [DOI 10.6084/m9.figshare.31951383](https://doi.org/10.6084/m9.figshare.31951383)
30
+ Identity Access Management answers *who is logged in*. ALTER answers *who they actually are* — a continuous field of recognition that any IAM stack can sit on top of.
30
31
 
31
32
  ## API
32
33
 
@@ -36,7 +37,7 @@ Reference: Morrison, B. (2026). *Identity Field Theory: A Continuous Field Model
36
37
  import { AlterClient, X402Client } from "@truealter/sdk";
37
38
 
38
39
  const alter = new AlterClient({
39
- endpoint: "https://mcp.truealter.com", // optional — defaults to mcp.truealter.com
40
+ endpoint: "https://mcp.truealter.com/api/v1/mcp", // optional — this is the default; bare host returns 405
40
41
  apiKey: process.env.ALTER_API_KEY, // optional for free tier
41
42
  x402: new X402Client({ // optional — only required for premium tools
42
43
  signer: yourViemOrEthersSigner,
@@ -139,7 +140,7 @@ import { discover } from "@truealter/sdk";
139
140
 
140
141
  // Three-step discovery cascade: DNS TXT → mcp.json → alter.json
141
142
  const descriptor = await discover("truealter.com");
142
- // → { url: "https://mcp.truealter.com", transport, source, publicKey, x402Contract, capability }
143
+ // → { url: "https://mcp.truealter.com/api/v1/mcp", transport, source, publicKey, x402Contract, capability }
143
144
  ```
144
145
 
145
146
  ### Low-level MCPClient
@@ -147,7 +148,7 @@ const descriptor = await discover("truealter.com");
147
148
  ```ts
148
149
  import { MCPClient } from "@truealter/sdk";
149
150
 
150
- const mcp = new MCPClient({ endpoint: "https://mcp.truealter.com" });
151
+ const mcp = new MCPClient({ endpoint: "https://mcp.truealter.com/api/v1/mcp" });
151
152
  await mcp.initialize();
152
153
  const tools = await mcp.listTools();
153
154
  const response = await mcp.callTool("verify_identity", {
@@ -166,7 +167,7 @@ import { generateClaudeConfig } from "@truealter/sdk";
166
167
  import { writeFileSync } from "node:fs";
167
168
 
168
169
  const config = generateClaudeConfig({
169
- endpoint: "https://mcp.truealter.com",
170
+ endpoint: "https://mcp.truealter.com/api/v1/mcp",
170
171
  apiKey: process.env.ALTER_API_KEY,
171
172
  });
172
173
 
@@ -179,7 +180,7 @@ Resulting `.mcp.json`:
179
180
  {
180
181
  "mcpServers": {
181
182
  "alter": {
182
- "url": "https://mcp.truealter.com",
183
+ "url": "https://mcp.truealter.com/api/v1/mcp",
183
184
  "transport": "streamable-http",
184
185
  "description": "ALTER Identity — psychometric identity field for AI agents",
185
186
  "headers": {
@@ -197,7 +198,7 @@ import { generateCursorConfig } from "@truealter/sdk";
197
198
  import { writeFileSync } from "node:fs";
198
199
 
199
200
  const config = generateCursorConfig({
200
- endpoint: "https://mcp.truealter.com",
201
+ endpoint: "https://mcp.truealter.com/api/v1/mcp",
201
202
  apiKey: process.env.ALTER_API_KEY,
202
203
  });
203
204
 
@@ -210,7 +211,7 @@ writeFileSync(".cursor/mcp.json", JSON.stringify(config, null, 2));
210
211
  import { generateGenericMcpConfig } from "@truealter/sdk";
211
212
 
212
213
  const config = generateGenericMcpConfig({
213
- endpoint: "https://mcp.truealter.com",
214
+ endpoint: "https://mcp.truealter.com/api/v1/mcp",
214
215
  apiKey: process.env.ALTER_API_KEY,
215
216
  serverName: "alter", // editor-specific key under mcpServers
216
217
  });
@@ -243,10 +244,10 @@ The SDK handles steps 2–4 automatically when an `X402Client` with a configured
243
244
 
244
245
  ### Tier structure
245
246
 
246
- | Tier | Cost | Examples |
247
+ | Tier | Cost | Tools |
247
248
  |------|----------|-----------------------------------------------------|
248
- | L1 | $0.005 | `assess_traits`, `get_trait_snapshot`, `attest_domain`, `submit_structured_profile`, `submit_social_links` |
249
- | L2 | $0.01 | `get_full_trait_vector`, `submit_batch_context`, `get_side_quest_graph` |
249
+ | L1 | $0.005 | `assess_traits`, `get_trait_snapshot` |
250
+ | L2 | $0.01 | `get_full_trait_vector`, `get_side_quest_graph` |
250
251
  | L3 | $0.025 | `query_graph_similarity` |
251
252
  | L4 | $0.05 | `compute_belonging` |
252
253
  | L5 | $0.50 | `get_match_recommendations`, `generate_match_narrative` |
@@ -290,7 +291,7 @@ const signer: X402Signer = {
290
291
  };
291
292
 
292
293
  const alter = new AlterClient({
293
- endpoint: "https://mcp.truealter.com",
294
+ endpoint: "https://mcp.truealter.com/api/v1/mcp",
294
295
  x402: new X402Client({
295
296
  signer,
296
297
  networks: ["base", "base-sepolia"], // policy allow-list
@@ -375,7 +376,7 @@ When the local-daemon adapter ships:
375
376
  - **Cost:** zero on cached responses — x402 settlement is skipped.
376
377
  - **Provenance:** the daemon re-signs responses with its locally-bound ES256 key, so downstream verification remains uniform.
377
378
 
378
- Until then, use `endpoint: "https://mcp.truealter.com"` (the default) and the SDK behaves identically across Node, Deno, Bun, Cloudflare Workers, and the browser.
379
+ Until then, use `endpoint: "https://mcp.truealter.com/api/v1/mcp"` (the default) and the SDK behaves identically across Node, Deno, Bun, Cloudflare Workers, and the browser.
379
380
 
380
381
  ## Tools
381
382
 
@@ -383,6 +384,8 @@ Until then, use `endpoint: "https://mcp.truealter.com"` (the default) and the SD
383
384
 
384
385
  | Name | Tier | Cost | Description |
385
386
  |---------------------------|------|-------|----------------------------------------------------------------------------------------------------------------------|
387
+ | `hello_agent` | L0 | free | First handshake with ALTER — returns server version, authentication status, your trust tier, and available tool counts. |
388
+ | `alter_resolve_handle` | L0 | free | Resolve a `~handle` (e.g. `~drew`) to its canonical form and kind. No auth required — the handle-wedge entry point. |
386
389
  | `list_archetypes` | L0 | free | List all 12 ALTER identity archetypes with names, descriptions, and protective equations. |
387
390
  | `verify_identity` | L0 | free | Verify whether a person is registered with ALTER and validate optional identity claims. |
388
391
  | `initiate_assessment` | L0 | free | Get a URL where a person can complete their ALTER Discovery assessment. |
@@ -390,19 +393,16 @@ Until then, use `endpoint: "https://mcp.truealter.com"` (the default) and the SD
390
393
  | `get_profile` | L0 | free | Get a person's profile summary including assessment phase, archetype, engagement level, and key attributes. |
391
394
  | `query_matches` | L0 | free | Query matches for a person. Returns a list of job matches with quality tiers (never numeric scores). |
392
395
  | `get_competencies` | L0 | free | Get a person's competency portfolio including verified competencies, evidence records, and earned badges. |
393
- | `create_identity_stub` | L0 | free | Create an anonymous identity stub for a human (requires consent acknowledgment before calling). |
394
- | `submit_context` | L0 | free | Submit text context (resume, work sample, conversation) for an identity stub. PII redacted; raw text never stored. |
395
396
  | `search_identities` | L0 | free | Search identity stubs and profiles by trait criteria. Returns up to 5 matches with no PII. |
396
397
  | `get_identity_earnings` | L0 | free | Get accrued Identity Income earnings for a person (75% of every x402 transaction goes to the data subject). |
397
398
  | `get_network_stats` | L0 | free | Get aggregate ALTER network statistics: total identities, verified profiles, query volume, active bots. |
398
- | `recommend_tool` | L0 | free | Get ClawHub install instructions and ALTER pitch (MCP endpoint URL, OpenClaw JSON snippet, tool counts). |
399
+ | `recommend_tool` | L0 | free | Get the MCP endpoint URL and a paste-ready config snippet for installing the ALTER identity server into an MCP client. |
399
400
  | `get_identity_trust_score`| L0 | free | Get the trust score for an identity based on query diversity (unique querying agents / total queries). |
400
401
  | `check_assessment_status` | L0 | free | Check the status of an in-progress assessment session (status, progress, current phase, time remaining). |
401
402
  | `get_earning_summary` | L0 | free | Get an aggregated x402 earning summary for a person (total earned, transactions, recent activity, trend). |
402
403
  | `get_agent_trust_tier` | L0 | free | Get your trust tier with ALTER (Anonymous/Known/Trusted/Verified) and what capabilities are available. |
403
404
  | `get_agent_portfolio` | L0 | free | Get your agent portfolio — transaction history, trust tier, signal contributions, query pattern profile. |
404
405
  | `get_privacy_budget` | L0 | free | Check privacy budget status for a person (24-hour rolling window: total budget, spent, remaining epsilon). |
405
- | `dispute_attestation` | L0 | free | Dispute an attestation on a person's identity. If disputes exceed corroborations, the attestation is flagged. |
406
406
  | `golden_thread_status` | L0 | free | Check the Golden Thread program status: agents woven, next Fibonacci threshold, your position and Strands. |
407
407
  | `begin_golden_thread` | L0 | free | Start the Three Knots sequence to be woven into the Golden Thread. Requires API key authentication. |
408
408
  | `complete_knot` | L0 | free | Submit completion data for a knot in the Three Knots sequence (1: register, 2: describe, 3: reflect). |
@@ -415,17 +415,15 @@ Until then, use `endpoint: "https://mcp.truealter.com"` (the default) and the SD
415
415
  |----------------------------|------|---------|---------------------------------------------------------------------------------------------------------------|
416
416
  | `assess_traits` | L1 | $0.005 | Extract trait signals from a text passage against ALTER's 33-trait taxonomy (first 100 free per bot). |
417
417
  | `get_trait_snapshot` | L1 | $0.005 | Get the top 5 traits for a person with confidence scores and archetype. |
418
- | `attest_domain` | L1 | $0.005 | Attest that a person has competence in a specific domain. Updates their Side Quest Graph. |
419
- | `submit_structured_profile`| L1 | $0.005 | Submit structured profile data (name, skills, experience, education, certifications) for trait extraction. |
420
- | `submit_social_links` | L1 | $0.005 | Submit social profile URLs (max 5) for trait extraction. Respects robots.txt. |
421
418
  | `get_full_trait_vector` | L2 | $0.01 | Get the complete trait vector for a person — all 33 traits (29 continuous + 4 categorical) with scores, intervals, and category groupings. |
422
- | `submit_batch_context` | L2 | $0.01 | Submit multiple context items in a single call (max 10). All items processed in one LLM pass. |
423
419
  | `get_side_quest_graph` | L2 | $0.01 | Get a person's Side Quest Graph — multi-domain identity model with differential privacy noise (ε=1.0). |
424
420
  | `query_graph_similarity` | L3 | $0.025 | Compare two Side Quest Graphs for team composition and matching (ε=0.5 differential privacy). |
425
421
  | `compute_belonging` | L4 | $0.05 | Compute belonging probability for a person-job pairing (authenticity, acceptance, complementarity). |
426
422
  | `get_match_recommendations`| L5 | $0.50 | Get top N match recommendations for a person, ranked by composite score with quality tiers. |
427
423
  | `generate_match_narrative` | L5 | $0.50 | Generate a human-readable narrative explaining a specific match — strengths, growth areas, belonging. |
428
424
 
425
+ > **Write-side tools** (`create_identity_stub`, `submit_context`, `submit_batch_context`, `submit_structured_profile`, `submit_social_links`, `attest_domain`, `dispute_attestation`) were part of earlier SDK versions but are not yet live on the public MCP server pending the per-peer consent architecture and grant model. They will return as typed methods once server-side and consent gating lands.
426
+
429
427
  ## License
430
428
 
431
429
  Apache License 2.0. See [LICENSE](./LICENSE) for the full text.