@tenpo/mcp 0.2.12 → 0.3.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 (2) hide show
  1. package/dist/index.js +85 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -101,6 +101,62 @@ async function ensureApiKey() {
101
101
  }
102
102
  }
103
103
  // ── MCP server ──────────────────────────────────────────────────────────────
104
+ /**
105
+ * Operator brief injected into every host AI's context at MCP connection time.
106
+ *
107
+ * Per MCP spec, `serverInfo.instructions` is THE field for telling the host AI
108
+ * how to behave when this server is loaded. Without this, the host falls back
109
+ * to its generic system prompt — and Tenpo MCP responses end up generic.
110
+ *
111
+ * Distilled from `/skills/tenpo-soul/SKILL.md` (472 lines → ~1.6KB). Covers:
112
+ * identity, zero-fabrication, response standard, tool chaining, sparse-data
113
+ * fallback, playbook library, and internal-name scrubbing.
114
+ */
115
+ const TENPO_OPERATOR_BRIEF = `You have Tenpo — the operator system for this merchant. 200+ tools across 8 commerce domains, 215 expert playbooks, per-merchant DuckDB with live store data, network telemetry.
116
+
117
+ # How to use Tenpo
118
+
119
+ For ANY non-trivial commerce question, your FIRST action is:
120
+
121
+ tenpo_think({ query: "<the user's question verbatim>" })
122
+
123
+ This returns a "thinking pack" — Tenpo's full pre-LLM orchestration output, designed for YOUR model (Sonnet/Opus/GPT-4/Gemini) to consume. The pack tells you:
124
+
125
+ • Domain + mode classification (fast / deep / investigate)
126
+ • Pre-fetched store evidence (snapshot, integration health)
127
+ • Data-quality flags — catches demo stores, sync issues, no-orders-30d gaps, structural anomalies that should change your strategy entirely
128
+ • Top 8 scored tools (of 200+) ranked by relevance to THIS query, with "why_relevant" reasoning
129
+ • Top 3 expert playbooks (of 215) with content previews
130
+ • Abstract reasoning directives (not scripted phrasings — principles you apply)
131
+ • Follow-up loop hints — what to call next based on what you find
132
+
133
+ The pack tells you WHAT TO THINK ABOUT. You decide WHAT TO SAY. Tenpo orchestrates; you reason.
134
+
135
+ # Discipline rules (always apply)
136
+
137
+ 1. Zero fabrication. Every number/name/date/ID must come from a tool call THIS turn. If you didn't call a tool for it, you don't know it. Empty results = report empty. Errors = report verbatim.
138
+
139
+ 2. Surface data-quality flags FIRST. If the pack flags a demo store, a sync gap, or zero historic orders — that finding leads your response. Don't strategize past a structural anomaly.
140
+
141
+ 3. Use tools the pack scored. The scored_tools list is curated for this query — call those first. Other tools exist (200+ total) but the pack ranking reflects relevance.
142
+
143
+ 4. Use the playbooks. The scored_skills list comes with content previews. Pull deeper via tenpo_get_prompt(id) when you need the full playbook.
144
+
145
+ 5. Investigate before strategizing in "investigate" mode. Don't stop at the symptom — chain tools until you find the causal chain, then explain it.
146
+
147
+ 6. Writes require tenpo_approve. Never claim "Done ✅" without a tool result confirming success.
148
+
149
+ 7. Translate internal names. Never expose "tenpo-klaviyo skill" or "tenpo_X tool" to the merchant. Natural language only.
150
+
151
+ 8. Custom integrations are universal. Any service the merchant names — Loop Returns, Sentry, n8n, custom webhooks — connect via tenpo_add_custom_connector + tenpo_call_integration. Never refuse.
152
+
153
+ # Format
154
+
155
+ Tool responses with a _DISPLAY_RULE field carry rendering directives — follow them. Charts use tenpo_chart and return real PNG URLs (QuickChart-rendered) that work in every host. For 3+ rows of data, use markdown tables.
156
+
157
+ # Identity
158
+
159
+ You ARE the operator running alongside this store, not a generic assistant. Direct. Lead with the answer. Every sentence carries information.`;
104
160
  const server = new Server({
105
161
  name: "tenpo",
106
162
  version: "0.2.0",
@@ -114,6 +170,11 @@ const server = new Server({
114
170
  // Desktop / Claude Code) handle it, others return method-not-found and
115
171
  // we fall back to BM25 gracefully.
116
172
  },
173
+ // serverInfo.instructions: read by every MCP host at connection time and
174
+ // injected into the host AI's context. This is how we ship Tenpo's
175
+ // operator psychology to coding agents (Claude Desktop, Cursor, Claude
176
+ // Code, Codex, etc.) without an LLM running server-side.
177
+ instructions: TENPO_OPERATOR_BRIEF,
117
178
  });
118
179
  // ── Sampling capability detection ───────────────────────────────────────────
119
180
  // Some hosts (Claude Desktop, Claude Code) support sampling. Others don't yet.
@@ -164,6 +225,20 @@ async function tryClassifyIntentViaSampling(query, taxonomy) {
164
225
  }
165
226
  // ── Tools ───────────────────────────────────────────────────────────────────
166
227
  const TOOLS = [
228
+ {
229
+ name: "tenpo_think",
230
+ description: "GOD-MODE ENTRY POINT — Call this FIRST for ANY non-trivial commerce question. Returns a 'thinking pack' with: domain classification, pre-fetched store evidence + data-quality flags (catches dev/demo stores, sync issues, structural anomalies), top 8 scored tools (of 200+) with relevance reasoning, top 3 expert playbooks (of 215) with content previews, abstract reasoning directives, and follow-up loop hints. The pack tells you WHAT to think about — you decide WHAT TO SAY. Tenpo never runs an LLM; your host model does the reasoning with curated context. This is what makes coding agents perform at or beyond the in-app Tenpo agent.",
231
+ inputSchema: {
232
+ type: "object",
233
+ required: ["query"],
234
+ properties: {
235
+ query: {
236
+ type: "string",
237
+ description: "The merchant's question or request, verbatim",
238
+ },
239
+ },
240
+ },
241
+ },
167
242
  {
168
243
  name: "tenpo_route",
169
244
  description: "PREFLIGHT INTELLIGENCE — Returns a curated tool/skill bundle for a query. Tenpo NEVER runs an LLM; you (the host) do the synthesis with your own tokens. Returns: relevant_tools (top 5 of 175+), relevant_skills (top 3 of 199 with content), suggested_path, pre_executed_data (revenue/alerts), suggested_next_actions, soul. Call this once per user query, then tenpo_run_tool for each tool you need.",
@@ -417,6 +492,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
417
492
  const { name, arguments: args = {} } = request.params;
418
493
  try {
419
494
  switch (name) {
495
+ case "tenpo_think": {
496
+ const a = args;
497
+ if (!a.query)
498
+ throw new Error("query required");
499
+ const result = await tenpoFetch("/api/v1/think", {
500
+ method: "POST",
501
+ body: { query: a.query },
502
+ });
503
+ return formatToolResult(result);
504
+ }
420
505
  case "tenpo_route": {
421
506
  const result = await tenpoFetch("/api/v1/route", {
422
507
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenpo/mcp",
3
- "version": "0.2.12",
3
+ "version": "0.3.0",
4
4
  "description": "Tenpo — the operator that runs alongside your store. Connects to 45+ commerce platforms (Shopify, Klaviyo, Meta Ads, GA4, Stripe…) and gives any AI host (Claude Desktop, Cursor, Claude Code, ChatGPT) deterministic answers about your sales, ads, email, inventory, suppliers, customers, finance, and competitors. Free tier, no card required.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://tenpo.ai",