Skip to content

Commit fb1d259

Browse files
Merge branch 'main' into fix/tool-execution-mode
2 parents 601115b + 33576f5 commit fb1d259

File tree

4 files changed

+36
-61
lines changed

4 files changed

+36
-61
lines changed

docs/docs/develop/build-server.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Writing to stdout will corrupt the JSON-RPC messages and break your server.
5959
### Best Practices
6060

6161
1. Use a logging library that writes to stderr or files.
62-
1. Tool names should follow the format specified [here](/specification/draft/server/tools#tool-names).
62+
1. For Python, be especially careful - `print()` writes to stdout by default.
6363

6464
### Quick Examples
6565

docs/examples.mdx

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,11 @@ These official reference servers demonstrate core MCP features and SDK usage:
1919
- **[Sequential Thinking](https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking)** - Dynamic and reflective problem-solving through thought sequences
2020
- **[Time](https://github.com/modelcontextprotocol/servers/tree/main/src/time)** - Time and timezone conversion capabilities
2121

22-
### Archived servers (historical reference)
22+
### Additional example servers (archived)
2323

24-
⚠️ **Note**: The following servers have been moved to the [servers-archived repository](https://github.com/modelcontextprotocol/servers-archived) and are no longer actively maintained. They are provided for historical reference only.
24+
Visit the [servers-archived repository](https://github.com/modelcontextprotocol/servers-archived) to get access to archived example servers that are no longer actively maintained.
2525

26-
#### Data and file systems
27-
28-
- **[PostgreSQL](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/postgres)** - Read-only database access with schema inspection capabilities
29-
- **[SQLite](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/sqlite)** - Database interaction and business intelligence features
30-
- **[Google Drive](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gdrive)** - File access and search capabilities for Google Drive
31-
32-
#### Development tools
33-
34-
- **[Git](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/git)** - Tools to read, search, and manipulate Git repositories
35-
- **[GitHub](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/github)** - Repository management, file operations, and GitHub API integration
36-
- **[GitLab](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gitlab)** - GitLab API integration enabling project management
37-
- **[Sentry](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/sentry)** - Retrieving and analyzing issues from Sentry.io
38-
39-
#### Web and browser automation
40-
41-
- **[Brave Search](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/brave-search)** - Web and local search using Brave's Search API
42-
- **[Puppeteer](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/puppeteer)** - Browser automation and web scraping capabilities
43-
44-
#### Productivity and communication
45-
46-
- **[Slack](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/slack)** - Channel management and messaging capabilities
47-
- **[Google Maps](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/google-maps)** - Location services, directions, and place details
48-
49-
#### AI and specialized tools
50-
51-
- **[EverArt](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/everart)** - AI image generation using various models
52-
- **[AWS KB Retrieval](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/aws-kb-retrieval-server)** - Retrieval from AWS Knowledge Base using Bedrock Agent Runtime
26+
They are provided for historical reference only.
5327

5428
## Official integrations
5529

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"check:schema:json": "tsx scripts/generate-schemas.ts --check",
3131
"check:schema:md": "for f in schema/*/schema.mdx; do typedoc --entryPoints \"${f%.mdx}.ts\" --schemaPageTemplate \"$f\" | cmp docs/specification/$(basename -- $(dirname -- \"$f\"))/schema.mdx - || exit 1; done",
3232
"format": "prettier --write \"**/*.{md,mdx}\" --ignore \"docs/specification/*/schema.mdx\" ",
33-
"generate:schema": "npm run generate:schema:json && npm run generate:schema:md",
33+
"generate:schema": "npm run generate:schema:json & npm run generate:schema:md & wait",
3434
"generate:schema:json": "tsx scripts/generate-schemas.ts",
35-
"generate:schema:md": "for f in schema/*/schema.mdx; do typedoc --entryPoints \"${f%.mdx}.ts\" --schemaPageTemplate \"$f\" > docs/specification/$(basename -- $(dirname -- \"$f\"))/schema.mdx; done",
35+
"generate:schema:md": "find schema/*/schema.mdx -print0 | xargs -0 -P 0 -I {} sh -c 'f=\"{}\"; typedoc --entryPoints \"${f%.mdx}.ts\" --schemaPageTemplate \"$f\" > docs/specification/$(basename -- $(dirname -- \"$f\"))/schema.mdx'",
3636
"prep:changes": "npm run check:schema:ts && npm run generate:schema && npm run check:docs && npm run format",
3737
"serve:docs": "cd docs && npx mint dev",
3838
"serve:blog": "cd blog && hugo serve"

scripts/generate-schemas.ts

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
#!/usr/bin/env tsx
22

3-
import { execSync } from 'child_process';
3+
import { exec } from 'child_process';
44
import { readFileSync, writeFileSync } from 'fs';
55
import { join } from 'path';
6+
import { promisify } from 'util';
7+
8+
const execAsync = promisify(exec);
69

710
// Legacy schema versions that should remain as JSON Schema draft-07
811
const LEGACY_SCHEMAS = ['2024-11-05', '2025-03-26', '2025-06-18'];
912

13+
// Modern schema versions that use JSON Schema 2020-12
14+
const MODERN_SCHEMAS = ['2025-11-25', 'draft'];
15+
1016
// All schema versions to generate
11-
const ALL_SCHEMAS = [...LEGACY_SCHEMAS, '2025-11-25', 'draft'];
17+
const ALL_SCHEMAS = [...LEGACY_SCHEMAS, ...MODERN_SCHEMAS];
1218

1319
// Check if we're in check mode (validate existing schemas match generated ones)
1420
const CHECK_MODE = process.argv.includes('--check');
@@ -43,22 +49,19 @@ function applyJsonSchema202012Transformations(schemaPath: string): void {
4349
/**
4450
* Generate JSON schema for a specific version
4551
*/
46-
function generateSchema(version: string, check: boolean = false): boolean {
52+
async function generateSchema(version: string, check: boolean = false): Promise<boolean> {
4753
const schemaDir = join('schema', version);
4854
const schemaTs = join(schemaDir, 'schema.ts');
4955
const schemaJson = join(schemaDir, 'schema.json');
5056

5157
if (check) {
52-
console.log(`Checking schema for ${version}...`);
53-
5458
// Read existing schema
5559
const existingSchema = readFileSync(schemaJson, 'utf-8');
5660

5761
// Generate schema to stdout and capture it
5862
try {
59-
const generated = execSync(
60-
`npx typescript-json-schema --defaultNumberType integer --required --skipLibCheck "${schemaTs}" "*"`,
61-
{ encoding: 'utf-8' }
63+
const { stdout: generated } = await execAsync(
64+
`npx typescript-json-schema --defaultNumberType integer --required --skipLibCheck "${schemaTs}" "*"`
6265
);
6366

6467
let expectedSchema = generated;
@@ -86,13 +89,10 @@ function generateSchema(version: string, check: boolean = false): boolean {
8689
throw error;
8790
}
8891
} else {
89-
console.log(`Generating schema for ${version}...`);
90-
9192
// Run typescript-json-schema
9293
try {
93-
execSync(
94-
`npx typescript-json-schema --defaultNumberType integer --required --skipLibCheck "${schemaTs}" "*" -o "${schemaJson}"`,
95-
{ stdio: 'inherit' }
94+
await execAsync(
95+
`npx typescript-json-schema --defaultNumberType integer --required --skipLibCheck "${schemaTs}" "*" -o "${schemaJson}"`
9696
);
9797
} catch (error) {
9898
console.error(`Failed to generate schema for ${version}`);
@@ -101,28 +101,26 @@ function generateSchema(version: string, check: boolean = false): boolean {
101101

102102
// Apply transformations for non-legacy schemas
103103
if (!LEGACY_SCHEMAS.includes(version)) {
104-
console.log(`Applying JSON Schema 2020-12 transformations to ${version}...`);
105104
applyJsonSchema202012Transformations(schemaJson);
106105
}
107106

107+
console.log(` ✓ Generated schema for ${version}`);
108108
return true;
109109
}
110110
}
111111

112112
/**
113113
* Main function
114114
*/
115-
function main(): void {
115+
async function main(): Promise<void> {
116116
if (CHECK_MODE) {
117-
console.log('Checking JSON schemas...\n');
117+
console.log('Checking JSON schemas in parallel...\n');
118118

119-
let allValid = true;
120-
for (const version of ALL_SCHEMAS) {
121-
const valid = generateSchema(version, true);
122-
if (!valid) {
123-
allValid = false;
124-
}
125-
}
119+
const results = await Promise.all(
120+
ALL_SCHEMAS.map(version => generateSchema(version, true))
121+
);
122+
123+
const allValid = results.every(valid => valid);
126124

127125
console.log();
128126
if (!allValid) {
@@ -132,16 +130,19 @@ function main(): void {
132130
console.log('All schemas are up to date!');
133131
}
134132
} else {
135-
console.log('Generating JSON schemas...\n');
133+
console.log('Generating JSON schemas in parallel...\n');
136134

137-
for (const version of ALL_SCHEMAS) {
138-
generateSchema(version, false);
139-
}
135+
await Promise.all(
136+
ALL_SCHEMAS.map(version => generateSchema(version, false))
137+
);
140138

141139
console.log('\nSchema generation complete!');
142140
console.log(`- (draft-07): ${LEGACY_SCHEMAS.join(', ')}`);
143-
console.log(`- (2020-12): draft`);
141+
console.log(`- (2020-12): ${MODERN_SCHEMAS.join(', ')}`);
144142
}
145143
}
146144

147-
main();
145+
main().catch(error => {
146+
console.error('Schema generation failed:', error);
147+
process.exit(1);
148+
});

0 commit comments

Comments
 (0)