Skip to content

Commit 96020a9

Browse files
committed
chore: lint
1 parent dd3c850 commit 96020a9

File tree

21 files changed

+62
-84
lines changed

21 files changed

+62
-84
lines changed

biome.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignore": ["vendor/**", "**/dist/**", "**/node_modules/**", "specs/**"]
10+
},
311
"organizeImports": {
412
"enabled": true
513
},
@@ -8,7 +16,12 @@
816
"rules": {
917
"recommended": true,
1018
"complexity": {
11-
"noExcessiveCognitiveComplexity": "error"
19+
"noExcessiveCognitiveComplexity": {
20+
"level": "warn",
21+
"options": {
22+
"maxAllowedComplexity": 25
23+
}
24+
}
1225
},
1326
"style": {
1427
"noNonNullAssertion": "error",
@@ -25,4 +38,4 @@
2538
"indentWidth": 2,
2639
"lineWidth": 100
2740
}
28-
}
41+
}

package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@
1414
"start:stdio": "pnpm --filter @cityjson-spec-mcp/server run start:stdio",
1515
"start:http": "pnpm --filter @cityjson-spec-mcp/server run start:http"
1616
},
17-
"keywords": [
18-
"mcp",
19-
"cityjson",
20-
"model-context-protocol",
21-
"3d-city-models",
22-
"specification"
23-
],
17+
"keywords": ["mcp", "cityjson", "model-context-protocol", "3d-city-models", "specification"],
2418
"author": "",
2519
"license": "MIT",
2620
"devDependencies": {
@@ -30,4 +24,4 @@
3024
"engines": {
3125
"node": ">=18.0.0"
3226
}
33-
}
27+
}

packages/mcp-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
"vite": "^6.0.0",
2424
"vite-node": "^2.0.0"
2525
}
26-
}
26+
}

packages/mcp-server/src/config.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
*/
44

55
import { existsSync } from "node:fs";
6-
import { resolve, dirname } from "node:path";
6+
import { dirname, resolve } from "node:path";
77
import { fileURLToPath } from "node:url";
8-
import { SERVER_NAME, SERVER_VERSION, DEFAULT_HTTP_PORT } from "./constants.js";
8+
import { DEFAULT_HTTP_PORT, SERVER_NAME, SERVER_VERSION } from "./constants.js";
99

1010
export interface ServerConfig {
1111
name: string;
@@ -20,10 +20,7 @@ export interface ServerConfig {
2020
*/
2121
function findProjectRoot(startDir: string): string {
2222
let current = startDir;
23-
while (
24-
current !== "/" &&
25-
!existsSync(resolve(current, "pnpm-workspace.yaml"))
26-
) {
23+
while (current !== "/" && !existsSync(resolve(current, "pnpm-workspace.yaml"))) {
2724
current = dirname(current);
2825
}
2926
return current;
@@ -36,12 +33,9 @@ export function loadConfig(): ServerConfig {
3633
const __dirname = dirname(fileURLToPath(import.meta.url));
3734
const projectRoot = findProjectRoot(__dirname);
3835

39-
const specsPath =
40-
process.env["CITYJSON_SPECS_PATH"] || resolve(projectRoot, "specs");
41-
const transport = (process.env["TRANSPORT"] as "stdio" | "http") || "stdio";
42-
const httpPort = process.env["PORT"]
43-
? parseInt(process.env["PORT"], 10)
44-
: DEFAULT_HTTP_PORT;
36+
const specsPath = process.env.CITYJSON_SPECS_PATH || resolve(projectRoot, "specs");
37+
const transport = (process.env.TRANSPORT as "stdio" | "http") || "stdio";
38+
const httpPort = process.env.PORT ? Number.parseInt(process.env.PORT, 10) : DEFAULT_HTTP_PORT;
4539

4640
return {
4741
name: SERVER_NAME,

packages/mcp-server/src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function main(): Promise<void> {
1515
if (config.transport === "stdio") {
1616
const transport = new StdioServerTransport();
1717
await server.connect(transport);
18-
console.error(`CityJSON Spec MCP Server running on stdio`);
18+
console.error("CityJSON Spec MCP Server running on stdio");
1919
console.error(`Specs path: ${config.specsPath}`);
2020
} else {
2121
// HTTP transport - dynamically import to avoid loading express in stdio mode
@@ -38,9 +38,7 @@ async function main(): Promise<void> {
3838
});
3939

4040
app.listen(config.httpPort, () => {
41-
console.error(
42-
`CityJSON Spec MCP Server running on http://localhost:${config.httpPort}`
43-
);
41+
console.error(`CityJSON Spec MCP Server running on http://localhost:${config.httpPort}`);
4442
console.error(`Specs path: ${config.specsPath}`);
4543
});
4644
}

packages/mcp-server/src/schemas/tool-schemas.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ export const ReadChapterInputSchema = z
1818
chapter: z
1919
.string()
2020
.min(1)
21-
.describe(
22-
"Chapter identifier (e.g., 'metadata', 'city-objects', 'geometry-objects')"
23-
),
21+
.describe("Chapter identifier (e.g., 'metadata', 'city-objects', 'geometry-objects')"),
2422
})
2523
.strict();
2624

packages/mcp-server/src/server.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@
44

55
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
66
import type { ServerConfig } from "./config.js";
7+
import { ReadChapterInputSchema, ReadOutlineInputSchema } from "./schemas/tool-schemas.js";
78
import { ChapterIndexService } from "./services/chapter-index.js";
89
import { SpecLoader } from "./services/spec-loader.js";
9-
import {
10-
ReadOutlineInputSchema,
11-
ReadChapterInputSchema,
12-
} from "./schemas/tool-schemas.js";
13-
import { handleReadOutline, handleReadChapter } from "./tools/index.js";
10+
import { handleReadChapter, handleReadOutline } from "./tools/index.js";
1411

1512
export function createServer(config: ServerConfig): McpServer {
1613
const server = new McpServer(
1714
{ name: config.name, version: config.version },
18-
{ capabilities: { tools: {} } }
15+
{ capabilities: { tools: {} } },
1916
);
2017

2118
const indexService = new ChapterIndexService(config.specsPath);
@@ -26,15 +23,15 @@ export function createServer(config: ServerConfig): McpServer {
2623
"cityjson_read_spec_outline",
2724
"Returns the table of contents for the CityJSON specification, including all chapters and their sections",
2825
ReadOutlineInputSchema.shape,
29-
async (params) => handleReadOutline(params, indexService)
26+
async (params) => handleReadOutline(params, indexService),
3027
);
3128

3229
// Register cityjson_read_spec_chapter
3330
server.tool(
3431
"cityjson_read_spec_chapter",
3532
"Returns the full specification content for a specific chapter in Markdown format",
3633
ReadChapterInputSchema.shape,
37-
async (params) => handleReadChapter(params, specLoader, indexService)
34+
async (params) => handleReadChapter(params, specLoader, indexService),
3835
);
3936

4037
return server;

packages/mcp-server/src/services/chapter-index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import { readFile } from "node:fs/promises";
66
import { join } from "node:path";
7-
import type { ChapterIndex, Chapter } from "../types.js";
7+
import type { Chapter, ChapterIndex } from "../types.js";
88

99
export class ChapterIndexService {
1010
private index: ChapterIndex | null = null;

packages/mcp-server/src/tools/read-chapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
* Implementation of cityjson_read_spec_chapter tool
33
*/
44

5+
import type { ReadChapterInput } from "../schemas/tool-schemas.js";
56
import type { ChapterIndexService } from "../services/chapter-index.js";
67
import type { SpecLoader } from "../services/spec-loader.js";
78
import type { ToolResult } from "../types.js";
8-
import type { ReadChapterInput } from "../schemas/tool-schemas.js";
99

1010
export async function handleReadChapter(
1111
params: ReadChapterInput,
1212
specLoader: SpecLoader,
13-
indexService: ChapterIndexService
13+
indexService: ChapterIndexService,
1414
): Promise<ToolResult> {
1515
try {
1616
const content = await specLoader.loadChapter(params.chapter);

packages/mcp-server/src/tools/read-outline.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
* Implementation of cityjson_read_spec_outline tool
33
*/
44

5+
import type { ReadOutlineInput } from "../schemas/tool-schemas.js";
56
import type { ChapterIndexService } from "../services/chapter-index.js";
67
import type { ToolResult } from "../types.js";
7-
import type { ReadOutlineInput } from "../schemas/tool-schemas.js";
88

99
export async function handleReadOutline(
1010
params: ReadOutlineInput,
11-
indexService: ChapterIndexService
11+
indexService: ChapterIndexService,
1212
): Promise<ToolResult> {
1313
try {
1414
const index = await indexService.loadIndex();

0 commit comments

Comments
 (0)