Skip to content

Commit 7f98103

Browse files
committed
initial
0 parents  commit 7f98103

File tree

13 files changed

+614
-0
lines changed

13 files changed

+614
-0
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/commit.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/** @type {import('@changesets/types').CommitFunctions["getAddMessage"]} */
2+
module.exports.getAddMessage = async (changeset) => {
3+
return changeset.summary;
4+
};

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.4/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": "./commit.cjs",
5+
"fixed": [["opencontrol"]],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "master",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/sixty-paths-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"opencontrol": patch
3+
---
4+
5+
initial

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/node_modules
2+
.sst
3+
.env
4+
dist
5+
persist.json
6+
.DS_Store
7+
notes
8+
.nvim.lua
9+
.svelte-kit

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# mcp
2+
3+
To install dependencies:
4+
5+
```bash
6+
bun install
7+
```
8+
9+
To run:
10+
11+
```bash
12+
bun run index.ts
13+
```
14+
15+
This project was created using `bun init` in bun v1.2.4. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.

bun.lock

Lines changed: 422 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bunfig.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[install]
2+
exact = true

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "opencontrol",
3+
"private": true,
4+
"type": "module",
5+
"workspaces": [
6+
"packages/*"
7+
],
8+
"devDependencies": {
9+
"@tsconfig/node22": "22.0.0",
10+
"@types/node": "22.13.9",
11+
"typescript": "5.8.2"
12+
},
13+
"dependencies": {
14+
"@changesets/cli": "2.28.1"
15+
}
16+
}

packages/opencontrol/bin/index.mjs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env node
2+
3+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5+
const server = new Server({
6+
name: "opencontrol",
7+
version: "0.0.1",
8+
});
9+
10+
class ProxyTransport {
11+
#stdio = new StdioServerTransport();
12+
async start() {
13+
this.#stdio.onmessage = (message) => {
14+
if ("id" in message) {
15+
fetch(process.argv[2] + "/mcp", {
16+
method: "POST",
17+
headers: {
18+
"Content-Type": "application/json",
19+
...(process.env.OPENCONTROL_KEY
20+
? { Authorization: `Bearer ${process.env.OPENCONTROL_KEY}` }
21+
: {}),
22+
},
23+
body: JSON.stringify(message),
24+
}).then(async (response) => this.send(await response.json()));
25+
return;
26+
}
27+
this.#stdio.send(message);
28+
};
29+
this.#stdio.onerror = (error) => {
30+
this.onerror?.(error);
31+
};
32+
await this.#stdio.start();
33+
}
34+
async send(message) {
35+
return this.#stdio.send(message);
36+
}
37+
close() {
38+
return this.#stdio.close();
39+
}
40+
onclose;
41+
onerror;
42+
onmessage;
43+
}
44+
await server.connect(new ProxyTransport());

0 commit comments

Comments
 (0)