mcpaas 0.1.0 → 1.0.0
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/LICENSE +1 -1
- package/README.md +70 -82
- package/dist/index.d.ts +191 -0
- package/dist/index.js +83 -209
- package/package.json +17 -46
- package/project.faf +0 -116
- package/src/index.ts +0 -19
- package/src/radio.ts +0 -356
- package/src/types.ts +0 -136
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,127 +1,115 @@
|
|
|
1
1
|
# mcpaas
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK for [MCPaaS](https://mcpaas.live) — Context, on-demand.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
That's the drift tax. [$49M/day](https://fafdev.tools/value) burned industry-wide.
|
|
8
|
-
|
|
9
|
-
This SDK connects you to [MCPaaS](https://mcpaas.live) — persistent AI context that follows you across tools, sessions, and teams.
|
|
5
|
+
Zero dependencies. Works with Bun, Node 18+, Deno, browsers, and edge runtimes.
|
|
10
6
|
|
|
11
7
|
## Install
|
|
12
8
|
|
|
13
9
|
```bash
|
|
14
10
|
npm install mcpaas
|
|
11
|
+
# or
|
|
12
|
+
bun add mcpaas
|
|
15
13
|
```
|
|
16
14
|
|
|
17
15
|
## Quick Start
|
|
18
16
|
|
|
19
17
|
```typescript
|
|
20
|
-
import {
|
|
18
|
+
import { MCPaaS } from 'mcpaas';
|
|
21
19
|
|
|
22
|
-
const
|
|
23
|
-
await radio.connect();
|
|
20
|
+
const m = new MCPaaS();
|
|
24
21
|
|
|
25
|
-
//
|
|
26
|
-
await
|
|
22
|
+
// Read a soul
|
|
23
|
+
const soul = await m.getRawSoul('spacex');
|
|
24
|
+
console.log(soul);
|
|
27
25
|
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
```
|
|
26
|
+
// Score a namepoint
|
|
27
|
+
const result = await m.score('faf');
|
|
28
|
+
console.log(result.score, result.tierReady);
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
// Check handle availability
|
|
31
|
+
const check = await m.check('myhandle');
|
|
32
|
+
console.log(check.available);
|
|
33
|
+
```
|
|
35
34
|
|
|
36
|
-
##
|
|
35
|
+
## API
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
### Souls
|
|
39
38
|
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
You → Gemini (send 50KB again)
|
|
45
|
-
= 3x cost, 3x latency, context drift
|
|
46
|
-
|
|
47
|
-
Radio Protocol (the fix):
|
|
48
|
-
You → Broadcast to 91.0 FM (send once)
|
|
49
|
-
Claude ← tuned to 91.0
|
|
50
|
-
Grok ← tuned to 91.0
|
|
51
|
-
Gemini ← tuned to 91.0
|
|
52
|
-
= 1x cost, instant, zero drift
|
|
39
|
+
```typescript
|
|
40
|
+
m.getSoul('faf') // Structured soul content
|
|
41
|
+
m.getRawSoul('spacex') // Plain text soul
|
|
42
|
+
m.listSouls() // Stats: counts, top souls, operations
|
|
53
43
|
```
|
|
54
44
|
|
|
55
|
-
|
|
45
|
+
### Scoring
|
|
56
46
|
|
|
57
47
|
```typescript
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const gemini = new Radio('wss://mcpaas.live/beacon/radio');
|
|
48
|
+
m.score('faf') // Score a namepoint
|
|
49
|
+
m.scoreRepo('owner/repo') // Score a GitHub repo
|
|
50
|
+
m.leaderboard() // Top scored repos
|
|
51
|
+
```
|
|
63
52
|
|
|
64
|
-
|
|
65
|
-
await Promise.all([claude.tune('91.0'), grok.tune('91.0'), gemini.tune('91.0')]);
|
|
53
|
+
### Directory & Discovery
|
|
66
54
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
55
|
+
```typescript
|
|
56
|
+
m.directory() // Full namepoint directory
|
|
57
|
+
m.check('handle') // Handle availability + pricing
|
|
58
|
+
m.count() // Claimed/remaining counts
|
|
59
|
+
m.discover() // Discovery feed (namepoints + souls)
|
|
71
60
|
```
|
|
72
61
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
### Constructor
|
|
62
|
+
### Tag Intel
|
|
76
63
|
|
|
77
64
|
```typescript
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
maxReconnectAttempts?: number; // Max attempts (default: 5)
|
|
81
|
-
reconnectDelay?: number; // Delay in ms (default: 1000)
|
|
82
|
-
heartbeatInterval?: number; // Ping interval (default: 30000)
|
|
83
|
-
debug?: boolean; // Debug logging (default: false)
|
|
84
|
-
});
|
|
65
|
+
m.tagIntel() // Tag patterns, co-occurrence, candidates, merges
|
|
66
|
+
m.suggestTags('handle') // Suggest tags for a namepoint
|
|
85
67
|
```
|
|
86
68
|
|
|
87
|
-
###
|
|
69
|
+
### Badges
|
|
88
70
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
| `untune(frequency)` | Unsubscribe from a frequency |
|
|
94
|
-
| `disconnect()` | Disconnect |
|
|
95
|
-
| `getState()` | `'DISCONNECTED'` \| `'CONNECTING'` \| `'CONNECTED'` \| `'RECONNECTING'` \| `'CLOSED'` |
|
|
96
|
-
| `getTunedFrequencies()` | Set of tuned frequencies |
|
|
71
|
+
```typescript
|
|
72
|
+
m.badge('owner', 'repo') // Returns SVG badge URL (sync)
|
|
73
|
+
// => https://mcpaas.live/badge/owner/repo.svg
|
|
74
|
+
```
|
|
97
75
|
|
|
98
|
-
###
|
|
76
|
+
### Globe
|
|
99
77
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
| `onConnect(fn)` | `() => void` |
|
|
104
|
-
| `onDisconnect(fn)` | `(code?, reason?) => void` |
|
|
105
|
-
| `onError(fn)` | `(error) => void` |
|
|
106
|
-
| `onTuned(fn)` | `(frequency) => void` |
|
|
107
|
-
| `onUntuned(fn)` | `(frequency) => void` |
|
|
78
|
+
```typescript
|
|
79
|
+
m.globe() // Edge location stats from 300+ Cloudflare colos
|
|
80
|
+
```
|
|
108
81
|
|
|
109
|
-
|
|
82
|
+
### Platform
|
|
110
83
|
|
|
111
|
-
|
|
84
|
+
```typescript
|
|
85
|
+
m.health() // Health check
|
|
86
|
+
m.info() // Server info
|
|
87
|
+
```
|
|
112
88
|
|
|
113
|
-
##
|
|
89
|
+
## Configuration
|
|
114
90
|
|
|
115
|
-
|
|
91
|
+
```typescript
|
|
92
|
+
const m = new MCPaaS({
|
|
93
|
+
baseUrl: 'https://mcpaas.live', // default
|
|
94
|
+
});
|
|
95
|
+
```
|
|
116
96
|
|
|
117
|
-
|
|
97
|
+
## Error Handling
|
|
118
98
|
|
|
119
|
-
|
|
99
|
+
```typescript
|
|
100
|
+
import { MCPaaS, MCPaaSError } from 'mcpaas';
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
await m.getSoul('nonexistent');
|
|
104
|
+
} catch (e) {
|
|
105
|
+
if (e instanceof MCPaaSError) {
|
|
106
|
+
console.log(e.status); // HTTP status code
|
|
107
|
+
console.log(e.body); // Response body
|
|
108
|
+
console.log(e.path); // Request path
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
120
112
|
|
|
121
113
|
## License
|
|
122
114
|
|
|
123
115
|
MIT
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
Built by [Wolfe James](https://github.com/Wolfe-Jam) | Powered by [MCPaaS](https://mcpaas.live) | Format: [FAF](https://faf.one)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCPaaS SDK — Context, on-demand.
|
|
3
|
+
* =================================
|
|
4
|
+
* Zero-dependency TypeScript client for the MCPaaS platform.
|
|
5
|
+
* Works with Bun, Node 18+, Deno, browsers, and edge runtimes.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { MCPaaS } from 'mcpaas';
|
|
9
|
+
* const m = new MCPaaS();
|
|
10
|
+
* const soul = await m.getRawSoul('spacex');
|
|
11
|
+
*/
|
|
12
|
+
export interface MCPaaSOptions {
|
|
13
|
+
/** Base URL of the MCPaaS instance. Default: https://mcpaas.live */
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SoulStats {
|
|
17
|
+
date: string;
|
|
18
|
+
total_souls: number;
|
|
19
|
+
operations_today: Record<string, number>;
|
|
20
|
+
top_souls: Array<{
|
|
21
|
+
soul: string;
|
|
22
|
+
reads: number;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
export interface ScoreResult {
|
|
26
|
+
handle: string;
|
|
27
|
+
score: number;
|
|
28
|
+
tierReady: boolean;
|
|
29
|
+
valid: boolean;
|
|
30
|
+
engine: string;
|
|
31
|
+
}
|
|
32
|
+
export interface RepoScore {
|
|
33
|
+
score: number;
|
|
34
|
+
repo: string;
|
|
35
|
+
hasFaf: boolean;
|
|
36
|
+
language: string;
|
|
37
|
+
stars: number;
|
|
38
|
+
description: string;
|
|
39
|
+
}
|
|
40
|
+
export interface LeaderboardResult {
|
|
41
|
+
top: Array<{
|
|
42
|
+
repo: string;
|
|
43
|
+
score: number;
|
|
44
|
+
language: string;
|
|
45
|
+
}>;
|
|
46
|
+
recent: Array<{
|
|
47
|
+
repo: string;
|
|
48
|
+
score: number;
|
|
49
|
+
language: string;
|
|
50
|
+
}>;
|
|
51
|
+
total: number;
|
|
52
|
+
}
|
|
53
|
+
export interface DirectoryEntry {
|
|
54
|
+
handle: string;
|
|
55
|
+
name: string;
|
|
56
|
+
tagline: string;
|
|
57
|
+
role: string;
|
|
58
|
+
avatar: number;
|
|
59
|
+
tags: string[];
|
|
60
|
+
userTags: string[];
|
|
61
|
+
score: number;
|
|
62
|
+
}
|
|
63
|
+
export interface DirectoryResult {
|
|
64
|
+
count: number;
|
|
65
|
+
namepoints: DirectoryEntry[];
|
|
66
|
+
userTagIndex: Array<{
|
|
67
|
+
tag: string;
|
|
68
|
+
count: number;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
71
|
+
export interface CheckResult {
|
|
72
|
+
handle: string;
|
|
73
|
+
available: boolean;
|
|
74
|
+
price?: number;
|
|
75
|
+
tier?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface CountResult {
|
|
78
|
+
claimed: number;
|
|
79
|
+
remaining: number;
|
|
80
|
+
tier: string;
|
|
81
|
+
price: string;
|
|
82
|
+
annual: string;
|
|
83
|
+
names: string[];
|
|
84
|
+
}
|
|
85
|
+
export interface DiscoverResult {
|
|
86
|
+
namepoints: DirectoryEntry[];
|
|
87
|
+
souls: string[];
|
|
88
|
+
totalSouls: number;
|
|
89
|
+
}
|
|
90
|
+
export interface TagProfile {
|
|
91
|
+
tag: string;
|
|
92
|
+
count: number;
|
|
93
|
+
cooccurs: Array<{
|
|
94
|
+
tag: string;
|
|
95
|
+
overlap: number;
|
|
96
|
+
}>;
|
|
97
|
+
}
|
|
98
|
+
export interface TagCandidate {
|
|
99
|
+
term: string;
|
|
100
|
+
count: number;
|
|
101
|
+
source: string;
|
|
102
|
+
}
|
|
103
|
+
export interface TagMerge {
|
|
104
|
+
canonical: string;
|
|
105
|
+
variants: string[];
|
|
106
|
+
}
|
|
107
|
+
export interface TagIntelResult {
|
|
108
|
+
tags: TagProfile[];
|
|
109
|
+
candidates: TagCandidate[];
|
|
110
|
+
merges: TagMerge[];
|
|
111
|
+
analysed: number;
|
|
112
|
+
updatedAt: string;
|
|
113
|
+
}
|
|
114
|
+
export interface SuggestResult {
|
|
115
|
+
handle: string;
|
|
116
|
+
existingTags: string[];
|
|
117
|
+
suggestions: string[];
|
|
118
|
+
}
|
|
119
|
+
export interface GlobeLocation {
|
|
120
|
+
code: string;
|
|
121
|
+
count: number;
|
|
122
|
+
lat: number;
|
|
123
|
+
lng: number;
|
|
124
|
+
city: string;
|
|
125
|
+
active: boolean;
|
|
126
|
+
}
|
|
127
|
+
export interface GlobeResult {
|
|
128
|
+
total: number;
|
|
129
|
+
activeLocations: number;
|
|
130
|
+
totalLocations: number;
|
|
131
|
+
locations: GlobeLocation[];
|
|
132
|
+
updated: string;
|
|
133
|
+
}
|
|
134
|
+
export interface HealthResult {
|
|
135
|
+
status: string;
|
|
136
|
+
engine: string;
|
|
137
|
+
engineStatus: string;
|
|
138
|
+
engineScore: number;
|
|
139
|
+
engineSize: string;
|
|
140
|
+
[key: string]: unknown;
|
|
141
|
+
}
|
|
142
|
+
export interface InfoResult {
|
|
143
|
+
name: string;
|
|
144
|
+
version: string;
|
|
145
|
+
[key: string]: unknown;
|
|
146
|
+
}
|
|
147
|
+
export declare class MCPaaS {
|
|
148
|
+
private baseUrl;
|
|
149
|
+
constructor(options?: MCPaaSOptions);
|
|
150
|
+
/** Fetch structured soul content by name */
|
|
151
|
+
getSoul(name: string): Promise<string>;
|
|
152
|
+
/** Fetch raw plain-text soul content */
|
|
153
|
+
getRawSoul(name: string): Promise<string>;
|
|
154
|
+
/** Get soul stats (counts, top souls, operations) */
|
|
155
|
+
listSouls(): Promise<SoulStats>;
|
|
156
|
+
/** Score a namepoint by handle */
|
|
157
|
+
score(handle: string): Promise<ScoreResult>;
|
|
158
|
+
/** Score a GitHub repo (owner/repo or full URL) */
|
|
159
|
+
scoreRepo(repo: string): Promise<RepoScore>;
|
|
160
|
+
/** Get the scoring leaderboard */
|
|
161
|
+
leaderboard(): Promise<LeaderboardResult>;
|
|
162
|
+
/** Get the full namepoint directory */
|
|
163
|
+
directory(): Promise<DirectoryResult>;
|
|
164
|
+
/** Check if a handle is available */
|
|
165
|
+
check(handle: string): Promise<CheckResult>;
|
|
166
|
+
/** Get namepoint counts */
|
|
167
|
+
count(): Promise<CountResult>;
|
|
168
|
+
/** Discovery feed (namepoints + souls) */
|
|
169
|
+
discover(): Promise<DiscoverResult>;
|
|
170
|
+
/** Full tag intelligence: patterns, co-occurrence, candidates, merges */
|
|
171
|
+
tagIntel(): Promise<TagIntelResult>;
|
|
172
|
+
/** Suggest tags for a namepoint based on content patterns */
|
|
173
|
+
suggestTags(handle: string): Promise<SuggestResult>;
|
|
174
|
+
/** Get the badge URL for a GitHub repo (synchronous — returns URL string) */
|
|
175
|
+
badge(owner: string, repo: string): string;
|
|
176
|
+
/** Get edge location execution stats from 300+ Cloudflare colos */
|
|
177
|
+
globe(): Promise<GlobeResult>;
|
|
178
|
+
/** Health check */
|
|
179
|
+
health(): Promise<HealthResult>;
|
|
180
|
+
/** Server info */
|
|
181
|
+
info(): Promise<InfoResult>;
|
|
182
|
+
private json;
|
|
183
|
+
private text;
|
|
184
|
+
}
|
|
185
|
+
export declare class MCPaaSError extends Error {
|
|
186
|
+
status: number;
|
|
187
|
+
body: string;
|
|
188
|
+
path: string;
|
|
189
|
+
constructor(status: number, body: string, path: string);
|
|
190
|
+
}
|
|
191
|
+
export default MCPaaS;
|