mcp-squared 0.1.0 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +184 -8
  2. package/dist/index.js +7184 -6686
  3. package/package.json +28 -9
package/README.md CHANGED
@@ -1,23 +1,199 @@
1
1
  # MCP²: Mercury Control Plane for MCP
2
2
 
3
- MCP² (Mercury Control Plane) is a local-first meta-server and proxy for the Model Context Protocol (MCP). It addresses the problem of tool context bloat and schema token overhead by enabling dynamic, progressive disclosure of tools to LLMs. Instead of flooding the model context with every available tool schema, MCP² exposes a stable, minimal surface area for tool discovery and execution.
3
+ MCP² (Mercury Control Plane) is a local-first meta-server and proxy for the Model Context Protocol (MCP). It addresses tool context bloat by enabling dynamic, progressive disclosure of tools to LLMs. Instead of flooding the model context with every available tool schema, MCP² exposes a stable, minimal surface area for tool discovery and execution.
4
4
 
5
5
  ## Status
6
- **Inception / Pre-alpha**
6
+ **Alpha (v0.1.x)** - Core functionality is implemented and tested; CLI and config details may evolve.
7
7
 
8
- ## High-Level Approach
9
- MCP² acts as an intelligent middleware between your MCP clients (IDEs, agents) and upstream MCP servers. It provides:
10
- - `find_tools`: A semantic search interface to locate relevant capabilities.
11
- - `describe_tools`: On-demand retrieval of full schemas for selected tools.
12
- - `execute`: A passthrough execution layer with optional result caching and summarization.
8
+ ## Install & Run
9
+
10
+ MCP² is published on npm as `mcp-squared`. The CLI runs on Bun (even when installed via npm), so you'll need Bun installed on your machine.
11
+
12
+ ### Prerequisite: Bun
13
+
14
+ Install Bun (>= 1.0.0): https://bun.sh
15
+
16
+ ### Run without installing (recommended)
17
+
18
+ ```bash
19
+ bunx mcp-squared --help
20
+ bunx mcp-squared
21
+ ```
22
+
23
+ ### Run via npm / npx
24
+
25
+ ```bash
26
+ npx mcp-squared --help
27
+ npm exec --yes mcp-squared -- --help
28
+ ```
29
+
30
+ ### Install globally
31
+
32
+ ```bash
33
+ npm i -g mcp-squared
34
+ mcp-squared --help
35
+
36
+ # or
37
+ bun add -g mcp-squared
38
+ mcp-squared --help
39
+ ```
40
+
41
+ ### Run from source
42
+
43
+ ```bash
44
+ # Clone the repository
45
+ git clone https://github.com/aditzel/mcp-squared
46
+ cd mcp-squared
47
+
48
+ # Install dependencies
49
+ bun install
50
+
51
+ # Run in development mode
52
+ bun run dev
53
+
54
+ # Build for production
55
+ bun run build
56
+
57
+ # Run tests
58
+ bun test
59
+ ```
60
+
61
+ ### Standalone Executable (Experimental)
62
+
63
+ Build a single-file executable with Bun:
64
+
65
+ ```bash
66
+ bun run build:compile
67
+ ```
68
+
69
+ Run the compile validation matrix (target support, size check, standalone smoke test, embeddings probe):
70
+
71
+ ```bash
72
+ bun run build:compile:matrix
73
+ ```
74
+
75
+ Current findings and known blockers are tracked in `docs/STANDALONE-COMPILE.md`.
76
+
77
+ ## CLI Commands (Common)
78
+
79
+ ```bash
80
+ mcp-squared # Auto: daemon (TTY) or proxy (piped stdio)
81
+ mcp-squared --stdio # Start MCP server (stdio mode)
82
+ mcp-squared daemon # Start shared daemon (multi-client backend)
83
+ mcp-squared proxy # Start stdio proxy to the shared daemon
84
+ mcp-squared config # Launch configuration TUI
85
+ mcp-squared test [upstream] # Test upstream server connections
86
+ mcp-squared auth <upstream> # OAuth auth for SSE/HTTP upstreams
87
+ mcp-squared import # Import MCP configs from other tools
88
+ mcp-squared install # Install MCP² into other MCP clients
89
+ mcp-squared monitor # Launch server monitor TUI
90
+ mcp-squared --help # Full command reference
91
+ ```
92
+
93
+ ## Shared Daemon Mode (Optional)
94
+
95
+ Shared daemon mode keeps a single MCP² backend alive and lets multiple stdio clients connect through lightweight proxies. This reduces duplicated upstream connections and indexing work when many tools run in parallel.
96
+
97
+ Auto mode chooses `daemon` when running in a TTY and `proxy` when stdin/stdout are piped (as MCP clients do).
98
+
99
+ ```bash
100
+ mcp-squared daemon # Start the shared backend
101
+ mcp-squared proxy # Run a stdio proxy that connects to the daemon
102
+ ```
103
+
104
+ When installing into supported clients, you can register the proxy automatically:
105
+
106
+ ```bash
107
+ mcp-squared install --proxy
108
+ mcp-squared install --stdio
109
+ ```
110
+
111
+ ## Configuration
112
+
113
+ Config discovery order:
114
+ 1. `MCP_SQUARED_CONFIG` environment variable
115
+ 2. Project-local `mcp-squared.toml` or `.mcp-squared/config.toml`
116
+ 3. User-level `~/.config/mcp-squared/config.toml` (or `%APPDATA%/mcp-squared/config.toml` on Windows)
117
+
118
+ Minimal example:
119
+
120
+ ```toml
121
+ schemaVersion = 1
122
+
123
+ [upstreams.local]
124
+ transport = "stdio"
125
+ [upstreams.local.stdio]
126
+ command = "mcp-server-local"
127
+ args = []
128
+
129
+ [upstreams.remote]
130
+ transport = "sse"
131
+ [upstreams.remote.sse]
132
+ url = "https://example.com/mcp"
133
+ auth = true
134
+ ```
135
+
136
+ Security policies (allow/block/confirm) live under `security.tools`. Confirmation flows return a short-lived token that must be provided to `execute` to proceed. OAuth tokens for SSE upstreams are stored under `~/.config/mcp-squared/tokens/<upstream>.json`.
137
+
138
+ ## Tool API (Meta-Tools)
139
+
140
+ MCP² exposes these tools to MCP clients:
141
+ - `find_tools` - Search tools across upstream servers
142
+ - `describe_tools` - Fetch full JSON schemas for selected tools
143
+ - `execute` - Call an upstream tool with policy enforcement
144
+ - `list_namespaces` - List upstream namespaces (optionally with tool names)
145
+ - `clear_selection_cache` - Reset co-occurrence based suggestions
146
+
147
+ ## Search Modes
148
+
149
+ `find_tools` supports three search modes:
150
+ - `fast` (default): SQLite FTS5 full-text search
151
+ - `semantic`: Embedding similarity search (falls back to `fast` if embeddings are missing)
152
+ - `hybrid`: FTS5 + embedding rerank (falls back to `fast` if embeddings are missing)
153
+
154
+ > **Note:** Semantic and hybrid modes load a local embedding model (BGE-small via Transformers.js/WASM). First load downloads ~33MB and adds ~294MB RSS. These modes are optional - `fast` mode (default) has no such overhead.
155
+
156
+ Embeddings are generated locally using Transformers.js (BGE-small). They are optional and can be generated programmatically via the retriever API.
157
+
158
+ ## Supported MCP Clients (Import/Install)
159
+
160
+ MCP² can import or install MCP server configs for:
161
+ `claude-code`, `claude-desktop`, `cursor`, `windsurf`, `vscode`, `cline`, `roo-code`, `kilo-code`, `gemini-cli`, `zed`, `jetbrains`, `factory`, `opencode`, `qwen-code`, `trae`, `antigravity`, `warp` (import via explicit path), and `codex`.
162
+
163
+ ## Key Features
164
+ - Multi-upstream support (stdio + SSE/HTTP)
165
+ - OAuth 2.0 dynamic client registration for SSE upstreams
166
+ - Hybrid search with optional local embeddings (FTS5 + Transformers.js)
167
+ - Detail levels (L0/L1/L2) for progressive schema disclosure
168
+ - Selection caching with co-occurrence suggestions
169
+ - Background index refresh with change detection
170
+ - Security policies (allow/block/confirm) with confirmation tokens
171
+ - Local-first architecture (SQLite index)
172
+ - TUI interfaces for configuration and monitoring
13
173
 
14
174
  ## Non-Goals
15
175
  - Not a hosted SaaS platform (local-first).
16
176
  - Not a replacement for MCP clients (it serves them).
17
177
  - Not shipping language runtimes or SDKs at this stage.
18
178
 
179
+ ## Architecture
180
+
181
+ MCP² is built with Bun and TypeScript, leveraging:
182
+ - @modelcontextprotocol/sdk for MCP communication
183
+ - @huggingface/transformers for embeddings generation
184
+ - @opentui/core for the terminal user interface
185
+ - Zod for validation
186
+
187
+ See `docs/ARCHITECTURE.md` for a full architecture breakdown.
188
+
19
189
  ## Contributing
20
- We welcome contributions! Please see [CONTRIBUTING.md](.github/CONTRIBUTING.md) for details on how to get started.
190
+
191
+ We welcome contributions! Please see `.github/CONTRIBUTING.md` for details on how to get started.
192
+
193
+ ## Releasing
194
+
195
+ Maintainers can follow `docs/RELEASING.md` for the npm release checklist.
21
196
 
22
197
  ## License
198
+
23
199
  Apache-2.0