@openshain/mcp 0.4.0 → 0.4.1
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/server.js +4 -14
- package/package.json +3 -3
- package/src/server.ts +5 -16
package/dist/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { relative } from "node:path";
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
-
import { ASK_USER, compileInputValidator, countToolCalls, createToolCaller, createToolRegistry, DecisionFileSchema, isKnownEventType, isOpenshainError, isTerminal, loadAuthority, loadConfig, parsePayloadFile, parseWorkId, pendingApprovals, pendingQuestions, RUNTIME_PROVIDER_ID, resolveWorkspacePath, SESSION_WORK_TYPE, uuidv7, verifyArtifact, WorkStore, workHistory, writeDecision, } from "@openshain/core";
|
|
4
|
+
import { ASK_USER, businessDate, companyTime, compileInputValidator, countToolCalls, createToolCaller, createToolRegistry, DecisionFileSchema, isKnownEventType, isOpenshainError, isTerminal, loadAuthority, loadConfig, parsePayloadFile, parseWorkId, pendingApprovals, pendingQuestions, RUNTIME_PROVIDER_ID, resolveWorkspacePath, SESSION_WORK_TYPE, uuidv7, verifyArtifact, WorkStore, workHistory, writeDecision, } from "@openshain/core";
|
|
5
5
|
import pkg from "../package.json" with { type: "json" };
|
|
6
6
|
import { Session } from "./session.js";
|
|
7
7
|
/** The tools every session has, before the workspace's own. Their names are reserved in the runtime. */
|
|
@@ -386,11 +386,11 @@ export async function createMcpServer(options) {
|
|
|
386
386
|
}
|
|
387
387
|
case "context": {
|
|
388
388
|
const now = new Date();
|
|
389
|
-
const timezone =
|
|
389
|
+
const timezone = config.company.timezone;
|
|
390
390
|
const info = {
|
|
391
|
-
now:
|
|
391
|
+
now: companyTime(timezone, now),
|
|
392
392
|
timezone,
|
|
393
|
-
business_date:
|
|
393
|
+
business_date: businessDate(timezone, now),
|
|
394
394
|
workspace: workspaceRoot,
|
|
395
395
|
company: config.company.name,
|
|
396
396
|
principal: { id: config.principal.id, name: config.principal.name },
|
|
@@ -749,13 +749,3 @@ async function findApproval(works, approvalId) {
|
|
|
749
749
|
}
|
|
750
750
|
return undefined;
|
|
751
751
|
}
|
|
752
|
-
/** ISO 8601 with the local offset instead of Z, so the time reads as the person's clock. */
|
|
753
|
-
function localIso(date) {
|
|
754
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
755
|
-
const offset = -date.getTimezoneOffset();
|
|
756
|
-
const sign = offset >= 0 ? "+" : "-";
|
|
757
|
-
const abs = Math.abs(offset);
|
|
758
|
-
return (`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}` +
|
|
759
|
-
`T${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}` +
|
|
760
|
-
`${sign}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`);
|
|
761
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openshain/mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "MCP server that exposes an openshain workspace to any agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openshain",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
49
|
-
"@openshain/core": "0.4.
|
|
49
|
+
"@openshain/core": "0.4.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@openshain/tools": "0.4.
|
|
52
|
+
"@openshain/tools": "0.4.1"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
package/src/server.ts
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
type AnyEvent,
|
|
11
11
|
type Artifact,
|
|
12
12
|
ASK_USER,
|
|
13
|
+
businessDate,
|
|
14
|
+
companyTime,
|
|
13
15
|
compileInputValidator,
|
|
14
16
|
countToolCalls,
|
|
15
17
|
createToolCaller,
|
|
@@ -466,11 +468,11 @@ export async function createMcpServer(options: McpServerOptions): Promise<Server
|
|
|
466
468
|
}
|
|
467
469
|
case "context": {
|
|
468
470
|
const now = new Date();
|
|
469
|
-
const timezone =
|
|
471
|
+
const timezone = config.company.timezone;
|
|
470
472
|
const info = {
|
|
471
|
-
now:
|
|
473
|
+
now: companyTime(timezone, now),
|
|
472
474
|
timezone,
|
|
473
|
-
business_date:
|
|
475
|
+
business_date: businessDate(timezone, now),
|
|
474
476
|
workspace: workspaceRoot,
|
|
475
477
|
company: config.company.name,
|
|
476
478
|
principal: { id: config.principal.id, name: config.principal.name },
|
|
@@ -887,16 +889,3 @@ async function findApproval(
|
|
|
887
889
|
}
|
|
888
890
|
return undefined;
|
|
889
891
|
}
|
|
890
|
-
|
|
891
|
-
/** ISO 8601 with the local offset instead of Z, so the time reads as the person's clock. */
|
|
892
|
-
function localIso(date: Date): string {
|
|
893
|
-
const pad = (n: number) => String(n).padStart(2, "0");
|
|
894
|
-
const offset = -date.getTimezoneOffset();
|
|
895
|
-
const sign = offset >= 0 ? "+" : "-";
|
|
896
|
-
const abs = Math.abs(offset);
|
|
897
|
-
return (
|
|
898
|
-
`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}` +
|
|
899
|
-
`T${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}` +
|
|
900
|
-
`${sign}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`
|
|
901
|
-
);
|
|
902
|
-
}
|