Skip to content

Commit cf73e18

Browse files
authored
Merge pull request #26 from j4th/feature/smithery-sdk-integration
Integrate Smithery Python SDK for config schema discovery
2 parents 25ad192 + e971396 commit cf73e18

7 files changed

Lines changed: 214 additions & 50 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.2.0] - 2026-03-24
9+
10+
### Added
11+
- Smithery Python SDK integration for proper config schema discovery and session configuration
12+
- `smithery` dependency for Smithery platform deployment support
13+
- `[tool.smithery]` configuration in pyproject.toml pointing to server factory
14+
15+
### Changed
16+
- `smithery.yaml` simplified to `runtime: "python"` (replaces old `startCommand`/`commandFunction` format)
17+
18+
[1.2.0]: https://github.com/j4th/mtg-mcp-server/compare/v1.1.1...v1.2.0
19+
820
## [1.1.1] - 2026-03-24
921

1022
### Fixed

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "mtg-mcp-server"
3-
version = "1.1.1"
3+
version = "1.2.0"
44
description = "Unified MCP server providing Magic: The Gathering data to AI assistants"
55
readme = "README.md"
66
license = "MIT"
@@ -42,6 +42,7 @@ dependencies = [
4242
"pydantic-settings>=2.0",
4343
"tenacity>=9.0",
4444
"structlog>=24.0",
45+
"smithery>=0.4.4",
4546
]
4647

4748
[project.urls]
@@ -83,6 +84,9 @@ default-groups = ["dev"]
8384
# Ruff — linting & formatting
8485
# ---------------------------------------------------------------------------
8586

87+
[tool.smithery]
88+
server = "mtg_mcp_server.smithery:create_server"
89+
8690
[tool.ruff]
8791
line-length = 100
8892
target-version = "py312"

server.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"title": "MTG MCP Server",
55
"description": "Magic: The Gathering data for AI — cards, combos, draft analytics, and Commander tools.",
66
"repository": {"url": "https://github.com/j4th/mtg-mcp-server", "source": "github"},
7-
"version": "1.1.1",
7+
"version": "1.2.0",
88
"packages": [
99
{
1010
"registryType": "pypi",
1111
"identifier": "mtg-mcp-server",
12-
"version": "1.1.1",
12+
"version": "1.2.0",
1313
"transport": {"type": "stdio"}
1414
}
1515
]

smithery.yaml

Lines changed: 52 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,55 @@
1-
# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml
1+
runtime: "python"
22

33
startCommand:
44
type: stdio
5-
6-
configSchema:
7-
type: object
8-
required: []
9-
properties:
10-
MTG_MCP_ENABLE_17LANDS:
11-
type: boolean
12-
description: "Enable 17Lands draft analytics backend for card ratings and archetype stats"
13-
default: true
14-
MTG_MCP_ENABLE_EDHREC:
15-
type: boolean
16-
description: "Enable EDHREC commander metagame backend (uses undocumented endpoints)"
17-
default: true
18-
MTG_MCP_ENABLE_MTGJSON:
19-
type: boolean
20-
description: "Enable MTGJSON bulk card data for rate-limit-free lookups (~100MB download on first use)"
21-
default: true
22-
MTG_MCP_LOG_LEVEL:
23-
type: string
24-
description: "Server logging level"
25-
default: "INFO"
26-
enum: ["DEBUG", "INFO", "WARNING", "ERROR"]
27-
MTG_MCP_SCRYFALL_RATE_LIMIT_MS:
28-
type: number
29-
description: "Minimum delay between Scryfall API calls in milliseconds"
30-
default: 100
31-
MTG_MCP_MTGJSON_REFRESH_HOURS:
32-
type: number
33-
description: "Hours between MTGJSON bulk data refreshes"
34-
default: 24
35-
36-
commandFunction: |-
37-
(config) => ({
38-
command: 'uvx',
39-
args: ['mtg-mcp-server'],
40-
env: {
41-
MTG_MCP_ENABLE_17LANDS: config.MTG_MCP_ENABLE_17LANDS !== undefined ? String(config.MTG_MCP_ENABLE_17LANDS) : undefined,
42-
MTG_MCP_ENABLE_EDHREC: config.MTG_MCP_ENABLE_EDHREC !== undefined ? String(config.MTG_MCP_ENABLE_EDHREC) : undefined,
43-
MTG_MCP_ENABLE_MTGJSON: config.MTG_MCP_ENABLE_MTGJSON !== undefined ? String(config.MTG_MCP_ENABLE_MTGJSON) : undefined,
44-
MTG_MCP_LOG_LEVEL: config.MTG_MCP_LOG_LEVEL || undefined,
45-
MTG_MCP_SCRYFALL_RATE_LIMIT_MS: config.MTG_MCP_SCRYFALL_RATE_LIMIT_MS !== undefined ? String(config.MTG_MCP_SCRYFALL_RATE_LIMIT_MS) : undefined,
46-
MTG_MCP_MTGJSON_REFRESH_HOURS: config.MTG_MCP_MTGJSON_REFRESH_HOURS !== undefined ? String(config.MTG_MCP_MTGJSON_REFRESH_HOURS) : undefined
47-
}
48-
})
5+
configSchema:
6+
type: object
7+
properties:
8+
MTG_MCP_ENABLE_17LANDS:
9+
type: boolean
10+
title: "Enable 17Lands"
11+
description: "Enable 17Lands draft analytics backend for card ratings and archetype stats"
12+
default: true
13+
MTG_MCP_ENABLE_EDHREC:
14+
type: boolean
15+
title: "Enable EDHREC"
16+
description: "Enable EDHREC commander metagame backend (uses undocumented endpoints)"
17+
default: true
18+
MTG_MCP_ENABLE_MTGJSON:
19+
type: boolean
20+
title: "Enable MTGJSON"
21+
description: "Enable MTGJSON bulk card data for rate-limit-free lookups (~100 MB download on first use)"
22+
default: true
23+
MTG_MCP_LOG_LEVEL:
24+
type: string
25+
title: "Log Level"
26+
description: "Server logging level"
27+
default: "INFO"
28+
enum: ["DEBUG", "INFO", "WARNING", "ERROR"]
29+
MTG_MCP_SCRYFALL_RATE_LIMIT_MS:
30+
type: integer
31+
title: "Scryfall Rate Limit (ms)"
32+
description: "Minimum delay between Scryfall API calls in milliseconds"
33+
default: 100
34+
minimum: 10
35+
maximum: 5000
36+
MTG_MCP_MTGJSON_REFRESH_HOURS:
37+
type: integer
38+
title: "MTGJSON Refresh Interval (hours)"
39+
description: "Hours between MTGJSON bulk data refreshes"
40+
default: 24
41+
minimum: 1
42+
maximum: 168
43+
commandFunction: |-
44+
(config) => ({
45+
command: 'uvx',
46+
args: ['mtg-mcp-server'],
47+
env: {
48+
MTG_MCP_ENABLE_17LANDS: config.MTG_MCP_ENABLE_17LANDS !== undefined ? String(config.MTG_MCP_ENABLE_17LANDS) : undefined,
49+
MTG_MCP_ENABLE_EDHREC: config.MTG_MCP_ENABLE_EDHREC !== undefined ? String(config.MTG_MCP_ENABLE_EDHREC) : undefined,
50+
MTG_MCP_ENABLE_MTGJSON: config.MTG_MCP_ENABLE_MTGJSON !== undefined ? String(config.MTG_MCP_ENABLE_MTGJSON) : undefined,
51+
MTG_MCP_LOG_LEVEL: config.MTG_MCP_LOG_LEVEL || undefined,
52+
MTG_MCP_SCRYFALL_RATE_LIMIT_MS: config.MTG_MCP_SCRYFALL_RATE_LIMIT_MS !== undefined ? String(config.MTG_MCP_SCRYFALL_RATE_LIMIT_MS) : undefined,
53+
MTG_MCP_MTGJSON_REFRESH_HOURS: config.MTG_MCP_MTGJSON_REFRESH_HOURS !== undefined ? String(config.MTG_MCP_MTGJSON_REFRESH_HOURS) : undefined
54+
}
55+
})

src/mtg_mcp_server/server.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232
"MTG",
3333
mask_error_details=True,
3434
website_url="https://github.com/j4th/mtg-mcp-server",
35-
icons=[Icon(src="https://raw.githubusercontent.com/j4th/mtg-mcp-server/main/icon.svg")],
35+
icons=[
36+
Icon(
37+
src="https://raw.githubusercontent.com/j4th/mtg-mcp-server/main/icon.svg",
38+
mimeType="image/svg+xml",
39+
sizes=["512x512"],
40+
)
41+
],
3642
instructions=(
3743
"Magic: The Gathering data and analytics server.\n\n"
3844
"Tool categories:\n"

src/mtg_mcp_server/smithery.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
"""Smithery deployment integration.
2+
3+
Provides a ``create_server`` factory function decorated with the Smithery SDK
4+
so that Smithery can discover and serve this MCP server with session-scoped
5+
configuration. The config schema is exposed to the Smithery platform via the
6+
``_smithery_config_schema`` attribute set by the ``@smithery.server()``
7+
decorator.
8+
9+
This module is referenced from ``[tool.smithery]`` in *pyproject.toml* and
10+
only imported when running under Smithery — it is **not** imported by the
11+
normal ``mtg-mcp-server`` entry point.
12+
"""
13+
14+
from __future__ import annotations
15+
16+
from typing import Literal
17+
18+
from pydantic import BaseModel, Field
19+
from smithery.decorators import smithery
20+
21+
22+
class SmitheryConfig(BaseModel):
23+
"""Session configuration exposed to Smithery users."""
24+
25+
MTG_MCP_ENABLE_17LANDS: bool = Field(
26+
default=True,
27+
title="Enable 17Lands",
28+
description="Enable 17Lands draft analytics backend for card ratings and archetype stats",
29+
)
30+
MTG_MCP_ENABLE_EDHREC: bool = Field(
31+
default=True,
32+
title="Enable EDHREC",
33+
description="Enable EDHREC commander metagame backend (uses undocumented endpoints)",
34+
)
35+
MTG_MCP_ENABLE_MTGJSON: bool = Field(
36+
default=True,
37+
title="Enable MTGJSON",
38+
description="Enable MTGJSON bulk card data for rate-limit-free lookups (~100 MB download on first use)",
39+
)
40+
MTG_MCP_LOG_LEVEL: Literal["DEBUG", "INFO", "WARNING", "ERROR"] = Field(
41+
default="INFO",
42+
title="Log Level",
43+
description="Server logging level",
44+
)
45+
MTG_MCP_SCRYFALL_RATE_LIMIT_MS: int = Field(
46+
default=100,
47+
title="Scryfall Rate Limit (ms)",
48+
description="Minimum delay between Scryfall API calls in milliseconds",
49+
ge=10,
50+
le=5000,
51+
)
52+
MTG_MCP_MTGJSON_REFRESH_HOURS: int = Field(
53+
default=24,
54+
title="MTGJSON Refresh Interval (hours)",
55+
description="Hours between MTGJSON bulk data refreshes",
56+
ge=1,
57+
le=168,
58+
)
59+
60+
61+
@smithery.server(config_schema=SmitheryConfig)
62+
def create_server():
63+
from mtg_mcp_server.server import mcp
64+
65+
return mcp

uv.lock

Lines changed: 71 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)