Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Remove generate-schema from public CLI (#1591)

Jeremiah Lowin47e6d2c0a377
diff --git a/docs/schemas/fastmcp_config/latest.json b/docs/schemas/fastmcp_config/latest.json
deleted file mode 120000
index 2cf0f1ec9..000000000
--- a/docs/schemas/fastmcp_config/latest.json
+++ /dev/null
@@ -1 +0,0 @@
-v1.json
\ No newline at end of file
diff --git a/docs/schemas/fastmcp_config/latest.json b/docs/schemas/fastmcp_config/latest.json
new file mode 100644
index 000000000..2456b9058
--- /dev/null
+++ b/docs/schemas/fastmcp_config/latest.json
@@ -0,0 +1,361 @@
+{
+ "$defs": {
+ "DeploymentConfig": {
+ "description": "Configuration for server deployment and runtime settings.",
+ "properties": {
+ "transport": {
+ "anyOf": [
+ {
+ "enum": [
+ "stdio",
+ "http",
+ "sse"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Transport protocol to use",
+ "title": "Transport"
+ },
+ "host": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Host to bind to when using HTTP transport",
+ "examples": [
+ "127.0.0.1",
+ "0.0.0.0",
+ "localhost"
+ ],
+ "title": "Host"
+ },
+ "port": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Port to bind to when using HTTP transport",
+ "examples": [
+ 8000,
+ 3000,
+ 5000
+ ],
+ "title": "Port"
+ },
+ "path": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "URL path for the server endpoint",
+ "examples": [
+ "/mcp/",
+ "/api/mcp/",
+ "/sse/"
+ ],
+ "title": "Path"
+ },
+ "log_level": {
+ "anyOf": [
+ {
+ "enum": [
+ "DEBUG",
+ "INFO",
+ "WARNING",
+ "ERROR",
+ "CRITICAL"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Log level for the server",
+ "title": "Log Level"
+ },
+ "cwd": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Working directory for the server process",
+ "examples": [
+ ".",
+ "./src",
+ "/app"
+ ],
+ "title": "Cwd"
+ },
+ "env": {
+ "anyOf": [
+ {
+ "additionalProperties": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Environment variables to set when running the server",
+ "examples": [
+ {
+ "API_KEY": "secret",
+ "DEBUG": "true"
+ }
+ ],
+ "title": "Env"
+ },
+ "args": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Arguments to pass to the server (after --)",
+ "examples": [
+ [
+ "--config",
+ "config.json",
+ "--debug"
+ ]
+ ],
+ "title": "Args"
+ }
+ },
+ "title": "DeploymentConfig",
+ "type": "object"
+ },
+ "EntrypointConfig": {
+ "description": "Configuration for server entrypoint when using object format.",
+ "properties": {
+ "file": {
+ "description": "Path to Python file containing the server",
+ "examples": [
+ "server.py",
+ "src/server.py",
+ "app/main.py"
+ ],
+ "title": "File",
+ "type": "string"
+ },
+ "object": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Name of the server object in the file (defaults to searching for mcp/server/app)",
+ "examples": [
+ "app",
+ "mcp",
+ "server"
+ ],
+ "title": "Object"
+ },
+ "repo": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Git repository URL",
+ "examples": [
+ "https://github.com/user/repo"
+ ],
+ "title": "Repo"
+ }
+ },
+ "required": [
+ "file"
+ ],
+ "title": "EntrypointConfig",
+ "type": "object"
+ },
+ "EnvironmentConfig": {
+ "description": "Configuration for Python environment setup.",
+ "properties": {
+ "python": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Python version constraint",
+ "examples": [
+ "3.10",
+ "3.11",
+ "3.12"
+ ],
+ "title": "Python"
+ },
+ "dependencies": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Python packages to install with PEP 508 specifiers",
+ "examples": [
+ [
+ "fastmcp>=2.0,<3",
+ "httpx",
+ "pandas>=2.0"
+ ]
+ ],
+ "title": "Dependencies"
+ },
+ "requirements": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Path to requirements.txt file",
+ "examples": [
+ "requirements.txt",
+ "../requirements/prod.txt"
+ ],
+ "title": "Requirements"
+ },
+ "project": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Path to project directory containing pyproject.toml",
+ "examples": [
+ ".",
+ "../my-project"
+ ],
+ "title": "Project"
+ },
+ "editable": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Directory to install in editable mode",
+ "examples": [
+ ".",
+ "../my-package"
+ ],
+ "title": "Editable"
+ }
+ },
+ "title": "EnvironmentConfig",
+ "type": "object"
+ }
+ },
+ "description": "Configuration file for FastMCP servers",
+ "properties": {
+ "$schema": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": "https://gofastmcp.com/schemas/fastmcp_config/v1.json",
+ "description": "JSON schema for IDE support and validation",
+ "title": "$Schema"
+ },
+ "entrypoint": {
+ "$ref": "#/$defs/EntrypointConfig",
+ "description": "Server entrypoint as a string (file or file:object) or object with file/object/repo",
+ "examples": [
+ "server.py",
+ "server.py:app",
+ {
+ "file": "src/server.py",
+ "object": "app"
+ }
+ ]
+ },
+ "environment": {
+ "$ref": "#/$defs/EnvironmentConfig",
+ "description": "Python environment setup configuration"
+ },
+ "deployment": {
+ "$ref": "#/$defs/DeploymentConfig",
+ "description": "Server deployment and runtime settings"
+ }
+ },
+ "required": [
+ "entrypoint"
+ ],
+ "title": "FastMCP Configuration",
+ "type": "object",
+ "$id": "https://gofastmcp.com/schemas/fastmcp_config/v1.json"
+}
diff --git a/docs/schemas/fastmcp_config/v1.json b/docs/schemas/fastmcp_config/v1.json
deleted file mode 120000
index 374e96936..000000000
--- a/docs/schemas/fastmcp_config/v1.json
+++ /dev/null
@@ -1 +0,0 @@
-../../../src/fastmcp/utilities/fastmcp_config/v1/schema.json
\ No newline at end of file
diff --git a/docs/schemas/fastmcp_config/v1.json b/docs/schemas/fastmcp_config/v1.json
new file mode 100644
index 000000000..2456b9058
--- /dev/null
+++ b/docs/schemas/fastmcp_config/v1.json
@@ -0,0 +1,361 @@
+{
+ "$defs": {
+ "DeploymentConfig": {
+ "description": "Configuration for server deployment and runtime settings.",
+ "properties": {
+ "transport": {
+ "anyOf": [
+ {
+ "enum": [
+ "stdio",
+ "http",
+ "sse"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Transport protocol to use",
+ "title": "Transport"
+ },
+ "host": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Host to bind to when using HTTP transport",
+ "examples": [
+ "127.0.0.1",
+ "0.0.0.0",
+ "localhost"
+ ],
+ "title": "Host"
+ },
+ "port": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Port to bind to when using HTTP transport",
+ "examples": [
+ 8000,
+ 3000,
+ 5000
+ ],
+ "title": "Port"
+ },
+ "path": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "URL path for the server endpoint",
+ "examples": [
+ "/mcp/",
+ "/api/mcp/",
+ "/sse/"
+ ],
+ "title": "Path"
+ },
+ "log_level": {
+ "anyOf": [
+ {
+ "enum": [
+ "DEBUG",
+ "INFO",
+ "WARNING",
+ "ERROR",
+ "CRITICAL"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Log level for the server",
+ "title": "Log Level"
+ },
+ "cwd": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Working directory for the server process",
+ "examples": [
+ ".",
+ "./src",
+ "/app"
+ ],
+ "title": "Cwd"
+ },
+ "env": {
+ "anyOf": [
+ {
+ "additionalProperties": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Environment variables to set when running the server",
+ "examples": [
+ {
+ "API_KEY": "secret",
+ "DEBUG": "true"
+ }
+ ],
+ "title": "Env"
+ },
+ "args": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Arguments to pass to the server (after --)",
+ "examples": [
+ [
+ "--config",
+ "config.json",
+ "--debug"
+ ]
+ ],
+ "title": "Args"
+ }
+ },
+ "title": "DeploymentConfig",
+ "type": "object"
+ },
+ "EntrypointConfig": {
+ "description": "Configuration for server entrypoint when using object format.",
+ "properties": {
+ "file": {
+ "description": "Path to Python file containing the server",
+ "examples": [
+ "server.py",
+ "src/server.py",
+ "app/main.py"
+ ],
+ "title": "File",
+ "type": "string"
+ },
+ "object": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Name of the server object in the file (defaults to searching for mcp/server/app)",
+ "examples": [
+ "app",
+ "mcp",
+ "server"
+ ],
+ "title": "Object"
+ },
+ "repo": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Git repository URL",
+ "examples": [
+ "https://github.com/user/repo"
+ ],
+ "title": "Repo"
+ }
+ },
+ "required": [
+ "file"
+ ],
+ "title": "EntrypointConfig",
+ "type": "object"
+ },
+ "EnvironmentConfig": {
+ "description": "Configuration for Python environment setup.",
+ "properties": {
+ "python": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Python version constraint",
+ "examples": [
+ "3.10",
+ "3.11",
+ "3.12"
+ ],
+ "title": "Python"
+ },
+ "dependencies": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Python packages to install with PEP 508 specifiers",
+ "examples": [
+ [
+ "fastmcp>=2.0,<3",
+ "httpx",
+ "pandas>=2.0"
+ ]
+ ],
+ "title": "Dependencies"
+ },
+ "requirements": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Path to requirements.txt file",
+ "examples": [
+ "requirements.txt",
+ "../requirements/prod.txt"
+ ],
+ "title": "Requirements"
+ },
+ "project": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Path to project directory containing pyproject.toml",
+ "examples": [
+ ".",
+ "../my-project"
+ ],
+ "title": "Project"
+ },
+ "editable": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Directory to install in editable mode",
+ "examples": [
+ ".",
+ "../my-package"
+ ],
+ "title": "Editable"
+ }
+ },
+ "title": "EnvironmentConfig",
+ "type": "object"
+ }
+ },
+ "description": "Configuration file for FastMCP servers",
+ "properties": {
+ "$schema": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": "https://gofastmcp.com/schemas/fastmcp_config/v1.json",
+ "description": "JSON schema for IDE support and validation",
+ "title": "$Schema"
+ },
+ "entrypoint": {
+ "$ref": "#/$defs/EntrypointConfig",
+ "description": "Server entrypoint as a string (file or file:object) or object with file/object/repo",
+ "examples": [
+ "server.py",
+ "server.py:app",
+ {
+ "file": "src/server.py",
+ "object": "app"
+ }
+ ]
+ },
+ "environment": {
+ "$ref": "#/$defs/EnvironmentConfig",
+ "description": "Python environment setup configuration"
+ },
+ "deployment": {
+ "$ref": "#/$defs/DeploymentConfig",
+ "description": "Server deployment and runtime settings"
+ }
+ },
+ "required": [
+ "entrypoint"
+ ],
+ "title": "FastMCP Configuration",
+ "type": "object",
+ "$id": "https://gofastmcp.com/schemas/fastmcp_config/v1.json"
+}
diff --git a/src/fastmcp/cli/cli.py b/src/fastmcp/cli/cli.py
index 85c09917a..ca5b5ce6c 100644
--- a/src/fastmcp/cli/cli.py
+++ b/src/fastmcp/cli/cli.py
@@ -765,43 +765,6 @@ async def inspect(
sys.exit(1)
-def generate_schema(
- *,
- output: Annotated[
- Path | None,
- cyclopts.Parameter(
- name=["--output", "-o"],
- help="Output file path for the JSON schema",
- ),
- ] = None,
-) -> None:
- """Generate JSON schema for fastmcp.json configuration files.
-
- This generates a JSON schema that can be used by IDEs and validators
- to provide auto-completion and validation for fastmcp.json files.
-
- Examples:
- fastmcp generate-schema
- fastmcp generate-schema -o schema.json
- """
- import json
-
- from fastmcp.utilities.fastmcp_config import (
- generate_schema as gen_schema,
- )
-
- schema = gen_schema()
- schema_json = json.dumps(schema, indent=2)
-
- if output:
- output.parent.mkdir(parents=True, exist_ok=True)
- output.write_text(schema_json)
- logger.info(f"Schema written to {output}")
- else:
- console.print(schema_json)
-
-
# Add install subcommands using proper Cyclopts pattern
app.command(install_app)