tokrepo-mcp-server 2.7.0 → 2.9.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 +19 -2
  2. package/bin/server.js +150 -4
  3. package/package.json +17 -4
package/README.md CHANGED
@@ -43,6 +43,8 @@ Once connected, your AI assistant can:
43
43
  - **Safe Codex install** — dry-run by default; risky assets must be staged or explicitly approved
44
44
  - **Lifecycle control** — list, update, uninstall, and roll back managed Codex installs
45
45
  - **Project memory** — pair with `tokrepo init-agent --target all` so future agents know to call TokRepo during planning
46
+ - **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
47
+ - **Funnel visibility** — anonymous aggregate events show whether agents actually discover, plan, install, hand off, and push reusable assets
46
48
 
47
49
  ## Available Tools
48
50
 
@@ -82,7 +84,22 @@ Run this once in a project:
82
84
  npx tokrepo init-agent --target all
83
85
  ```
84
86
 
85
- It writes managed instructions to `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, Cursor rules, and `.mcp.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 run `tokrepo agent-handoff --json` to suggest reusable files for user-confirmed private publishing.
87
+ 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, and `.mcp.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 run `tokrepo agent-handoff --json` to suggest reusable files for user-confirmed private publishing.
88
+
89
+ ## Machine-Readable Listing
90
+
91
+ Registries and agents can discover this server through:
92
+
93
+ - MCP server manifest: [tokrepo.com/.well-known/mcp/server.json](https://tokrepo.com/.well-known/mcp/server.json)
94
+ - TokRepo manifest: [tokrepo.com/.well-known/tokrepo.json](https://tokrepo.com/.well-known/tokrepo.json)
95
+ - Portable agent manifest: [tokrepo.com/.well-known/agent.json](https://tokrepo.com/.well-known/agent.json)
96
+ - A2A agent card: [tokrepo.com/.well-known/agent-card.json](https://tokrepo.com/.well-known/agent-card.json)
97
+ - Tool catalog: [tokrepo.com/.well-known/tool-catalog.json](https://tokrepo.com/.well-known/tool-catalog.json)
98
+ - Agent text entry: [tokrepo.com/agents.txt](https://tokrepo.com/agents.txt)
99
+ - Agent instructions: [tokrepo.com/agent-instructions/tokrepo.md](https://tokrepo.com/agent-instructions/tokrepo.md)
100
+ - LLM crawler entry: [tokrepo.com/llms.txt](https://tokrepo.com/llms.txt)
101
+
102
+ TokRepo emits anonymous aggregate funnel events for `tokrepo_discover`, `tokrepo_install_plan`, install dry-runs, installs, handoffs, and pushes. It does not send task text or file contents. Disable with `TOKREPO_TELEMETRY=0`.
86
103
 
87
104
  ## Why TokRepo?
88
105
 
@@ -102,7 +119,7 @@ TokRepo is the **open registry for AI assets** — like npm for packages, but fo
102
119
 
103
120
  - **Website**: [tokrepo.com](https://tokrepo.com)
104
121
  - **CLI**: [npm: tokrepo](https://www.npmjs.com/package/tokrepo)
105
- - **GitHub**: [tokrepo/mcp-server](https://github.com/tokrepo/mcp-server)
122
+ - **GitHub**: [henu-wang/tokrepo-mcp-server](https://github.com/henu-wang/tokrepo-mcp-server)
106
123
  - **API**: [tokrepo.com/.well-known/tokrepo.json](https://tokrepo.com/.well-known/tokrepo.json)
107
124
 
108
125
  ## License
package/bin/server.js CHANGED
@@ -12,6 +12,7 @@
12
12
  */
13
13
 
14
14
  const https = require('https');
15
+ const http = require('http');
15
16
  const crypto = require('crypto');
16
17
  const { execFile } = require('child_process');
17
18
 
@@ -19,7 +20,7 @@ const API_BASE = process.env.TOKREPO_API || 'https://api.tokrepo.com';
19
20
  const TOKREPO_URL = 'https://tokrepo.com';
20
21
  const TOKREPO_TOKEN = process.env.TOKREPO_TOKEN || '';
21
22
  const TOKREPO_CLI = process.env.TOKREPO_CLI || '';
22
- const SERVER_VERSION = '2.7.0';
23
+ const SERVER_VERSION = '2.9.0';
23
24
 
24
25
  // ─── MCP Protocol (JSON-RPC over stdio) ───
25
26
 
@@ -46,7 +47,7 @@ const TOOLS = [
46
47
  target: {
47
48
  type: 'string',
48
49
  description: 'Optional agent/runtime target. Use "any" for generic discovery.',
49
- enum: ['any', 'codex', 'claude_code', 'gemini_cli', 'cursor', 'windsurf', 'mcp_client'],
50
+ enum: ['any', 'codex', 'claude_code', 'gemini_cli', 'cursor', 'copilot', 'cline', 'windsurf', 'roo', 'openhands', 'aider', 'mcp_client'],
50
51
  default: 'any',
51
52
  },
52
53
  environment: {
@@ -91,7 +92,7 @@ const TOOLS = [
91
92
  target: {
92
93
  type: 'string',
93
94
  description: 'Optional agent target filter. Use "any" or omit it for generic discovery.',
94
- enum: ['any', 'codex', 'claude_code', 'gemini_cli', 'cursor', 'windsurf', 'mcp_client'],
95
+ enum: ['any', 'codex', 'claude_code', 'gemini_cli', 'cursor', 'copilot', 'cline', 'windsurf', 'roo', 'openhands', 'aider', 'mcp_client'],
95
96
  },
96
97
  kind: {
97
98
  type: 'string',
@@ -443,7 +444,85 @@ const EXPOSED_TOOL_NAMES = new Set([
443
444
  'tokrepo_push',
444
445
  ]);
445
446
 
446
- const EXPOSED_TOOLS = TOOLS.filter((tool) => EXPOSED_TOOL_NAMES.has(tool.name));
447
+ const TOOL_ANNOTATIONS = {
448
+ tokrepo_discover: {
449
+ title: 'Discover reusable AI assets before inventing a one-off tool',
450
+ readOnlyHint: true,
451
+ destructiveHint: false,
452
+ idempotentHint: true,
453
+ openWorldHint: true,
454
+ },
455
+ tokrepo_search: {
456
+ title: 'Search reusable AI assets',
457
+ readOnlyHint: true,
458
+ destructiveHint: false,
459
+ idempotentHint: true,
460
+ openWorldHint: true,
461
+ },
462
+ tokrepo_detail: {
463
+ title: 'Read asset details and metadata',
464
+ readOnlyHint: true,
465
+ destructiveHint: false,
466
+ idempotentHint: true,
467
+ openWorldHint: true,
468
+ },
469
+ tokrepo_install_plan: {
470
+ title: 'Plan an install before any file write',
471
+ readOnlyHint: true,
472
+ destructiveHint: false,
473
+ idempotentHint: true,
474
+ openWorldHint: true,
475
+ },
476
+ tokrepo_codex_install: {
477
+ title: 'Dry-run, stage, or install an asset for Codex',
478
+ readOnlyHint: false,
479
+ destructiveHint: true,
480
+ idempotentHint: false,
481
+ openWorldHint: true,
482
+ },
483
+ tokrepo_installed: {
484
+ title: 'List locally installed TokRepo assets',
485
+ readOnlyHint: true,
486
+ destructiveHint: false,
487
+ idempotentHint: true,
488
+ openWorldHint: false,
489
+ },
490
+ tokrepo_update: {
491
+ title: 'Dry-run or update installed TokRepo assets',
492
+ readOnlyHint: false,
493
+ destructiveHint: true,
494
+ idempotentHint: false,
495
+ openWorldHint: true,
496
+ },
497
+ tokrepo_uninstall: {
498
+ title: 'Dry-run or uninstall a TokRepo-managed asset',
499
+ readOnlyHint: false,
500
+ destructiveHint: true,
501
+ idempotentHint: false,
502
+ openWorldHint: false,
503
+ },
504
+ tokrepo_rollback: {
505
+ title: 'Dry-run or roll back a TokRepo install session',
506
+ readOnlyHint: false,
507
+ destructiveHint: true,
508
+ idempotentHint: false,
509
+ openWorldHint: false,
510
+ },
511
+ tokrepo_push: {
512
+ title: 'Publish explicit reviewed files to TokRepo after confirmation',
513
+ readOnlyHint: false,
514
+ destructiveHint: true,
515
+ idempotentHint: false,
516
+ openWorldHint: true,
517
+ },
518
+ };
519
+
520
+ const EXPOSED_TOOLS = TOOLS
521
+ .filter((tool) => EXPOSED_TOOL_NAMES.has(tool.name))
522
+ .map((tool) => ({
523
+ ...tool,
524
+ annotations: TOOL_ANNOTATIONS[tool.name],
525
+ }));
447
526
 
448
527
  // ─── HTTP Helper ───
449
528
 
@@ -524,6 +603,72 @@ function apiPost(urlPath, body, token) {
524
603
  });
525
604
  }
526
605
 
606
+ function telemetryDisabled() {
607
+ const value = String(process.env.TOKREPO_TELEMETRY || '').toLowerCase();
608
+ return ['0', 'false', 'off', 'no'].includes(value);
609
+ }
610
+
611
+ function eventForTool(name, args = {}) {
612
+ if (name === 'tokrepo_discover') return 'mcp_discover';
613
+ if (name === 'tokrepo_search') return 'mcp_search';
614
+ if (name === 'tokrepo_detail') return 'mcp_detail';
615
+ if (name === 'tokrepo_install_plan') return 'install_plan';
616
+ if (name === 'tokrepo_codex_install') return args.dry_run === false ? 'install_apply' : 'install_dry_run';
617
+ if (name === 'tokrepo_push') return 'push';
618
+ return '';
619
+ }
620
+
621
+ function candidateCountFromResult(result) {
622
+ const text = result?.content?.map(item => item.text || '').join('\n') || '';
623
+ return (text.match(/"uuid"\s*:/g) || []).length;
624
+ }
625
+
626
+ function trackAgentEventForTool(name, args = {}, result = {}) {
627
+ if (telemetryDisabled()) return;
628
+ const event = eventForTool(name, args);
629
+ if (!event) return;
630
+ try {
631
+ const url = new URL('/api/v1/tokenboard/agent/events', API_BASE);
632
+ if (url.protocol === 'http:' && !url.hostname.match(/^(localhost|127\.0\.0\.1)$/)) {
633
+ url.protocol = 'https:';
634
+ }
635
+ const body = JSON.stringify({
636
+ event,
637
+ source: 'mcp',
638
+ version: SERVER_VERSION,
639
+ target: args.target || args?.constraints?.target || 'any',
640
+ kind: args.kind || args?.constraints?.kind || '',
641
+ policy: args.policy || args?.constraints?.policy || '',
642
+ result: result?.isError ? 'error' : 'pass',
643
+ dry_run: name === 'tokrepo_codex_install' ? args.dry_run !== false : undefined,
644
+ candidate_count: candidateCountFromResult(result),
645
+ });
646
+ const isHttps = url.protocol === 'https:';
647
+ const mod = isHttps ? https : http;
648
+ const req = mod.request({
649
+ hostname: url.hostname,
650
+ port: url.port || (isHttps ? 443 : 80),
651
+ path: url.pathname,
652
+ method: 'POST',
653
+ headers: {
654
+ 'Content-Type': 'application/json',
655
+ 'Content-Length': Buffer.byteLength(body),
656
+ 'User-Agent': `tokrepo-mcp-server/${SERVER_VERSION}`,
657
+ },
658
+ timeout: 700,
659
+ }, (res) => {
660
+ res.resume();
661
+ });
662
+ req.on('socket', socket => socket.unref?.());
663
+ req.on('error', () => {});
664
+ req.on('timeout', () => req.destroy());
665
+ req.write(body);
666
+ req.end();
667
+ } catch {
668
+ // Telemetry is best-effort only.
669
+ }
670
+ }
671
+
527
672
  function apiGetAuth(urlPath, token) {
528
673
  return new Promise((resolve, reject) => {
529
674
  const url = new URL(urlPath, API_BASE);
@@ -1423,6 +1568,7 @@ async function handleRequest(msg) {
1423
1568
  } catch (e) {
1424
1569
  result = { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
1425
1570
  }
1571
+ trackAgentEventForTool(name, args || {}, result);
1426
1572
  return { jsonrpc: '2.0', id, result };
1427
1573
  }
1428
1574
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "tokrepo-mcp-server",
3
- "version": "2.7.0",
3
+ "version": "2.9.0",
4
4
  "description": "Agent-native MCP server for TokRepo — search, plan, safely install, and push AI assets from MCP clients.",
5
- "mcpName": "io.github.tokrepo/mcp-server",
5
+ "mcpName": "io.github.henu-wang/tokrepo-mcp-server",
6
6
  "bin": {
7
7
  "tokrepo-mcp-server": "bin/server.js"
8
8
  },
@@ -12,7 +12,7 @@
12
12
  "license": "MIT",
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/tokrepo/mcp-server.git"
15
+ "url": "git+https://github.com/henu-wang/tokrepo-mcp-server.git"
16
16
  },
17
17
  "homepage": "https://tokrepo.com",
18
18
  "keywords": [
@@ -24,10 +24,23 @@
24
24
  "cursor",
25
25
  "codex",
26
26
  "gemini",
27
+ "copilot",
28
+ "cline",
29
+ "windsurf",
30
+ "openhands",
27
31
  "skills",
28
32
  "prompts",
29
33
  "workflows",
30
- "agent"
34
+ "agent",
35
+ "agent-tools",
36
+ "agent-skills",
37
+ "claude-code",
38
+ "openai-codex",
39
+ "mcp-registry",
40
+ "agent-manifest",
41
+ "a2a-agent-card",
42
+ "tool-discovery",
43
+ "llms-txt"
31
44
  ],
32
45
  "engines": {
33
46
  "node": ">=18"