@borgresearch/odin-mcp 0.1.0 → 0.3.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.
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Guidance the Odin MCP server gives to AI agents: the short server
3
+ * instructions sent when a client connects, and the longer prompts a user can
4
+ * run (or paste) to set up Odin and fix a finding. Kept free of Node APIs so
5
+ * the Odin web app can build the same text for its copy-to-agent prompt.
6
+ */
7
+ declare const ODIN_DOCS_URL = "https://docs.borghq.io";
8
+ declare const ODIN_DOCS_INDEX_URL = "https://docs.borghq.io/llms.txt";
9
+ declare const ODIN_AGENT_GUIDE_URL = "https://docs.borghq.io/platform/agent-guide.md";
10
+ /**
11
+ * What the user may do in Odin. `read` is the Read only role, `member` is
12
+ * Member, and `admin` covers Admin and Owner. Leave it unset when unknown.
13
+ */
14
+ type OdinAccess = "read" | "member" | "admin";
15
+ interface GuidanceOptions {
16
+ /** Public Odin origin used for links, e.g. https://odin.borghq.io. */
17
+ appUrl?: string;
18
+ }
19
+ /** Odin pages the setup guidance can send the user to. */
20
+ type OdinSetupPage = "integrations" | "prReviews" | "assets" | "team";
21
+ interface SetupPromptOptions extends GuidanceOptions {
22
+ access?: OdinAccess;
23
+ /**
24
+ * Pages switched on for the organisation. A page set to false is left out
25
+ * of the recommendations; an unknown page is assumed to be available.
26
+ */
27
+ pages?: Partial<Record<OdinSetupPage, boolean>>;
28
+ /**
29
+ * Markdown that tells the agent how to add the Odin MCP server. When set,
30
+ * the prompt starts with a connection step; when unset, the prompt assumes
31
+ * the Odin tools are already available (as when it runs as an MCP prompt).
32
+ */
33
+ connectInstructions?: string;
34
+ }
35
+ interface FixFindingPromptOptions extends GuidanceOptions {
36
+ /** Human identifier such as ODI-12. Unset means pick the most severe. */
37
+ finding?: string;
38
+ }
39
+ /**
40
+ * Short, always-loaded orientation for any agent that connects. Clients add
41
+ * this to every session's context, so it stays brief and leaves the
42
+ * step-by-step flows to the prompts.
43
+ */
44
+ declare function buildServerInstructions(options?: GuidanceOptions): string;
45
+ /**
46
+ * The setup walkthrough: connect, learn, inspect, recommend, reach a first
47
+ * result and remember Odin in the repository.
48
+ */
49
+ declare function buildSetupPrompt(options?: SetupPromptOptions): string;
50
+ /** One finding, from choice to a linked pull request awaiting retest. */
51
+ declare function buildFixFindingPrompt(options?: FixFindingPromptOptions): string;
52
+
53
+ export { type FixFindingPromptOptions, type GuidanceOptions, ODIN_AGENT_GUIDE_URL, ODIN_DOCS_INDEX_URL, ODIN_DOCS_URL, type OdinAccess, type OdinSetupPage, type SetupPromptOptions, buildFixFindingPrompt, buildServerInstructions, buildSetupPrompt };
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ ODIN_AGENT_GUIDE_URL,
4
+ ODIN_DOCS_INDEX_URL,
5
+ ODIN_DOCS_URL,
6
+ buildFixFindingPrompt,
7
+ buildServerInstructions,
8
+ buildSetupPrompt
9
+ } from "./chunk-4LCKW236.js";
10
+ export {
11
+ ODIN_AGENT_GUIDE_URL,
12
+ ODIN_DOCS_INDEX_URL,
13
+ ODIN_DOCS_URL,
14
+ buildFixFindingPrompt,
15
+ buildServerInstructions,
16
+ buildSetupPrompt
17
+ };
18
+ //# sourceMappingURL=guidance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/http.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { OdinClient } from './client.js';
2
+ import { OdinMcpServerOptions } from './server.js';
3
+ import '@modelcontextprotocol/sdk/server/mcp.js';
4
+
5
+ /** The host authenticates every request before calling this adapter. */
6
+ declare function handleOdinMcpRequest(request: Request, client: OdinClient, options?: OdinMcpServerOptions): Promise<Response>;
7
+
8
+ export { handleOdinMcpRequest };
package/dist/http.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ createOdinMcpServer
4
+ } from "./chunk-ODZB3YP2.js";
5
+ import "./chunk-4LCKW236.js";
6
+ import "./chunk-D5FYYTYV.js";
7
+ import "./chunk-XHJYVUHG.js";
8
+
9
+ // src/http.ts
10
+ import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
11
+ async function handleOdinMcpRequest(request, client, options = {}) {
12
+ if (request.method !== "POST") {
13
+ return Response.json(
14
+ { error: "This MCP endpoint supports POST requests only" },
15
+ { status: 405, headers: { Allow: "POST" } }
16
+ );
17
+ }
18
+ const server = createOdinMcpServer(client, options);
19
+ const transport = new WebStandardStreamableHTTPServerTransport({
20
+ sessionIdGenerator: void 0,
21
+ enableJsonResponse: true,
22
+ maxRequestBodySize: 1024 * 1024
23
+ });
24
+ try {
25
+ await server.connect(transport);
26
+ return await transport.handleRequest(request);
27
+ } finally {
28
+ await server.close();
29
+ }
30
+ }
31
+ export {
32
+ handleOdinMcpRequest
33
+ };
34
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/http.ts"],"sourcesContent":["import { WebStandardStreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js\";\nimport type { OdinClient } from \"./client.js\";\nimport { createOdinMcpServer, type OdinMcpServerOptions } from \"./server.js\";\n\n/** The host authenticates every request before calling this adapter. */\nexport async function handleOdinMcpRequest(\n request: Request,\n client: OdinClient,\n options: OdinMcpServerOptions = {},\n): Promise<Response> {\n if (request.method !== \"POST\") {\n return Response.json(\n { error: \"This MCP endpoint supports POST requests only\" },\n { status: 405, headers: { Allow: \"POST\" } },\n );\n }\n const server = createOdinMcpServer(client, options);\n const transport = new WebStandardStreamableHTTPServerTransport({\n sessionIdGenerator: undefined,\n enableJsonResponse: true,\n maxRequestBodySize: 1024 * 1024,\n });\n try {\n await server.connect(transport);\n return await transport.handleRequest(request);\n } finally {\n await server.close();\n }\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,gDAAgD;AAKzD,eAAsB,qBACpB,SACA,QACA,UAAgC,CAAC,GACd;AACnB,MAAI,QAAQ,WAAW,QAAQ;AAC7B,WAAO,SAAS;AAAA,MACd,EAAE,OAAO,gDAAgD;AAAA,MACzD,EAAE,QAAQ,KAAK,SAAS,EAAE,OAAO,OAAO,EAAE;AAAA,IAC5C;AAAA,EACF;AACA,QAAM,SAAS,oBAAoB,QAAQ,OAAO;AAClD,QAAM,YAAY,IAAI,yCAAyC;AAAA,IAC7D,oBAAoB;AAAA,IACpB,oBAAoB;AAAA,IACpB,oBAAoB,OAAO;AAAA,EAC7B,CAAC;AACD,MAAI;AACF,UAAM,OAAO,QAAQ,SAAS;AAC9B,WAAO,MAAM,UAAU,cAAc,OAAO;AAAA,EAC9C,UAAE;AACA,UAAM,OAAO,MAAM;AAAA,EACrB;AACF;","names":[]}