@oharness/engine 0.1.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.
- package/dist/agent/agent.d.ts +196 -0
- package/dist/agent/agent.js +758 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/compaction.d.ts +68 -0
- package/dist/agent/compaction.js +179 -0
- package/dist/agent/compaction.js.map +1 -0
- package/dist/agent/hooks.d.ts +77 -0
- package/dist/agent/hooks.js +152 -0
- package/dist/agent/hooks.js.map +1 -0
- package/dist/agent/memory.d.ts +45 -0
- package/dist/agent/memory.js +147 -0
- package/dist/agent/memory.js.map +1 -0
- package/dist/agent/overflow.d.ts +35 -0
- package/dist/agent/overflow.js +69 -0
- package/dist/agent/overflow.js.map +1 -0
- package/dist/agent/permissions.d.ts +181 -0
- package/dist/agent/permissions.js +289 -0
- package/dist/agent/permissions.js.map +1 -0
- package/dist/agent/prompt.d.ts +25 -0
- package/dist/agent/prompt.js +63 -0
- package/dist/agent/prompt.js.map +1 -0
- package/dist/agent/session.d.ts +108 -0
- package/dist/agent/session.js +231 -0
- package/dist/agent/session.js.map +1 -0
- package/dist/agent/settings.d.ts +37 -0
- package/dist/agent/settings.js +113 -0
- package/dist/agent/settings.js.map +1 -0
- package/dist/agent/skills.d.ts +58 -0
- package/dist/agent/skills.js +225 -0
- package/dist/agent/skills.js.map +1 -0
- package/dist/agent/store.d.ts +308 -0
- package/dist/agent/store.js +596 -0
- package/dist/agent/store.js.map +1 -0
- package/dist/agent/subagent.d.ts +44 -0
- package/dist/agent/subagent.js +138 -0
- package/dist/agent/subagent.js.map +1 -0
- package/dist/agent/titles.d.ts +8 -0
- package/dist/agent/titles.js +23 -0
- package/dist/agent/titles.js.map +1 -0
- package/dist/agent/workspace.d.ts +60 -0
- package/dist/agent/workspace.js +156 -0
- package/dist/agent/workspace.js.map +1 -0
- package/dist/artifacts/publish.d.ts +94 -0
- package/dist/artifacts/publish.js +104 -0
- package/dist/artifacts/publish.js.map +1 -0
- package/dist/artifacts/store.d.ts +324 -0
- package/dist/artifacts/store.js +500 -0
- package/dist/artifacts/store.js.map +1 -0
- package/dist/auth/index.d.ts +13 -0
- package/dist/auth/index.js +10 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/manager.d.ts +83 -0
- package/dist/auth/manager.js +266 -0
- package/dist/auth/manager.js.map +1 -0
- package/dist/auth/oauth.d.ts +83 -0
- package/dist/auth/oauth.js +327 -0
- package/dist/auth/oauth.js.map +1 -0
- package/dist/auth/providers/account.d.ts +59 -0
- package/dist/auth/providers/account.js +282 -0
- package/dist/auth/providers/account.js.map +1 -0
- package/dist/auth/providers/anthropic.d.ts +24 -0
- package/dist/auth/providers/anthropic.js +209 -0
- package/dist/auth/providers/anthropic.js.map +1 -0
- package/dist/auth/providers/generic.d.ts +57 -0
- package/dist/auth/providers/generic.js +155 -0
- package/dist/auth/providers/generic.js.map +1 -0
- package/dist/auth/providers/official.d.ts +3 -0
- package/dist/auth/providers/official.js +90 -0
- package/dist/auth/providers/official.js.map +1 -0
- package/dist/auth/providers/ottoport.d.ts +3 -0
- package/dist/auth/providers/ottoport.js +60 -0
- package/dist/auth/providers/ottoport.js.map +1 -0
- package/dist/auth/store.d.ts +22 -0
- package/dist/auth/store.js +138 -0
- package/dist/auth/store.js.map +1 -0
- package/dist/auth/types.d.ts +167 -0
- package/dist/auth/types.js +16 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/config.d.ts +197 -0
- package/dist/config.js +195 -0
- package/dist/config.js.map +1 -0
- package/dist/core/errors.d.ts +46 -0
- package/dist/core/errors.js +83 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/tokens.d.ts +12 -0
- package/dist/core/tokens.js +56 -0
- package/dist/core/tokens.js.map +1 -0
- package/dist/core/types.d.ts +91 -0
- package/dist/core/types.js +49 -0
- package/dist/core/types.js.map +1 -0
- package/dist/harness.d.ts +302 -0
- package/dist/harness.js +695 -0
- package/dist/harness.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/client.d.ts +55 -0
- package/dist/mcp/client.js +199 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/index.d.ts +13 -0
- package/dist/mcp/index.js +8 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/manager.d.ts +77 -0
- package/dist/mcp/manager.js +325 -0
- package/dist/mcp/manager.js.map +1 -0
- package/dist/mcp/oauth.d.ts +63 -0
- package/dist/mcp/oauth.js +302 -0
- package/dist/mcp/oauth.js.map +1 -0
- package/dist/mcp/protocol.d.ts +130 -0
- package/dist/mcp/protocol.js +14 -0
- package/dist/mcp/protocol.js.map +1 -0
- package/dist/mcp/registry.d.ts +52 -0
- package/dist/mcp/registry.js +100 -0
- package/dist/mcp/registry.js.map +1 -0
- package/dist/mcp/registry.json +293 -0
- package/dist/mcp/secrets.d.ts +20 -0
- package/dist/mcp/secrets.js +75 -0
- package/dist/mcp/secrets.js.map +1 -0
- package/dist/mcp/transport.d.ts +51 -0
- package/dist/mcp/transport.js +158 -0
- package/dist/mcp/transport.js.map +1 -0
- package/dist/paths.d.ts +37 -0
- package/dist/paths.js +63 -0
- package/dist/paths.js.map +1 -0
- package/dist/plugins.d.ts +55 -0
- package/dist/plugins.js +201 -0
- package/dist/plugins.js.map +1 -0
- package/dist/providers/builtin.d.ts +23 -0
- package/dist/providers/builtin.js +141 -0
- package/dist/providers/builtin.js.map +1 -0
- package/dist/providers/catalog.d.ts +129 -0
- package/dist/providers/catalog.js +254 -0
- package/dist/providers/catalog.js.map +1 -0
- package/dist/providers/catalog.json +472 -0
- package/dist/providers/discovery.d.ts +16 -0
- package/dist/providers/discovery.js +161 -0
- package/dist/providers/discovery.js.map +1 -0
- package/dist/providers/http.d.ts +24 -0
- package/dist/providers/http.js +139 -0
- package/dist/providers/http.js.map +1 -0
- package/dist/providers/index.d.ts +10 -0
- package/dist/providers/index.js +8 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/piai.d.ts +124 -0
- package/dist/providers/piai.js +551 -0
- package/dist/providers/piai.js.map +1 -0
- package/dist/providers/registry.d.ts +65 -0
- package/dist/providers/registry.js +195 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/resilient.d.ts +46 -0
- package/dist/providers/resilient.js +117 -0
- package/dist/providers/resilient.js.map +1 -0
- package/dist/providers/types.d.ts +182 -0
- package/dist/providers/types.js +50 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/schedule/cron.d.ts +35 -0
- package/dist/schedule/cron.js +125 -0
- package/dist/schedule/cron.js.map +1 -0
- package/dist/schedule/scheduler.d.ts +87 -0
- package/dist/schedule/scheduler.js +237 -0
- package/dist/schedule/scheduler.js.map +1 -0
- package/dist/storage/kv.d.ts +56 -0
- package/dist/storage/kv.js +173 -0
- package/dist/storage/kv.js.map +1 -0
- package/dist/storage/migrate.d.ts +11 -0
- package/dist/storage/migrate.js +93 -0
- package/dist/storage/migrate.js.map +1 -0
- package/dist/storage/project.d.ts +9 -0
- package/dist/storage/project.js +57 -0
- package/dist/storage/project.js.map +1 -0
- package/dist/storage/records.d.ts +32 -0
- package/dist/storage/records.js +48 -0
- package/dist/storage/records.js.map +1 -0
- package/dist/sync/client.d.ts +79 -0
- package/dist/sync/client.js +118 -0
- package/dist/sync/client.js.map +1 -0
- package/dist/sync/mirror.d.ts +85 -0
- package/dist/sync/mirror.js +389 -0
- package/dist/sync/mirror.js.map +1 -0
- package/dist/sync/protocol.d.ts +67 -0
- package/dist/sync/protocol.js +16 -0
- package/dist/sync/protocol.js.map +1 -0
- package/dist/sync/settings.d.ts +56 -0
- package/dist/sync/settings.js +60 -0
- package/dist/sync/settings.js.map +1 -0
- package/dist/tools/builtin/artifact.d.ts +16 -0
- package/dist/tools/builtin/artifact.js +134 -0
- package/dist/tools/builtin/artifact.js.map +1 -0
- package/dist/tools/builtin/bash.d.ts +3 -0
- package/dist/tools/builtin/bash.js +142 -0
- package/dist/tools/builtin/bash.js.map +1 -0
- package/dist/tools/builtin/fs.d.ts +19 -0
- package/dist/tools/builtin/fs.js +280 -0
- package/dist/tools/builtin/fs.js.map +1 -0
- package/dist/tools/builtin/index.d.ts +22 -0
- package/dist/tools/builtin/index.js +42 -0
- package/dist/tools/builtin/index.js.map +1 -0
- package/dist/tools/builtin/mcp-resource.d.ts +3 -0
- package/dist/tools/builtin/mcp-resource.js +220 -0
- package/dist/tools/builtin/mcp-resource.js.map +1 -0
- package/dist/tools/builtin/memory.d.ts +10 -0
- package/dist/tools/builtin/memory.js +76 -0
- package/dist/tools/builtin/memory.js.map +1 -0
- package/dist/tools/builtin/recall.d.ts +13 -0
- package/dist/tools/builtin/recall.js +163 -0
- package/dist/tools/builtin/recall.js.map +1 -0
- package/dist/tools/builtin/search.d.ts +3 -0
- package/dist/tools/builtin/search.js +240 -0
- package/dist/tools/builtin/search.js.map +1 -0
- package/dist/tools/builtin/skill.d.ts +10 -0
- package/dist/tools/builtin/skill.js +46 -0
- package/dist/tools/builtin/skill.js.map +1 -0
- package/dist/tools/builtin/task.d.ts +9 -0
- package/dist/tools/builtin/task.js +68 -0
- package/dist/tools/builtin/task.js.map +1 -0
- package/dist/tools/builtin/todo.d.ts +20 -0
- package/dist/tools/builtin/todo.js +63 -0
- package/dist/tools/builtin/todo.js.map +1 -0
- package/dist/tools/define.d.ts +19 -0
- package/dist/tools/define.js +39 -0
- package/dist/tools/define.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.js +5 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +39 -0
- package/dist/tools/registry.js +101 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +112 -0
- package/dist/tools/types.js +22 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/util/id.d.ts +9 -0
- package/dist/util/id.js +19 -0
- package/dist/util/id.js.map +1 -0
- package/dist/util/json.d.ts +25 -0
- package/dist/util/json.js +100 -0
- package/dist/util/json.js.map +1 -0
- package/dist/util/jwt.d.ts +74 -0
- package/dist/util/jwt.js +177 -0
- package/dist/util/jwt.js.map +1 -0
- package/dist/util/logger.d.ts +13 -0
- package/dist/util/logger.js +59 -0
- package/dist/util/logger.js.map +1 -0
- package/dist/util/queue.d.ts +26 -0
- package/dist/util/queue.js +106 -0
- package/dist/util/queue.js.map +1 -0
- package/dist/util/schema.d.ts +17 -0
- package/dist/util/schema.js +98 -0
- package/dist/util/schema.js.map +1 -0
- package/dist/util/shell.d.ts +20 -0
- package/dist/util/shell.js +24 -0
- package/dist/util/shell.js.map +1 -0
- package/official.json +4 -0
- package/package.json +38 -0
- package/skills/artifact-authoring/SKILL.md +81 -0
- package/skills/canvas/SKILL.md +85 -0
- package/skills/skill-authoring/SKILL.md +85 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": [
|
|
3
|
+
"Connector registry. This is DATA, not code — edit it without touching the harness.",
|
|
4
|
+
"",
|
|
5
|
+
"Precedence, later wins:",
|
|
6
|
+
" 1. this bundled file",
|
|
7
|
+
" 2. ~/.oharness/connectors.json",
|
|
8
|
+
" 3. OHARNESS_CONNECTORS, if set, in place of (2)",
|
|
9
|
+
"",
|
|
10
|
+
"WHAT BELONGS HERE. Not a directory — there are registries with five figures",
|
|
11
|
+
"of servers in them and this will never be one. It is a starting point, so",
|
|
12
|
+
"the bar is: published by whoever owns the data it exposes (no repackagers,",
|
|
13
|
+
"no middlemen), reachable over streamable HTTP or runnable from a package",
|
|
14
|
+
"manager already present, and usable after one click or one named variable.",
|
|
15
|
+
"Anything else is one line in (2), which is the same shape as this file.",
|
|
16
|
+
"",
|
|
17
|
+
"The list being short is not the list being the limit. Any server that",
|
|
18
|
+
"follows the spec works whether or not it has a row here: a remote one",
|
|
19
|
+
"answers 401, the challenge names its authorization server, a client gets",
|
|
20
|
+
"registered against it on the spot, and the tokens land in auth.json under",
|
|
21
|
+
"0600. Rows here save you a URL, nothing more.",
|
|
22
|
+
"",
|
|
23
|
+
"STREAMABLE HTTP ONLY. The `/sse` endpoints several vendors still publish",
|
|
24
|
+
"are the older two-channel transport, which this harness does not speak.",
|
|
25
|
+
"Every vendor below that has one also serves the same server at a streamable",
|
|
26
|
+
"HTTP path, and that is the URL used here.",
|
|
27
|
+
"",
|
|
28
|
+
"SECRETS. Nothing here carries one and nothing here should. Servers that log",
|
|
29
|
+
"in do it through the browser. A server that wants a plain API key instead",
|
|
30
|
+
"says ${env:NAME} — in a header, an argument, a URL, or a child process's",
|
|
31
|
+
"environment. The reference is what gets written to the config file and the",
|
|
32
|
+
"value is read from the environment at connect time, so a config that is",
|
|
33
|
+
"shared, synced or committed never contains the key. Entries that need one",
|
|
34
|
+
"say so in the menu before they are picked, not after.",
|
|
35
|
+
"",
|
|
36
|
+
"`siteUrl` is where the menu goes looking for the vendor's icon. The server fetches it once and caches it, so the page itself never talks to a third party; an entry without one, or whose site has no usable icon, draws a monogram instead.",
|
|
37
|
+
"",
|
|
38
|
+
"`${project}` is replaced with the session's working directory and `${home}`",
|
|
39
|
+
"with the home directory when the server is started.",
|
|
40
|
+
"",
|
|
41
|
+
"`npx` entries need Node, which is already running. `uvx` entries need uv",
|
|
42
|
+
"(https://docs.astral.sh/uv); a missing runtime is reported when the",
|
|
43
|
+
"connector fails to start rather than hidden here.",
|
|
44
|
+
"",
|
|
45
|
+
"`verified` is the day `node script/verify-connectors.ts` last reported every",
|
|
46
|
+
"remote entry below reachable, with a discoverable authorization server and,",
|
|
47
|
+
"where it logs in through the browser, dynamic client registration. These",
|
|
48
|
+
"move; re-run it rather than trusting the date."
|
|
49
|
+
],
|
|
50
|
+
"verified": "2026-08-21",
|
|
51
|
+
"connectors": {
|
|
52
|
+
"filesystem": {
|
|
53
|
+
"label": "Filesystem",
|
|
54
|
+
"publisher": "Model Context Protocol",
|
|
55
|
+
"description": "Read, write and search files under one directory — the project, unless you change it",
|
|
56
|
+
"docsUrl": "https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem",
|
|
57
|
+
"siteUrl": "https://modelcontextprotocol.io",
|
|
58
|
+
"config": {
|
|
59
|
+
"type": "stdio",
|
|
60
|
+
"command": "npx",
|
|
61
|
+
"args": [
|
|
62
|
+
"-y",
|
|
63
|
+
"@modelcontextprotocol/server-filesystem",
|
|
64
|
+
"${project}"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"memory": {
|
|
69
|
+
"label": "Memory",
|
|
70
|
+
"publisher": "Model Context Protocol",
|
|
71
|
+
"description": "A knowledge graph the agent can write to and read back in later sessions",
|
|
72
|
+
"docsUrl": "https://github.com/modelcontextprotocol/servers/tree/main/src/memory",
|
|
73
|
+
"siteUrl": "https://modelcontextprotocol.io",
|
|
74
|
+
"config": {
|
|
75
|
+
"type": "stdio",
|
|
76
|
+
"command": "npx",
|
|
77
|
+
"args": [
|
|
78
|
+
"-y",
|
|
79
|
+
"@modelcontextprotocol/server-memory"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"sequential-thinking": {
|
|
84
|
+
"label": "Sequential thinking",
|
|
85
|
+
"publisher": "Model Context Protocol",
|
|
86
|
+
"description": "A scratchpad for working a problem through in steps, revising as it goes",
|
|
87
|
+
"docsUrl": "https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking",
|
|
88
|
+
"siteUrl": "https://modelcontextprotocol.io",
|
|
89
|
+
"config": {
|
|
90
|
+
"type": "stdio",
|
|
91
|
+
"command": "npx",
|
|
92
|
+
"args": [
|
|
93
|
+
"-y",
|
|
94
|
+
"@modelcontextprotocol/server-sequential-thinking"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"fetch": {
|
|
99
|
+
"label": "Fetch",
|
|
100
|
+
"publisher": "Model Context Protocol",
|
|
101
|
+
"description": "Fetch a URL and convert it to markdown for reading",
|
|
102
|
+
"docsUrl": "https://github.com/modelcontextprotocol/servers/tree/main/src/fetch",
|
|
103
|
+
"siteUrl": "https://modelcontextprotocol.io",
|
|
104
|
+
"config": {
|
|
105
|
+
"type": "stdio",
|
|
106
|
+
"command": "uvx",
|
|
107
|
+
"args": [
|
|
108
|
+
"mcp-server-fetch"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"git": {
|
|
113
|
+
"label": "Git",
|
|
114
|
+
"publisher": "Model Context Protocol",
|
|
115
|
+
"description": "Read history, diffs and blame in this repository",
|
|
116
|
+
"docsUrl": "https://github.com/modelcontextprotocol/servers/tree/main/src/git",
|
|
117
|
+
"siteUrl": "https://modelcontextprotocol.io",
|
|
118
|
+
"config": {
|
|
119
|
+
"type": "stdio",
|
|
120
|
+
"command": "uvx",
|
|
121
|
+
"args": [
|
|
122
|
+
"mcp-server-git",
|
|
123
|
+
"--repository",
|
|
124
|
+
"${project}"
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"time": {
|
|
129
|
+
"label": "Time",
|
|
130
|
+
"publisher": "Model Context Protocol",
|
|
131
|
+
"description": "The current time in any timezone, and conversions between them",
|
|
132
|
+
"docsUrl": "https://github.com/modelcontextprotocol/servers/tree/main/src/time",
|
|
133
|
+
"siteUrl": "https://modelcontextprotocol.io",
|
|
134
|
+
"config": {
|
|
135
|
+
"type": "stdio",
|
|
136
|
+
"command": "uvx",
|
|
137
|
+
"args": [
|
|
138
|
+
"mcp-server-time"
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"everything": {
|
|
143
|
+
"label": "Everything",
|
|
144
|
+
"publisher": "Model Context Protocol",
|
|
145
|
+
"description": "The reference server: one of every MCP feature, for trying the wiring out",
|
|
146
|
+
"docsUrl": "https://github.com/modelcontextprotocol/servers/tree/main/src/everything",
|
|
147
|
+
"siteUrl": "https://modelcontextprotocol.io",
|
|
148
|
+
"config": {
|
|
149
|
+
"type": "stdio",
|
|
150
|
+
"command": "npx",
|
|
151
|
+
"args": [
|
|
152
|
+
"-y",
|
|
153
|
+
"@modelcontextprotocol/server-everything"
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"linear": {
|
|
158
|
+
"label": "Linear",
|
|
159
|
+
"publisher": "Linear",
|
|
160
|
+
"description": "Issues, projects and cycles — read them, file them, move them along",
|
|
161
|
+
"docsUrl": "https://linear.app/docs/mcp",
|
|
162
|
+
"siteUrl": "https://linear.app",
|
|
163
|
+
"config": {
|
|
164
|
+
"type": "http",
|
|
165
|
+
"url": "https://mcp.linear.app/mcp"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"notion": {
|
|
169
|
+
"label": "Notion",
|
|
170
|
+
"publisher": "Notion",
|
|
171
|
+
"description": "Search the workspace, read pages and databases, and write back to them",
|
|
172
|
+
"docsUrl": "https://developers.notion.com/docs/mcp",
|
|
173
|
+
"siteUrl": "https://www.notion.com",
|
|
174
|
+
"config": {
|
|
175
|
+
"type": "http",
|
|
176
|
+
"url": "https://mcp.notion.com/mcp"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"sentry": {
|
|
180
|
+
"label": "Sentry",
|
|
181
|
+
"publisher": "Sentry",
|
|
182
|
+
"description": "Issues, events and stack traces from your projects, with the context around them",
|
|
183
|
+
"docsUrl": "https://docs.sentry.io/product/sentry-mcp/",
|
|
184
|
+
"siteUrl": "https://sentry.io",
|
|
185
|
+
"config": {
|
|
186
|
+
"type": "http",
|
|
187
|
+
"url": "https://mcp.sentry.dev/mcp"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"asana": {
|
|
191
|
+
"label": "Asana",
|
|
192
|
+
"publisher": "Asana",
|
|
193
|
+
"description": "Tasks, projects and workloads across the workspaces you can see",
|
|
194
|
+
"docsUrl": "https://developers.asana.com/docs/mcp-server",
|
|
195
|
+
"siteUrl": "https://asana.com",
|
|
196
|
+
"config": {
|
|
197
|
+
"type": "http",
|
|
198
|
+
"url": "https://mcp.asana.com/mcp"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"deepwiki": {
|
|
202
|
+
"label": "DeepWiki",
|
|
203
|
+
"publisher": "Cognition",
|
|
204
|
+
"description": "Ask questions about any public GitHub repository and get answers with sources",
|
|
205
|
+
"docsUrl": "https://docs.devin.ai/work-with-devin/deepwiki-mcp",
|
|
206
|
+
"siteUrl": "https://deepwiki.com",
|
|
207
|
+
"config": {
|
|
208
|
+
"type": "http",
|
|
209
|
+
"url": "https://mcp.deepwiki.com/mcp"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"huggingface": {
|
|
213
|
+
"label": "Hugging Face",
|
|
214
|
+
"publisher": "Hugging Face",
|
|
215
|
+
"description": "Search models, datasets, papers and Spaces, and read their cards",
|
|
216
|
+
"docsUrl": "https://huggingface.co/settings/mcp",
|
|
217
|
+
"siteUrl": "https://huggingface.co",
|
|
218
|
+
"config": {
|
|
219
|
+
"type": "http",
|
|
220
|
+
"url": "https://huggingface.co/mcp"
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"github": {
|
|
224
|
+
"label": "GitHub",
|
|
225
|
+
"publisher": "GitHub",
|
|
226
|
+
"description": "Repositories, issues, pull requests and code search. Needs GITHUB_TOKEN",
|
|
227
|
+
"docsUrl": "https://github.com/github/github-mcp-server",
|
|
228
|
+
"siteUrl": "https://github.com",
|
|
229
|
+
"config": {
|
|
230
|
+
"type": "http",
|
|
231
|
+
"url": "https://api.githubcopilot.com/mcp/",
|
|
232
|
+
"headers": {
|
|
233
|
+
"authorization": "Bearer ${env:GITHUB_TOKEN}"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"supabase": {
|
|
238
|
+
"label": "Supabase",
|
|
239
|
+
"publisher": "Supabase",
|
|
240
|
+
"description": "Projects, tables, migrations, edge functions and logs",
|
|
241
|
+
"docsUrl": "https://supabase.com/docs/guides/getting-started/mcp",
|
|
242
|
+
"siteUrl": "https://supabase.com",
|
|
243
|
+
"config": {
|
|
244
|
+
"type": "http",
|
|
245
|
+
"url": "https://mcp.supabase.com/mcp"
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"vercel": {
|
|
249
|
+
"label": "Vercel",
|
|
250
|
+
"publisher": "Vercel",
|
|
251
|
+
"description": "Projects and deployments, with the build and runtime logs behind them",
|
|
252
|
+
"docsUrl": "https://vercel.com/docs/mcp/vercel-mcp",
|
|
253
|
+
"siteUrl": "https://vercel.com",
|
|
254
|
+
"config": {
|
|
255
|
+
"type": "http",
|
|
256
|
+
"url": "https://mcp.vercel.com"
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"atlassian": {
|
|
260
|
+
"label": "Atlassian",
|
|
261
|
+
"publisher": "Atlassian",
|
|
262
|
+
"description": "Jira issues and Confluence pages across the sites you can see",
|
|
263
|
+
"docsUrl": "https://support.atlassian.com/rovo/docs/setting-up-ides/",
|
|
264
|
+
"siteUrl": "https://www.atlassian.com",
|
|
265
|
+
"config": {
|
|
266
|
+
"type": "http",
|
|
267
|
+
"url": "https://mcp.atlassian.com/v1/mcp"
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
"figma": {
|
|
271
|
+
"label": "Figma",
|
|
272
|
+
"publisher": "Figma",
|
|
273
|
+
"description": "Read designs, frames and variables from files you have access to",
|
|
274
|
+
"docsUrl": "https://developers.figma.com/docs/figma-mcp-server/",
|
|
275
|
+
"siteUrl": "https://www.figma.com",
|
|
276
|
+
"config": {
|
|
277
|
+
"type": "http",
|
|
278
|
+
"url": "https://mcp.figma.com/mcp"
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
"stripe": {
|
|
282
|
+
"label": "Stripe",
|
|
283
|
+
"publisher": "Stripe",
|
|
284
|
+
"description": "Customers, payments and subscriptions, plus search across the docs",
|
|
285
|
+
"docsUrl": "https://docs.stripe.com/mcp",
|
|
286
|
+
"siteUrl": "https://stripe.com",
|
|
287
|
+
"config": {
|
|
288
|
+
"type": "http",
|
|
289
|
+
"url": "https://mcp.stripe.com"
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { McpServerConfig } from "./client.ts";
|
|
2
|
+
/** Every environment variable a configuration refers to, in source order. */
|
|
3
|
+
export declare function referencedSecrets(config: McpServerConfig): string[];
|
|
4
|
+
/**
|
|
5
|
+
* The referenced variables that are not set.
|
|
6
|
+
*
|
|
7
|
+
* Empty counts as missing: an unset key and a key set to "" fail the same way
|
|
8
|
+
* at the server, and reporting the second as configured sends the user looking
|
|
9
|
+
* in the wrong place.
|
|
10
|
+
*/
|
|
11
|
+
export declare function missingSecrets(config: McpServerConfig, env?: NodeJS.ProcessEnv): string[];
|
|
12
|
+
/**
|
|
13
|
+
* A copy of the configuration with its references resolved.
|
|
14
|
+
*
|
|
15
|
+
* A missing variable resolves to the empty string rather than throwing, so the
|
|
16
|
+
* failure lands where it is legible — the server rejecting an empty credential
|
|
17
|
+
* — but callers that can say something better should check `missingSecrets`
|
|
18
|
+
* first and never get here.
|
|
19
|
+
*/
|
|
20
|
+
export declare function expandSecrets(config: McpServerConfig, env?: NodeJS.ProcessEnv): McpServerConfig;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `${env:NAME}` in a server's configuration, resolved at connect time.
|
|
3
|
+
*
|
|
4
|
+
* The whole reason this is a placeholder and not a value is that an MCP
|
|
5
|
+
* configuration is a file on disk — in `~/.oharness/config.json`, or checked
|
|
6
|
+
* into a repository — and a bearer token written into one is a token that
|
|
7
|
+
* leaks with the file. Keeping the reference means the config stays shareable
|
|
8
|
+
* and the secret stays in the environment, where a keychain, a `.env` loader
|
|
9
|
+
* or a CI secret store can own it.
|
|
10
|
+
*
|
|
11
|
+
* This is the same syntax on every field that can carry one: a URL, a header,
|
|
12
|
+
* an argument, a child process's environment. A connector that wants an API
|
|
13
|
+
* key in a query string and one that wants it in a header should not need two
|
|
14
|
+
* different answers.
|
|
15
|
+
*/
|
|
16
|
+
const REFERENCE = /\$\{env:([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
17
|
+
/** Every environment variable a configuration refers to, in source order. */
|
|
18
|
+
export function referencedSecrets(config) {
|
|
19
|
+
const names = new Set();
|
|
20
|
+
for (const value of strings(config)) {
|
|
21
|
+
for (const match of value.matchAll(REFERENCE))
|
|
22
|
+
names.add(match[1]);
|
|
23
|
+
}
|
|
24
|
+
return [...names];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The referenced variables that are not set.
|
|
28
|
+
*
|
|
29
|
+
* Empty counts as missing: an unset key and a key set to "" fail the same way
|
|
30
|
+
* at the server, and reporting the second as configured sends the user looking
|
|
31
|
+
* in the wrong place.
|
|
32
|
+
*/
|
|
33
|
+
export function missingSecrets(config, env = process.env) {
|
|
34
|
+
return referencedSecrets(config).filter((name) => !env[name]);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A copy of the configuration with its references resolved.
|
|
38
|
+
*
|
|
39
|
+
* A missing variable resolves to the empty string rather than throwing, so the
|
|
40
|
+
* failure lands where it is legible — the server rejecting an empty credential
|
|
41
|
+
* — but callers that can say something better should check `missingSecrets`
|
|
42
|
+
* first and never get here.
|
|
43
|
+
*/
|
|
44
|
+
export function expandSecrets(config, env = process.env) {
|
|
45
|
+
const fill = (value) => value.replace(REFERENCE, (_, name) => env[name] ?? "");
|
|
46
|
+
const fillAll = (values) => Object.fromEntries(Object.entries(values).map(([key, value]) => [key, fill(value)]));
|
|
47
|
+
if (config.type === "http") {
|
|
48
|
+
return {
|
|
49
|
+
...config,
|
|
50
|
+
url: fill(config.url),
|
|
51
|
+
...(config.headers ? { headers: fillAll(config.headers) } : {}),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
...config,
|
|
56
|
+
command: fill(config.command),
|
|
57
|
+
...(config.args ? { args: config.args.map(fill) } : {}),
|
|
58
|
+
...(config.cwd ? { cwd: fill(config.cwd) } : {}),
|
|
59
|
+
...(config.env ? { env: fillAll(config.env) } : {}),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** Every string field that may carry a reference. */
|
|
63
|
+
function* strings(config) {
|
|
64
|
+
if (config.type === "http") {
|
|
65
|
+
yield config.url;
|
|
66
|
+
yield* Object.values(config.headers ?? {});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
yield config.command;
|
|
70
|
+
yield* config.args ?? [];
|
|
71
|
+
if (config.cwd)
|
|
72
|
+
yield config.cwd;
|
|
73
|
+
yield* Object.values(config.env ?? {});
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=secrets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../src/mcp/secrets.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,SAAS,GAAG,qCAAqC,CAAC;AAExD,6EAA6E;AAC7E,MAAM,UAAU,iBAAiB,CAAC,MAAuB;IACvD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;YAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;AACpB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,MAAuB,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG;IACvE,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;GAOG;AACH,MAA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AAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC;AAED,qDAAqD;AACrD,QAAQ,CAAC,CAAC,OAAO,CAAC,MAAuB;IACvC,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC3B,MAAM,MAAM,CAAC,GAAG,CAAC;QACjB,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QAC3C,OAAO;IACT,CAAC;IACD,MAAM,MAAM,CAAC,OAAO,CAAC;IACrB,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IACzB,IAAI,MAAM,CAAC,GAAG;QAAE,MAAM,MAAM,CAAC,GAAG,CAAC;IACjC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { JsonRpcMessage } from "./protocol.ts";
|
|
2
|
+
export interface Transport {
|
|
3
|
+
readonly kind: "stdio" | "http";
|
|
4
|
+
start(onMessage: (msg: JsonRpcMessage) => void, onClose: (reason?: string) => void): Promise<void>;
|
|
5
|
+
send(message: JsonRpcMessage): Promise<void>;
|
|
6
|
+
close(): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export interface StdioTransportOptions {
|
|
9
|
+
command: string;
|
|
10
|
+
args?: string[];
|
|
11
|
+
env?: Record<string, string>;
|
|
12
|
+
cwd?: string;
|
|
13
|
+
serverName: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class StdioTransport implements Transport {
|
|
16
|
+
readonly kind = "stdio";
|
|
17
|
+
private child?;
|
|
18
|
+
private buffer;
|
|
19
|
+
private closed;
|
|
20
|
+
private readonly opts;
|
|
21
|
+
constructor(opts: StdioTransportOptions);
|
|
22
|
+
start(onMessage: (msg: JsonRpcMessage) => void, onClose: (reason?: string) => void): Promise<void>;
|
|
23
|
+
send(message: JsonRpcMessage): Promise<void>;
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export interface HttpTransportOptions {
|
|
27
|
+
url: string;
|
|
28
|
+
headers?: Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Headers resolved per request rather than at construction.
|
|
31
|
+
*
|
|
32
|
+
* Access tokens expire, so anything that captures one when the transport is
|
|
33
|
+
* built works until it abruptly does not. This is called on every send and
|
|
34
|
+
* owns its own refresh.
|
|
35
|
+
*/
|
|
36
|
+
auth?(): Promise<Record<string, string>>;
|
|
37
|
+
serverName: string;
|
|
38
|
+
timeoutMs?: number;
|
|
39
|
+
}
|
|
40
|
+
export declare class HttpTransport implements Transport {
|
|
41
|
+
readonly kind = "http";
|
|
42
|
+
private sessionId?;
|
|
43
|
+
private onMessage?;
|
|
44
|
+
private onClose?;
|
|
45
|
+
private closed;
|
|
46
|
+
private readonly opts;
|
|
47
|
+
constructor(opts: HttpTransportOptions);
|
|
48
|
+
start(onMessage: (msg: JsonRpcMessage) => void, onClose: (reason?: string) => void): Promise<void>;
|
|
49
|
+
send(message: JsonRpcMessage): Promise<void>;
|
|
50
|
+
close(): Promise<void>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { McpAuthRequiredError, McpError } from "../core/errors.js";
|
|
3
|
+
import { parseSse } from "../providers/http.js";
|
|
4
|
+
import { parseJson } from "../util/json.js";
|
|
5
|
+
export class StdioTransport {
|
|
6
|
+
kind = "stdio";
|
|
7
|
+
child;
|
|
8
|
+
buffer = "";
|
|
9
|
+
closed = false;
|
|
10
|
+
opts;
|
|
11
|
+
constructor(opts) {
|
|
12
|
+
this.opts = opts;
|
|
13
|
+
}
|
|
14
|
+
async start(onMessage, onClose) {
|
|
15
|
+
const child = spawn(this.opts.command, this.opts.args ?? [], {
|
|
16
|
+
cwd: this.opts.cwd,
|
|
17
|
+
// MCP servers commonly need PATH and HOME; merge rather than replace.
|
|
18
|
+
env: { ...process.env, ...this.opts.env },
|
|
19
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
20
|
+
});
|
|
21
|
+
this.child = child;
|
|
22
|
+
child.stdout.setEncoding("utf8");
|
|
23
|
+
child.stdout.on("data", (chunk) => {
|
|
24
|
+
this.buffer += chunk;
|
|
25
|
+
let newline;
|
|
26
|
+
while ((newline = this.buffer.indexOf("\n")) !== -1) {
|
|
27
|
+
const line = this.buffer.slice(0, newline).trim();
|
|
28
|
+
this.buffer = this.buffer.slice(newline + 1);
|
|
29
|
+
if (line === "")
|
|
30
|
+
continue;
|
|
31
|
+
const parsed = parseJson(line);
|
|
32
|
+
// Servers sometimes log to stdout; ignore anything that isn't JSON-RPC.
|
|
33
|
+
if (parsed.ok)
|
|
34
|
+
onMessage(parsed.value);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
// stderr is the server's log channel, not part of the protocol.
|
|
38
|
+
child.stderr.setEncoding("utf8");
|
|
39
|
+
child.stderr.on("data", () => { });
|
|
40
|
+
child.on("error", (err) => {
|
|
41
|
+
if (this.closed)
|
|
42
|
+
return;
|
|
43
|
+
this.closed = true;
|
|
44
|
+
onClose(`failed to start ${this.opts.command}: ${err.message}`);
|
|
45
|
+
});
|
|
46
|
+
child.on("close", (code) => {
|
|
47
|
+
if (this.closed)
|
|
48
|
+
return;
|
|
49
|
+
this.closed = true;
|
|
50
|
+
onClose(code === 0 ? undefined : `server exited with code ${code}`);
|
|
51
|
+
});
|
|
52
|
+
await new Promise((resolve, reject) => {
|
|
53
|
+
const timer = setTimeout(resolve, 100);
|
|
54
|
+
child.once("error", (err) => {
|
|
55
|
+
clearTimeout(timer);
|
|
56
|
+
reject(new McpError(this.opts.serverName, `spawn failed: ${err.message}`, err));
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
async send(message) {
|
|
61
|
+
if (!this.child || this.closed) {
|
|
62
|
+
throw new McpError(this.opts.serverName, "transport is not connected");
|
|
63
|
+
}
|
|
64
|
+
this.child.stdin.write(`${JSON.stringify(message)}\n`);
|
|
65
|
+
}
|
|
66
|
+
async close() {
|
|
67
|
+
this.closed = true;
|
|
68
|
+
this.child?.stdin.end();
|
|
69
|
+
this.child?.kill();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export class HttpTransport {
|
|
73
|
+
kind = "http";
|
|
74
|
+
sessionId;
|
|
75
|
+
onMessage;
|
|
76
|
+
onClose;
|
|
77
|
+
closed = false;
|
|
78
|
+
opts;
|
|
79
|
+
constructor(opts) {
|
|
80
|
+
this.opts = opts;
|
|
81
|
+
}
|
|
82
|
+
async start(onMessage, onClose) {
|
|
83
|
+
this.onMessage = onMessage;
|
|
84
|
+
this.onClose = onClose;
|
|
85
|
+
}
|
|
86
|
+
async send(message) {
|
|
87
|
+
if (this.closed)
|
|
88
|
+
throw new McpError(this.opts.serverName, "transport is closed");
|
|
89
|
+
// Applied last, so a credential obtained by logging in wins over a stale
|
|
90
|
+
// one left behind in a config file rather than being shadowed by it.
|
|
91
|
+
const auth = this.opts.auth ? await this.opts.auth() : {};
|
|
92
|
+
const response = await fetch(this.opts.url, {
|
|
93
|
+
method: "POST",
|
|
94
|
+
headers: {
|
|
95
|
+
"content-type": "application/json",
|
|
96
|
+
// Streamable HTTP servers may answer with either a JSON body or an
|
|
97
|
+
// SSE stream, and choose based on this header.
|
|
98
|
+
accept: "application/json, text/event-stream",
|
|
99
|
+
...(this.sessionId ? { "mcp-session-id": this.sessionId } : {}),
|
|
100
|
+
...this.opts.headers,
|
|
101
|
+
...auth,
|
|
102
|
+
},
|
|
103
|
+
body: JSON.stringify(message),
|
|
104
|
+
signal: AbortSignal.timeout(this.opts.timeoutMs ?? 120_000),
|
|
105
|
+
});
|
|
106
|
+
const session = response.headers.get("mcp-session-id");
|
|
107
|
+
if (session)
|
|
108
|
+
this.sessionId = session;
|
|
109
|
+
if (response.status === 401) {
|
|
110
|
+
// Not reported as a failure: it is the server asking who we are, and the
|
|
111
|
+
// challenge carries where that question gets answered.
|
|
112
|
+
await response.body?.cancel().catch(() => { });
|
|
113
|
+
throw new McpAuthRequiredError(this.opts.serverName, this.opts.url, response.headers.get("www-authenticate") ?? undefined);
|
|
114
|
+
}
|
|
115
|
+
if (!response.ok) {
|
|
116
|
+
const detail = await response.text().catch(() => "");
|
|
117
|
+
throw new McpError(this.opts.serverName, `HTTP ${response.status} ${response.statusText}: ${detail.slice(0, 400)}`);
|
|
118
|
+
}
|
|
119
|
+
// 202 Accepted is the normal reply to a notification.
|
|
120
|
+
if (response.status === 202)
|
|
121
|
+
return;
|
|
122
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
123
|
+
if (contentType.includes("text/event-stream") && response.body) {
|
|
124
|
+
for await (const event of parseSse(response.body)) {
|
|
125
|
+
if (event.data === "" || event.data === "[DONE]")
|
|
126
|
+
continue;
|
|
127
|
+
const parsed = parseJson(event.data);
|
|
128
|
+
if (parsed.ok)
|
|
129
|
+
this.onMessage?.(parsed.value);
|
|
130
|
+
}
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const text = await response.text();
|
|
134
|
+
if (text.trim() === "")
|
|
135
|
+
return;
|
|
136
|
+
const parsed = parseJson(text);
|
|
137
|
+
if (!parsed.ok) {
|
|
138
|
+
throw new McpError(this.opts.serverName, `invalid JSON response: ${parsed.error}`);
|
|
139
|
+
}
|
|
140
|
+
for (const msg of Array.isArray(parsed.value) ? parsed.value : [parsed.value]) {
|
|
141
|
+
this.onMessage?.(msg);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async close() {
|
|
145
|
+
if (this.closed)
|
|
146
|
+
return;
|
|
147
|
+
this.closed = true;
|
|
148
|
+
if (this.sessionId) {
|
|
149
|
+
// Best effort: tell the server it can release the session.
|
|
150
|
+
await fetch(this.opts.url, {
|
|
151
|
+
method: "DELETE",
|
|
152
|
+
headers: { "mcp-session-id": this.sessionId, ...this.opts.headers },
|
|
153
|
+
}).catch(() => { });
|
|
154
|
+
}
|
|
155
|
+
this.onClose?.();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/mcp/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAsB5C,MAAM,OAAO,cAAc;IAChB,IAAI,GAAG,OAAO,CAAC;IAChB,KAAK,CAAkC;IACvC,MAAM,GAAG,EAAE,CAAC;IACZ,MAAM,GAAG,KAAK,CAAC;IACN,IAAI,CAAwB;IAE7C,YAAY,IAA2B;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,KAAK,CACT,SAAwC,EACxC,OAAkC;QAElC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE;YAC3D,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG;YAClB,sEAAsE;YACtE,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YACzC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,KAAK,CAAC,MAAM,CAAC,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AAC,OAAO,EAAE;aACpE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACrB,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IACnB,CAAC;CACF"}
|
package/dist/paths.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where OHarness keeps everything that outlives a project: credentials,
|
|
3
|
+
* sessions, the model catalog, user-level skills, agents and plugins.
|
|
4
|
+
*
|
|
5
|
+
* One resolver, because nine call sites each computing `homedir()` themselves
|
|
6
|
+
* is how `OHARNESS_HOME` ended up honoured by the session store and ignored
|
|
7
|
+
* by the other eight — an escape hatch that only worked for one kind of data
|
|
8
|
+
* is worse than none, since it reads as if the whole thing is redirected.
|
|
9
|
+
*
|
|
10
|
+
* Set `OHARNESS_HOME` to redirect all of it. Developing on the harness
|
|
11
|
+
* itself should always set it (the repo's npm scripts do), so working on the
|
|
12
|
+
* tool never writes into the home directory of the person working on it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function userDir(): string;
|
|
15
|
+
/** A path inside the user directory, e.g. `userPath("sessions")`. */
|
|
16
|
+
export declare function userPath(...segments: string[]): string;
|
|
17
|
+
/**
|
|
18
|
+
* Project-local storage: `.oharness/` in the working directory.
|
|
19
|
+
*
|
|
20
|
+
* Kept separate from the user directory on purpose. Settings, skills and
|
|
21
|
+
* agents exist at both levels and the merge order between them is meaningful,
|
|
22
|
+
* so collapsing them into one path helper would blur a distinction the
|
|
23
|
+
* permission and skill layers depend on.
|
|
24
|
+
*/
|
|
25
|
+
export declare function projectPath(cwd: string, ...segments: string[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Expand a leading `~` the way a shell would, and leave everything else alone.
|
|
28
|
+
*
|
|
29
|
+
* Lives here rather than in the workspace policy because both the policy and
|
|
30
|
+
* the file tools need it and neither may import the other. A path the agent
|
|
31
|
+
* typed as `~/.oharness/skills` has to become the same string the shell would
|
|
32
|
+
* have produced, or a refusal message ends up naming a path that exists
|
|
33
|
+
* nowhere and the reader learns nothing from it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function expandHome(input: string): string;
|
|
36
|
+
/** Whether `target` is one of `roots` or sits underneath one. */
|
|
37
|
+
export declare function within(roots: readonly string[], target: string): boolean;
|