@shrkcrft/mcp-server 0.1.0-alpha.7 → 0.1.0-alpha.9
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/README.md +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/server/create-mcp-server.d.ts.map +1 -1
- package/dist/server/create-mcp-server.js +8 -2
- package/dist/server/http-transport.d.ts +7 -2
- package/dist/server/http-transport.d.ts.map +1 -1
- package/dist/server/http-transport.js +10 -6
- package/package.json +20 -21
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
SharkCraft MCP server: 25 tools over @modelcontextprotocol/sdk's stdio transport.
|
|
4
4
|
|
|
5
|
-
Part of [SharkCraft](https://github.com/
|
|
5
|
+
Part of [SharkCraft](https://github.com/sharkcraft/sharkcraft) — a deterministic, local-first toolkit that gives AI coding agents durable project context. See the main repo for documentation, examples, and the `shrk` CLI.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
package/dist/main.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-mcp-server.d.ts","sourceRoot":"","sources":["../../src/server/create-mcp-server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAQnE,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-mcp-server.d.ts","sourceRoot":"","sources":["../../src/server/create-mcp-server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAQnE,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEpF,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,eAAe,EAEf,eAAe,EAChB,MAAM,sB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3,6 +3,7 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
4
|
import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import { inspectSharkcraft } from '@shrkcrft/inspector';
|
|
6
|
+
import { initTokenizer } from '@shrkcrft/context';
|
|
6
7
|
import { MCP_SERVER_NAME, MCP_SERVER_VERSION, } from "./mcp-server-config.js";
|
|
7
8
|
import { ALL_TOOLS } from "../tools/index.js";
|
|
8
9
|
import { validateToolInput } from "./tool-input-validators.js";
|
|
@@ -140,6 +141,11 @@ export function createSharkcraftServer(config) {
|
|
|
140
141
|
export async function startMcpServer(options = {}) {
|
|
141
142
|
const cwd = resolveTargetRoot(options.cwd, options.projectRoot);
|
|
142
143
|
const verbose = options.verbose ?? false;
|
|
144
|
+
// Best-effort upgrade from the estimator to gpt-tokenizer. Failure leaves
|
|
145
|
+
// the estimator active — the server still serves requests.
|
|
146
|
+
if (process.env.SHARKCRAFT_NO_REAL_TOKENIZER !== '1') {
|
|
147
|
+
initTokenizer().catch(() => undefined);
|
|
148
|
+
}
|
|
143
149
|
const { server, state } = createSharkcraftServer({
|
|
144
150
|
name: MCP_SERVER_NAME,
|
|
145
151
|
version: MCP_SERVER_VERSION,
|
|
@@ -192,8 +198,8 @@ export async function startMcpServer(options = {}) {
|
|
|
192
198
|
};
|
|
193
199
|
process.on('SIGINT', () => void stop());
|
|
194
200
|
process.on('SIGTERM', () => void stop());
|
|
195
|
-
|
|
196
|
-
|
|
201
|
+
// Always announce the URL on stderr so the user knows where to connect.
|
|
202
|
+
process.stderr.write(`[mcp] http endpoint: ${handle.url}\n`);
|
|
197
203
|
return;
|
|
198
204
|
}
|
|
199
205
|
const transport = new StdioServerTransport();
|
|
@@ -2,9 +2,9 @@ import type { Server as McpServer } from '@modelcontextprotocol/sdk/server/index
|
|
|
2
2
|
export interface StartHttpServerOptions {
|
|
3
3
|
/** McpServer (NOT yet connected). */
|
|
4
4
|
server: McpServer;
|
|
5
|
-
/** Bind host. Default '
|
|
5
|
+
/** Bind host. Default '127.0.0.1' (loopback only). */
|
|
6
6
|
host?: string;
|
|
7
|
-
/** Bind port. Default
|
|
7
|
+
/** Bind port. Default 0 (kernel-assigned ephemeral). */
|
|
8
8
|
port?: number;
|
|
9
9
|
/** Path that accepts MCP traffic. Default '/mcp'. */
|
|
10
10
|
path?: string;
|
|
@@ -17,7 +17,12 @@ export interface StartHttpServerOptions {
|
|
|
17
17
|
log?: (line: string) => void;
|
|
18
18
|
}
|
|
19
19
|
export interface HttpServerHandle {
|
|
20
|
+
/** Full URL clients should POST to (host:port + path). */
|
|
20
21
|
url: string;
|
|
22
|
+
/** The host the server is actually bound to. */
|
|
23
|
+
host: string;
|
|
24
|
+
/** The port the server is actually bound to (resolved when port=0). */
|
|
25
|
+
port: number;
|
|
21
26
|
close: () => Promise<void>;
|
|
22
27
|
}
|
|
23
28
|
export declare function startHttpServer(options: StartHttpServerOptions): Promise<HttpServerHandle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-transport.d.ts","sourceRoot":"","sources":["../../src/server/http-transport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-transport.d.ts","sourceRoot":"","sources":["../../src/server/http-transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAErF,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,MAAM,EAAE,SAAS,CAAC;IAClB,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAsBD,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuDhG"}
|
|
@@ -22,8 +22,8 @@ function writeJson(res, status, body) {
|
|
|
22
22
|
res.end(JSON.stringify(body));
|
|
23
23
|
}
|
|
24
24
|
export async function startHttpServer(options) {
|
|
25
|
-
const host = options.host ?? '
|
|
26
|
-
const
|
|
25
|
+
const host = options.host ?? '127.0.0.1';
|
|
26
|
+
const requestedPort = options.port ?? 0;
|
|
27
27
|
const path = options.path ?? '/mcp';
|
|
28
28
|
const stateful = options.stateful ?? true;
|
|
29
29
|
const log = options.log ?? (() => undefined);
|
|
@@ -40,7 +40,7 @@ export async function startHttpServer(options) {
|
|
|
40
40
|
writeJson(res, 200, { ok: true, transport: 'streamable-http', stateful });
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
const url = new URL(req.url, `http://${host}:${
|
|
43
|
+
const url = new URL(req.url, `http://${host}:${requestedPort || 80}`);
|
|
44
44
|
if (url.pathname !== path) {
|
|
45
45
|
writeJson(res, 404, { error: `not found: ${url.pathname}` });
|
|
46
46
|
return;
|
|
@@ -59,10 +59,14 @@ export async function startHttpServer(options) {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
await new Promise((resolve) => http.listen(
|
|
63
|
-
|
|
62
|
+
await new Promise((resolve) => http.listen(requestedPort, host, resolve));
|
|
63
|
+
const address = http.address();
|
|
64
|
+
const actualPort = address?.port ?? requestedPort;
|
|
65
|
+
log(`[mcp:http] listening on http://${host}:${actualPort}${path} (stateful=${stateful})`);
|
|
64
66
|
return {
|
|
65
|
-
url: `http://${host}:${
|
|
67
|
+
url: `http://${host}:${actualPort}${path}`,
|
|
68
|
+
host,
|
|
69
|
+
port: actualPort,
|
|
66
70
|
close: async () => {
|
|
67
71
|
await transport.close().catch(() => undefined);
|
|
68
72
|
await new Promise((resolve, reject) => http.close((err) => (err ? reject(err) : resolve())));
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/mcp-server",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
4
|
-
"description": "SharkCraft MCP server:
|
|
3
|
+
"version": "0.1.0-alpha.9",
|
|
4
|
+
"description": "SharkCraft MCP server: read-only @modelcontextprotocol/sdk tools (stdio + streamable-HTTP) for AI coding agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SharkCraft contributors",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
|
-
"types": "./dist/index.d.
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
-
"bun": "./src/index.ts",
|
|
14
13
|
"import": "./dist/index.js",
|
|
15
14
|
"default": "./dist/index.js"
|
|
16
15
|
}
|
|
@@ -22,12 +21,12 @@
|
|
|
22
21
|
],
|
|
23
22
|
"repository": {
|
|
24
23
|
"type": "git",
|
|
25
|
-
"url": "git+https://github.com/
|
|
24
|
+
"url": "git+https://github.com/sharkcraft/sharkcraft.git",
|
|
26
25
|
"directory": "packages/mcp-server"
|
|
27
26
|
},
|
|
28
|
-
"homepage": "https://github.com/
|
|
27
|
+
"homepage": "https://github.com/sharkcraft/sharkcraft",
|
|
29
28
|
"bugs": {
|
|
30
|
-
"url": "https://github.com/
|
|
29
|
+
"url": "https://github.com/sharkcraft/sharkcraft/issues"
|
|
31
30
|
},
|
|
32
31
|
"keywords": [
|
|
33
32
|
"sharkcraft",
|
|
@@ -44,20 +43,20 @@
|
|
|
44
43
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
45
44
|
},
|
|
46
45
|
"dependencies": {
|
|
47
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
48
|
-
"@shrkcrft/config": "^0.1.0-alpha.
|
|
49
|
-
"@shrkcrft/workspace": "^0.1.0-alpha.
|
|
50
|
-
"@shrkcrft/knowledge": "^0.1.0-alpha.
|
|
51
|
-
"@shrkcrft/context": "^0.1.0-alpha.
|
|
52
|
-
"@shrkcrft/rules": "^0.1.0-alpha.
|
|
53
|
-
"@shrkcrft/paths": "^0.1.0-alpha.
|
|
54
|
-
"@shrkcrft/templates": "^0.1.0-alpha.
|
|
55
|
-
"@shrkcrft/pipelines": "^0.1.0-alpha.
|
|
56
|
-
"@shrkcrft/presets": "^0.1.0-alpha.
|
|
57
|
-
"@shrkcrft/boundaries": "^0.1.0-alpha.
|
|
58
|
-
"@shrkcrft/packs": "^0.1.0-alpha.
|
|
59
|
-
"@shrkcrft/generator": "^0.1.0-alpha.
|
|
60
|
-
"@shrkcrft/inspector": "^0.1.0-alpha.
|
|
46
|
+
"@shrkcrft/core": "^0.1.0-alpha.9",
|
|
47
|
+
"@shrkcrft/config": "^0.1.0-alpha.9",
|
|
48
|
+
"@shrkcrft/workspace": "^0.1.0-alpha.9",
|
|
49
|
+
"@shrkcrft/knowledge": "^0.1.0-alpha.9",
|
|
50
|
+
"@shrkcrft/context": "^0.1.0-alpha.9",
|
|
51
|
+
"@shrkcrft/rules": "^0.1.0-alpha.9",
|
|
52
|
+
"@shrkcrft/paths": "^0.1.0-alpha.9",
|
|
53
|
+
"@shrkcrft/templates": "^0.1.0-alpha.9",
|
|
54
|
+
"@shrkcrft/pipelines": "^0.1.0-alpha.9",
|
|
55
|
+
"@shrkcrft/presets": "^0.1.0-alpha.9",
|
|
56
|
+
"@shrkcrft/boundaries": "^0.1.0-alpha.9",
|
|
57
|
+
"@shrkcrft/packs": "^0.1.0-alpha.9",
|
|
58
|
+
"@shrkcrft/generator": "^0.1.0-alpha.9",
|
|
59
|
+
"@shrkcrft/inspector": "^0.1.0-alpha.9",
|
|
61
60
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
62
61
|
"zod": "^3.25.0 || ^4.0.0"
|
|
63
62
|
},
|