Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ install:

format:
uv run ruff format .
uv run ruff check --fix .

lint:
uv run ruff check .
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ Perfect for enhancing AI conversations with data visualization capabilities. The
```json
{
"mcpServers": {
"math": {
"command": "npx",
"plotting": {
"command": "uvx",
"args": [
"mcp-remote",
"http://localhost:9090/mcp"
"--from", "/path/to/plotting-mcp",
"plotting-mcp", "--transport=stdio"
]
}
}
Expand Down
32 changes: 22 additions & 10 deletions src/plotting_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,30 @@ def health_check(request: Request) -> Response:
is_flag=True,
help="Enable auto-reload for development (default: False)",
)
def main(log_level: str = "INFO", reload: bool = False) -> None:
@click.option(
"--transport",
default="http",
type=click.Choice(["stdio", "http"]),
help="Transport type for the MCP server (default: http)",
)
def main(log_level: str = "INFO", reload: bool = False, transport: str = "http") -> None:
"""Main entry point for the MCP server."""
logging_dict = configure_logging(log_level=log_level)
uvicorn.run(
"plotting_mcp.server:starlette_app",
host=mcp.settings.host,
port=mcp.settings.port,
log_config=logging_dict,
reload=reload,
reload_dirs=[str(Path(__file__).parent.absolute())],
timeout_graceful_shutdown=2,
)

if transport == "stdio":
mcp.run("stdio")
elif transport == "http":
uvicorn.run(
"plotting_mcp.server:starlette_app",
host=mcp.settings.host,
port=mcp.settings.port,
log_config=logging_dict,
reload=reload,
reload_dirs=[str(Path(__file__).parent.absolute())],
timeout_graceful_shutdown=2,
)
else:
raise ValueError(f"Unsupported transport type: {transport}")


if __name__ == "__main__":
Expand Down