tokrepo-mcp-server 2.12.2 → 2.13.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 +11 -6
  2. package/bin/server.js +164 -1
  3. package/package.json +3 -1
package/README.md CHANGED
@@ -36,6 +36,7 @@ gemini settings mcp add tokrepo -- npx -y tokrepo-mcp-server
36
36
  Once connected, your AI assistant can:
37
37
 
38
38
  - **Discover during planning** — turn a task or capability gap into structured candidate skills, prompts, MCP configs, scripts, and workflows
39
+ - **Resolve capability gaps** — select a candidate with verification evidence, install plan, lifecycle contract, next MCP calls, and CLI fallbacks before local build
39
40
  - **Search** 200+ curated AI assets by keyword or category with agent fit signals
40
41
  - **Browse** trending assets, filter by type (MCP, Skill, Prompt, Agent, Script)
41
42
  - **Get details** — full documentation, install instructions, and metadata
@@ -43,7 +44,7 @@ Once connected, your AI assistant can:
43
44
  - **Plan before install** — get install plan v2 with policy decisions, rollback, verification, `evidence_bundle`, SBOM-lite, and `signature_evidence`
44
45
  - **Safe Codex install** — dry-run by default; risky assets must be staged or explicitly approved
45
46
  - **Lifecycle control** — list, update, uninstall, and roll back managed Codex installs
46
- - **Post-task handoff planning** — inspect reusable local work with `tokrepo_handoff_plan` before any push, including `quality_gate`, package manifest, SBOM-lite, and provenance
47
+ - **Post-task harvest** — inspect changed or explicit local files with `tokrepo_harvest` before any push, including private package drafts, `quality_gate`, package manifest, SBOM-lite, and provenance
47
48
  - **Project memory** — pair with `tokrepo init-agent --target all` so future agents know to call TokRepo during planning
48
49
  - **Discovery surfaces** — official MCP `server.json`, A2A agent card, portable agent manifest, tool catalog, `.well-known`, `agents.txt`, `llms.txt`, and npm metadata are kept machine-readable for agents and registries
49
50
  - **Funnel visibility** — anonymous aggregate events show whether agents actually discover, plan, install, hand off, and push reusable assets
@@ -53,6 +54,7 @@ Once connected, your AI assistant can:
53
54
  | Tool | Description |
54
55
  |------|-------------|
55
56
  | `tokrepo_discover` | Planning-time capability discovery from a task, environment, and constraints |
57
+ | `tokrepo_resolve_capability` | Resolve a capability gap into a selected asset, verification evidence, install plan, lifecycle contract, next MCP calls, and CLI fallbacks |
56
58
  | `tokrepo_search` | Search assets by keyword/tag with `agent_fit` ranking |
57
59
  | `tokrepo_detail` | Get full asset details by UUID |
58
60
  | `tokrepo_verify` | Verify trust, hashes, permissions, policy, evidence_bundle, SBOM-lite, and signature_evidence before activation |
@@ -63,16 +65,17 @@ Once connected, your AI assistant can:
63
65
  | `tokrepo_uninstall` | Dry-run or remove a managed Codex install |
64
66
  | `tokrepo_rollback` | Dry-run or roll back a prior Codex install session |
65
67
  | `tokrepo_handoff_plan` | Read-only packaging plan with quality_gate and package manifest for reusable local work after a task |
68
+ | `tokrepo_harvest` | Read-only package draft generator for reusable changed or explicit local files after a task |
66
69
  | `tokrepo_push` | Push one explicit asset to TokRepo after user confirmation |
67
70
 
68
71
  ## Example Conversations
69
72
 
70
73
  ```
71
74
  You: "Find me a good MCP server for databases"
72
- AI: [calls tokrepo_discover] → Ranks DBHub, Supabase MCP, PostgreSQL MCP as candidate capabilities
75
+ AI: [calls tokrepo_resolve_capability] → Ranks DBHub, Supabase MCP, PostgreSQL MCP and returns verification/install-plan evidence for the selected candidate
73
76
 
74
77
  You: "What video assets should I install?"
75
- AI: [calls tokrepo_discover] → Finds relevant skills, checks fit and policy, then asks before installing
78
+ AI: [calls tokrepo_resolve_capability] → Finds relevant skills, checks fit, trust, and policy, then asks before installing
76
79
 
77
80
  You: "Install that cursor rules asset"
78
81
  AI: [calls tokrepo_verify] → Checks trust_score_v2, permissions, blockers, and warnings
@@ -81,7 +84,7 @@ AI: [calls tokrepo_codex_install with dry_run=false, confirm=true] → Writes on
81
84
  AI: [calls tokrepo_rollback with dry_run=true] → Shows exactly what would be removed before rollback
82
85
 
83
86
  You: "We created a reusable project rule; save it for future agents"
84
- AI: [calls tokrepo_handoff_plan] → Returns explicit files, hashes, quality_gate, package manifest, SBOM-lite, provenance, metadata defaults, and private-by-default push guidance
87
+ AI: [calls tokrepo_harvest] → Returns explicit files, hashes, quality_gate, package drafts, SBOM-lite, provenance, metadata defaults, and private-by-default push guidance
85
88
  AI: [asks for confirmation before tokrepo_push] → Uploads only reviewed files
86
89
  ```
87
90
 
@@ -93,7 +96,7 @@ Run this once in a project:
93
96
  npx tokrepo init-agent --target all
94
97
  ```
95
98
 
96
- It writes managed instructions to `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, Cursor rules, GitHub Copilot instructions, Cline rules, Windsurf rules, Roo rules, OpenHands microagents, Aider conventions, `.mcp.json`, and `.tokrepo/agent.json`. The rule is simple: during planning, when the agent sees a capability gap, it should call `tokrepo_discover` before inventing a one-off local tool. After a task, agents can call `tokrepo_handoff_plan` or run `tokrepo agent-handoff --json` to suggest reusable files for user-confirmed private publishing.
99
+ It writes managed instructions to `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, Cursor rules, GitHub Copilot instructions, Cline rules, Windsurf rules, Roo rules, OpenHands microagents, Aider conventions, `.mcp.json`, and `.tokrepo/agent.json`. The rule is simple: during planning, when the agent sees a capability gap, it should call `tokrepo_resolve_capability` or `tokrepo_discover` before inventing a one-off local tool. After a task, agents can call `tokrepo_harvest` or run `tokrepo harvest --changed --json` to suggest reusable files for user-confirmed private publishing.
97
100
 
98
101
  ## Machine-Readable Listing
99
102
 
@@ -110,6 +113,8 @@ Registries and agents can discover this server through:
110
113
  - Multi-agent compatibility: [tokrepo.com/evals/multi-agent-compatibility.json](https://tokrepo.com/evals/multi-agent-compatibility.json)
111
114
  - Agent memory schema: [tokrepo.com/schemas/agent-memory.schema.json](https://tokrepo.com/schemas/agent-memory.schema.json)
112
115
  - Agent evidence bundle schema: [tokrepo.com/schemas/agent-evidence-bundle.schema.json](https://tokrepo.com/schemas/agent-evidence-bundle.schema.json)
116
+ - Capability resolution schema: [tokrepo.com/schemas/capability-resolution.schema.json](https://tokrepo.com/schemas/capability-resolution.schema.json)
117
+ - Harvest report schema: [tokrepo.com/schemas/harvest-report.schema.json](https://tokrepo.com/schemas/harvest-report.schema.json)
113
118
  - Handoff package schema: [tokrepo.com/schemas/handoff-package.schema.json](https://tokrepo.com/schemas/handoff-package.schema.json)
114
119
  - Agent text entry: [tokrepo.com/agents.txt](https://tokrepo.com/agents.txt)
115
120
  - Agent instructions: [tokrepo.com/agent-instructions/tokrepo.md](https://tokrepo.com/agent-instructions/tokrepo.md)
@@ -118,7 +123,7 @@ Registries and agents can discover this server through:
118
123
 
119
124
  Use `https://tokrepo.com/agent-ecosystem.json` for agent marketplace submissions, starter templates, README snippets, install guides, and example projects. It contains canonical listing copy, ecosystem channels, target project-memory files, and verification commands.
120
125
 
121
- TokRepo emits anonymous aggregate funnel events for `tokrepo_discover`, `tokrepo_verify`, `tokrepo_install_plan`, install dry-runs, installs, handoffs, and pushes. It does not send task text or file contents. Disable with `TOKREPO_TELEMETRY=0`.
126
+ TokRepo emits anonymous aggregate funnel events for `tokrepo_resolve_capability`, `tokrepo_discover`, `tokrepo_verify`, `tokrepo_install_plan`, install dry-runs, installs, harvests, handoffs, and pushes. It does not send task text or file contents. Disable with `TOKREPO_TELEMETRY=0`.
122
127
 
123
128
  ## Why TokRepo?
124
129
 
package/bin/server.js CHANGED
@@ -20,7 +20,7 @@ const API_BASE = process.env.TOKREPO_API || 'https://api.tokrepo.com';
20
20
  const TOKREPO_URL = 'https://tokrepo.com';
21
21
  const TOKREPO_TOKEN = process.env.TOKREPO_TOKEN || '';
22
22
  const TOKREPO_CLI = process.env.TOKREPO_CLI || '';
23
- const SERVER_VERSION = '2.12.2';
23
+ const SERVER_VERSION = '2.13.0';
24
24
 
25
25
  // ─── MCP Protocol (JSON-RPC over stdio) ───
26
26
 
@@ -69,6 +69,60 @@ const TOOLS = [
69
69
  required: ['task'],
70
70
  },
71
71
  },
72
+ {
73
+ name: 'tokrepo_resolve_capability',
74
+ description: 'Resolve a planning-time capability gap into a selected TokRepo asset, verification evidence, and install plan. Use this as the default first action when the agent identifies a missing skill, MCP, prompt, script, workflow, or reusable capability. Read-only.',
75
+ inputSchema: {
76
+ type: 'object',
77
+ properties: {
78
+ task: {
79
+ type: 'string',
80
+ description: 'The user goal, subtask, or capability gap the agent needs to solve.',
81
+ },
82
+ target: {
83
+ type: 'string',
84
+ description: 'Optional agent/runtime target. Use "any" or "all" for generic cross-agent resolution.',
85
+ enum: ['any', 'all', 'codex', 'claude_code', 'gemini_cli', 'cursor', 'copilot', 'cline', 'windsurf', 'roo', 'openhands', 'aider', 'mcp_client'],
86
+ default: 'any',
87
+ },
88
+ environment: {
89
+ type: 'object',
90
+ description: 'Optional local environment signals, such as project_type, frameworks, language, can_run_shell, can_write_files, or browser_available.',
91
+ additionalProperties: true,
92
+ },
93
+ constraints: {
94
+ type: 'object',
95
+ description: 'Optional constraints such as kind, policy, risk, language, prefer_verified, or must_not_modify_files.',
96
+ additionalProperties: true,
97
+ },
98
+ kind: {
99
+ type: 'string',
100
+ description: 'Optional asset kind preference, e.g. skill, prompt, knowledge, mcp_config, script, workflow.',
101
+ },
102
+ policy: {
103
+ type: 'string',
104
+ description: 'Optional install policy preference.',
105
+ enum: ['allow', 'confirm', 'stage_only', 'deny'],
106
+ },
107
+ min_trust: {
108
+ type: 'number',
109
+ description: 'Minimum trust_score_v2 threshold before recommending direct use. Default 70.',
110
+ default: 70,
111
+ },
112
+ min_fit: {
113
+ type: 'number',
114
+ description: 'Minimum fit score threshold before recommending direct use. Default 70.',
115
+ default: 70,
116
+ },
117
+ limit: {
118
+ type: 'number',
119
+ description: 'Max discovery candidates (default 6, max 10).',
120
+ default: 6,
121
+ },
122
+ },
123
+ required: ['task'],
124
+ },
125
+ },
72
126
  {
73
127
  name: 'tokrepo_search',
74
128
  description: 'Search TokRepo for AI assets (skills, prompts, MCP configs, scripts, workflows). Returns matching assets with titles, descriptions, tags, stars, and install commands. Use this when the user asks to find AI tools, MCP servers, skills, prompts, or workflows.',
@@ -359,6 +413,30 @@ const TOOLS = [
359
413
  },
360
414
  },
361
415
  },
416
+ {
417
+ name: 'tokrepo_harvest',
418
+ description: 'Read-only post-task harvest. Inspect changed or explicit local files and produce private-by-default reusable asset package drafts with metadata, usage examples, risk notes, compatibility, and quality gates. Never publishes automatically.',
419
+ inputSchema: {
420
+ type: 'object',
421
+ properties: {
422
+ paths: {
423
+ type: 'array',
424
+ description: 'Optional explicit local paths to inspect. Omit to scan common reusable agent asset files.',
425
+ items: { type: 'string' },
426
+ },
427
+ changed: {
428
+ type: 'boolean',
429
+ description: 'When true, inspect git-changed files from the current repository.',
430
+ default: false,
431
+ },
432
+ limit: {
433
+ type: 'number',
434
+ description: 'Max drafts to return (default 12, max 30).',
435
+ default: 12,
436
+ },
437
+ },
438
+ },
439
+ },
362
440
  {
363
441
  name: 'tokrepo_eval_agent',
364
442
  description: 'Run TokRepo agent-native evals through the CLI. Verifies filtered search, install-plan contracts, metadata quality reporting, Codex install verification, manifest state, and rollback using temporary local state.',
@@ -482,6 +560,7 @@ const TOOLS = [
482
560
 
483
561
  const EXPOSED_TOOL_NAMES = new Set([
484
562
  'tokrepo_discover',
563
+ 'tokrepo_resolve_capability',
485
564
  'tokrepo_search',
486
565
  'tokrepo_detail',
487
566
  'tokrepo_install_plan',
@@ -492,6 +571,7 @@ const EXPOSED_TOOL_NAMES = new Set([
492
571
  'tokrepo_uninstall',
493
572
  'tokrepo_rollback',
494
573
  'tokrepo_handoff_plan',
574
+ 'tokrepo_harvest',
495
575
  'tokrepo_push',
496
576
  ]);
497
577
 
@@ -503,6 +583,13 @@ const TOOL_ANNOTATIONS = {
503
583
  idempotentHint: true,
504
584
  openWorldHint: true,
505
585
  },
586
+ tokrepo_resolve_capability: {
587
+ title: 'Resolve a capability gap into a verified asset and install plan',
588
+ readOnlyHint: true,
589
+ destructiveHint: false,
590
+ idempotentHint: true,
591
+ openWorldHint: true,
592
+ },
506
593
  tokrepo_search: {
507
594
  title: 'Search reusable AI assets',
508
595
  readOnlyHint: true,
@@ -573,6 +660,13 @@ const TOOL_ANNOTATIONS = {
573
660
  idempotentHint: true,
574
661
  openWorldHint: false,
575
662
  },
663
+ tokrepo_harvest: {
664
+ title: 'Harvest reusable local work into private-by-default package drafts',
665
+ readOnlyHint: true,
666
+ destructiveHint: false,
667
+ idempotentHint: true,
668
+ openWorldHint: false,
669
+ },
576
670
  tokrepo_push: {
577
671
  title: 'Publish explicit reviewed files to TokRepo after confirmation',
578
672
  readOnlyHint: false,
@@ -675,6 +769,7 @@ function telemetryDisabled() {
675
769
 
676
770
  function eventForTool(name, args = {}) {
677
771
  if (name === 'tokrepo_discover') return 'mcp_discover';
772
+ if (name === 'tokrepo_resolve_capability') return 'capability_resolve';
678
773
  if (name === 'tokrepo_search') return 'mcp_search';
679
774
  if (name === 'tokrepo_detail') return 'mcp_detail';
680
775
  if (name === 'tokrepo_install_plan') return 'install_plan';
@@ -682,6 +777,7 @@ function eventForTool(name, args = {}) {
682
777
  if (name === 'tokrepo_codex_install') return args.dry_run === false ? 'install_apply' : 'install_dry_run';
683
778
  if (name === 'tokrepo_rollback') return 'rollback_plan';
684
779
  if (name === 'tokrepo_handoff_plan') return 'handoff_plan';
780
+ if (name === 'tokrepo_harvest') return 'harvest_plan';
685
781
  if (name === 'tokrepo_push') return 'push';
686
782
  return '';
687
783
  }
@@ -1624,6 +1720,71 @@ async function handleHandoffPlan(args) {
1624
1720
  return { content: [{ type: 'text', text: jsonText('TokRepo agent handoff plan', data) }] };
1625
1721
  }
1626
1722
 
1723
+ async function handleResolveCapability(args) {
1724
+ const {
1725
+ task = '',
1726
+ target = args?.constraints?.target || 'any',
1727
+ kind = args?.constraints?.kind || '',
1728
+ policy = args?.constraints?.policy || '',
1729
+ limit = 6,
1730
+ min_trust = 70,
1731
+ min_fit = 70,
1732
+ offline = false,
1733
+ } = args || {};
1734
+ const taskText = compactText(task, 500);
1735
+ if (!taskText) {
1736
+ return { content: [{ type: 'text', text: 'Error: task is required.' }], isError: true };
1737
+ }
1738
+ const cliArgs = [
1739
+ 'resolve',
1740
+ taskText,
1741
+ '--json',
1742
+ '--target',
1743
+ String(target || 'any'),
1744
+ '--limit',
1745
+ String(Math.min(Math.max(Number(limit) || 6, 1), 10)),
1746
+ '--min-trust',
1747
+ String(Math.min(Math.max(Number(min_trust) || 70, 0), 100)),
1748
+ '--min-fit',
1749
+ String(Math.min(Math.max(Number(min_fit) || 70, 0), 100)),
1750
+ ];
1751
+ if (kind) cliArgs.push('--kind', String(kind));
1752
+ if (policy) cliArgs.push('--policy', String(policy));
1753
+ if (offline) cliArgs.push('--offline');
1754
+
1755
+ const { stdout, stderr } = await runTokrepoCli(cliArgs);
1756
+ let data;
1757
+ try {
1758
+ data = JSON.parse(stdout);
1759
+ } catch {
1760
+ data = { stdout, stderr };
1761
+ }
1762
+ return {
1763
+ structuredContent: data,
1764
+ content: [{ type: 'text', text: jsonText('TokRepo capability resolution', data) }],
1765
+ };
1766
+ }
1767
+
1768
+ async function handleHarvest(args) {
1769
+ const { paths = [], changed = false, limit = 12 } = args || {};
1770
+ const cliArgs = ['harvest', '--json', '--limit', String(Math.min(Math.max(Number(limit) || 12, 1), 30))];
1771
+ if (changed) cliArgs.push('--changed');
1772
+ for (const inputPath of asArray(paths)) {
1773
+ if (inputPath) cliArgs.push(String(inputPath));
1774
+ }
1775
+ const { stdout, stderr } = await runTokrepoCli(cliArgs);
1776
+ let data;
1777
+ try {
1778
+ data = JSON.parse(stdout);
1779
+ } catch {
1780
+ data = { stdout, stderr };
1781
+ }
1782
+ return {
1783
+ structuredContent: data,
1784
+ content: [{ type: 'text', text: jsonText('TokRepo harvest report', data) }],
1785
+ };
1786
+ }
1787
+
1627
1788
  async function handleEvalAgent(args) {
1628
1789
  const { uuid = '', keyword = '' } = args || {};
1629
1790
  const cliArgs = ['eval-agent', '--json'];
@@ -1795,6 +1956,7 @@ async function handleRequest(msg) {
1795
1956
  }
1796
1957
  switch (name) {
1797
1958
  case 'tokrepo_discover': result = await handleDiscover(args || {}); break;
1959
+ case 'tokrepo_resolve_capability': result = await handleResolveCapability(args || {}); break;
1798
1960
  case 'tokrepo_search': result = await handleSearch(args || {}); break;
1799
1961
  case 'tokrepo_detail': result = await handleDetail(args || {}); break;
1800
1962
  case 'tokrepo_install': result = await handleInstall(args || {}); break;
@@ -1807,6 +1969,7 @@ async function handleRequest(msg) {
1807
1969
  case 'tokrepo_uninstall': result = await handleUninstall(args || {}); break;
1808
1970
  case 'tokrepo_rollback': result = await handleRollback(args || {}); break;
1809
1971
  case 'tokrepo_handoff_plan': result = await handleHandoffPlan(args || {}); break;
1972
+ case 'tokrepo_harvest': result = await handleHarvest(args || {}); break;
1810
1973
  case 'tokrepo_eval_agent': result = await handleEvalAgent(args || {}); break;
1811
1974
  case 'tokrepo_trending': result = await handleTrending(args || {}); break;
1812
1975
  case 'tokrepo_push': result = await handlePush(args || {}); break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokrepo-mcp-server",
3
- "version": "2.12.2",
3
+ "version": "2.13.0",
4
4
  "description": "Agent-native MCP server for TokRepo - discover, verify, plan, safely install, hand off, and push AI assets from MCP clients.",
5
5
  "mcpName": "io.github.henu-wang/tokrepo-mcp-server",
6
6
  "bin": {
@@ -43,6 +43,8 @@
43
43
  "tool-discovery",
44
44
  "llms-txt",
45
45
  "trust-verification",
46
+ "capability-resolution",
47
+ "asset-harvest",
46
48
  "agent-audit",
47
49
  "agent-evals"
48
50
  ],