@rebind.gg/mcp-server 0.1.2 → 0.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebind.gg/mcp-server",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "MCP server exposing Rebind as computer-use tools: screenshot, verified click, type, key, scroll, and window control over the Remote Access protocol.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -51,11 +51,6 @@ async function main() {
51
51
  await client.connect();
52
52
 
53
53
  const session = new Session(client);
54
- try {
55
- await session.calibrate();
56
- } catch (e) {
57
- session.calibration = { calibrated: false, reason: String(e) };
58
- }
59
54
 
60
55
  const server = new McpServer({ name: "rebind", version: "0.1.2" });
61
56
 
@@ -413,7 +408,8 @@ async function main() {
413
408
  "calibrate",
414
409
  {
415
410
  description:
416
- "Re-run the mouse scale probe (auto-runs at startup). Verifies relative mouse counts map 1:1 to pixels; reports pointer-ballistics misconfiguration.",
411
+ "Run the mouse scale probe. Verifies relative mouse counts map 1:1 to pixels; reports pointer-ballistics misconfiguration. " +
412
+ "Auto-runs on first click/move_mouse if not already calibrated; call this tool explicitly to re-run.",
417
413
  },
418
414
  async () => text(JSON.stringify(await session.calibrate())),
419
415
  );
package/src/session.ts CHANGED
@@ -54,9 +54,20 @@ export interface CalibrationResult {
54
54
  export class Session {
55
55
  lastShot: ShotMapping | null = null;
56
56
  calibration: CalibrationResult | null = null;
57
+ private _calibrating = false;
57
58
 
58
59
  constructor(readonly client: RebindRemote) {}
59
60
 
61
+ async ensureCalibrated(): Promise<void> {
62
+ if (this.calibration !== null || this._calibrating) return;
63
+ this._calibrating = true;
64
+ try {
65
+ await this.calibrate();
66
+ } finally {
67
+ this._calibrating = false;
68
+ }
69
+ }
70
+
60
71
  /** map a point in the last screenshot's image space to screen coords. */
61
72
  mapImagePoint(ix: number, iy: number): Point {
62
73
  if (!this.lastShot) {
@@ -83,6 +94,7 @@ export class Session {
83
94
  * the true cursor. Converges to the exact pixel, usually in a single pass.
84
95
  */
85
96
  async moveTo(x: number, y: number): Promise<Point & { passes: number }> {
97
+ await this.ensureCalibrated();
86
98
  let at = await this.client.systemMouse();
87
99
  let passes = 0;
88
100
  while (passes < MOVE_MAX_PASSES) {