mirror of
https://github.com/dnlbauer/cordra-mcp.git
synced 2026-09-11 06:05:29 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bee7f2775 | ||
|
|
adc24dd4ad | ||
|
|
99fdaadea6 | ||
|
|
8b0694dff1 |
@@ -1,5 +1,7 @@
|
|||||||
FROM python:3.13-alpine
|
FROM python:3.13-alpine
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
# Install package manager
|
# Install package manager
|
||||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
|
||||||
@@ -18,4 +20,6 @@ COPY src src
|
|||||||
RUN uv sync \
|
RUN uv sync \
|
||||||
--locked
|
--locked
|
||||||
|
|
||||||
|
ENV CORDRA_RUN_MODE=http
|
||||||
|
|
||||||
CMD ["uv", "run", "cordra-mcp"]
|
CMD ["uv", "run", "cordra-mcp"]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "cordra-mcp"
|
name = "cordra-mcp"
|
||||||
version = "1.3"
|
version = "1.3.1.1"
|
||||||
description = "MCP server for Cordra digital object repository"
|
description = "MCP server for Cordra digital object repository"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Daniel Bauer", email = "github@dbauer.me"},
|
{name = "Daniel Bauer", email = "github@dbauer.me"},
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
"""MCP server for Cordra digital object repository."""
|
"""MCP server for Cordra digital object repository."""
|
||||||
|
|
||||||
__version__ = "1.3"
|
__version__ = "1.3.1"
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
"""Configuration settings for the MCP Cordra server."""
|
"""Configuration settings for the MCP Cordra server."""
|
||||||
|
|
||||||
|
from typing import Literal
|
||||||
|
|
||||||
from pydantic import Field, field_validator
|
from pydantic import Field, field_validator
|
||||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||||
|
|
||||||
@@ -16,6 +18,10 @@ class CordraConfig(BaseSettings):
|
|||||||
default="https://localhost:8443",
|
default="https://localhost:8443",
|
||||||
description="Base URL of the Cordra repository",
|
description="Base URL of the Cordra repository",
|
||||||
)
|
)
|
||||||
|
host: str = Field(
|
||||||
|
default="0.0.0.0",
|
||||||
|
description="The host under which the MCP server runs when deployed as http run_mode",
|
||||||
|
)
|
||||||
username: str | None = Field(
|
username: str | None = Field(
|
||||||
default=None, description="Username for Cordra authentication"
|
default=None, description="Username for Cordra authentication"
|
||||||
)
|
)
|
||||||
@@ -26,6 +32,9 @@ class CordraConfig(BaseSettings):
|
|||||||
default=True, description="Whether to verify SSL certificates"
|
default=True, description="Whether to verify SSL certificates"
|
||||||
)
|
)
|
||||||
timeout: int = Field(default=30, description="Request timeout in seconds")
|
timeout: int = Field(default=30, description="Request timeout in seconds")
|
||||||
|
run_mode: Literal["stdio", "http"] | None = Field(
|
||||||
|
default="stdio", description="Run mode for the MCP client"
|
||||||
|
)
|
||||||
log_level: str = Field(
|
log_level: str = Field(
|
||||||
default="INFO",
|
default="INFO",
|
||||||
description="Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)",
|
description="Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)",
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ from .client import (
|
|||||||
from .config import CordraConfig
|
from .config import CordraConfig
|
||||||
|
|
||||||
# Initialize the MCP server
|
# Initialize the MCP server
|
||||||
mcp = FastMCP("cordra-mcp")
|
config = CordraConfig()
|
||||||
|
mcp = FastMCP("cordra-mcp", host=config.host, port=8000)
|
||||||
|
|
||||||
# Initialize Cordra client at startup
|
# Initialize Cordra client at startup
|
||||||
config = CordraConfig()
|
|
||||||
cordra_client = CordraClient(config)
|
cordra_client = CordraClient(config)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -311,8 +311,11 @@ async def initialize_server() -> None:
|
|||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
"""Main entry point for the MCP server."""
|
"""Main entry point for the MCP server."""
|
||||||
asyncio.run(initialize_server())
|
if config.run_mode == "stdio":
|
||||||
mcp.run()
|
asyncio.run(initialize_server())
|
||||||
|
mcp.run()
|
||||||
|
else:
|
||||||
|
mcp.run(transport="streamable-http")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
2
uv.lock
generated
2
uv.lock
generated
@@ -113,7 +113,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cordra-mcp"
|
name = "cordra-mcp"
|
||||||
version = "1.3"
|
version = "1.3.1.1"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "mcp", extra = ["cli"] },
|
{ name = "mcp", extra = ["cli"] },
|
||||||
|
|||||||
Reference in New Issue
Block a user