mirror of
https://github.com/dnlbauer/cordra-mcp.git
synced 2026-09-11 22:25:30 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5451883739 | ||
|
|
7d74d8d9af | ||
|
|
f6bfb14b29 | ||
|
|
9c9594367c |
@@ -37,13 +37,14 @@ ensuring safe exploration without risk of data modification or corruption.
|
||||
|
||||
## Configuration
|
||||
|
||||
The MCP server can be configured using environment variables with the `CORDRA_` prefix:
|
||||
The MCP server can be configured using environment variables:
|
||||
|
||||
- `CORDRA_BASE_URL` - Cordra server URL (default: `https://localhost:8443`)
|
||||
- `CORDRA_USERNAME` - Username for authentication (optional)
|
||||
- `CORDRA_PASSWORD` - Password for authentication (optional)
|
||||
- `CORDRA_VERIFY_SSL` - SSL certificate verification (default: `true`)
|
||||
- `CORDRA_TIMEOUT` - Request timeout in seconds (default: `30`)
|
||||
- `LOGLEVEL` - Logging level (default: `INFO`, options: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`)
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "cordra-mcp"
|
||||
version = "1.2.0"
|
||||
version = "1.2.2"
|
||||
description = "MCP server for Cordra digital object repository"
|
||||
authors = [
|
||||
{name = "Daniel Bauer", email = "github@dbauer.me"},
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""MCP server for Cordra digital object repository."""
|
||||
|
||||
__version__ = "1.2.0"
|
||||
__version__ = "1.2.2"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Configuration settings for the MCP Cordra server."""
|
||||
|
||||
from pydantic import Field
|
||||
from pydantic import Field, field_validator
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
@@ -26,3 +26,21 @@ class CordraConfig(BaseSettings):
|
||||
default=True, description="Whether to verify SSL certificates"
|
||||
)
|
||||
timeout: int = Field(default=30, description="Request timeout in seconds")
|
||||
log_level: str = Field(
|
||||
default="INFO",
|
||||
description="Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)",
|
||||
validation_alias="LOGLEVEL",
|
||||
)
|
||||
|
||||
@field_validator("log_level", mode="before")
|
||||
@classmethod
|
||||
def validate_log_level(cls, v: str) -> str:
|
||||
"""Validate that log_level is a standard logging level."""
|
||||
level_str = str(v).upper().strip()
|
||||
valid_levels = {"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"}
|
||||
|
||||
if level_str not in valid_levels:
|
||||
raise ValueError(
|
||||
f"Invalid log level '{v}'. Must be one of: {', '.join(valid_levels)}"
|
||||
)
|
||||
return level_str
|
||||
|
||||
@@ -23,6 +23,7 @@ config = CordraConfig()
|
||||
cordra_client = CordraClient(config)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(config.log_level)
|
||||
|
||||
|
||||
@mcp.tool(
|
||||
@@ -32,7 +33,8 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
Examples:
|
||||
- /title:report - Find objects with 'report' in title
|
||||
- /author:smith - Find objects by author Smith
|
||||
- type:Person - Find all Persons. Note that "type" is special and uses no slash "/"
|
||||
- /author/name:Daniel - Find objects with author Daniel as nested property.
|
||||
- /name:John AND type:Person - Complex queries
|
||||
|
||||
Pagination:
|
||||
@@ -58,9 +60,11 @@ async def search_objects(
|
||||
|
||||
Args:
|
||||
query: The search query string (Lucene/Solr compatible). Examples:
|
||||
- "/title:report" - Find objects with "report" in title
|
||||
- "/author:smith" - Find objects by author Smith
|
||||
- "/name:John AND type:Person" - Complex queries
|
||||
- /title:report - Find objects with 'report' in title
|
||||
- type:Person - Find all Persons. Note that "type" is special and uses no slash "/"
|
||||
- /author/name:Daniel - Find objects with author Daniel as nested property.
|
||||
- /name:John AND type:Person - Complex queries
|
||||
|
||||
type: Optional filter by object type (e.g., "Person", "Document", "Project")
|
||||
limit: Page size - number of results per page (default: 25)
|
||||
page_num: Page number to retrieve, 0-based (default: 0 for first page)
|
||||
@@ -94,7 +98,8 @@ async def search_objects(
|
||||
|
||||
Examples:
|
||||
- /title:report - Count objects with 'report' in title
|
||||
- /author:smith - Count objects by author Smith
|
||||
- type:Person - Find all Persons. Note that "type" is special and uses no slash "/"
|
||||
- /author/name:Daniel - Find objects with author Daniel as nested property.
|
||||
- /name:John AND type:Person - Complex queries
|
||||
|
||||
Returns the count of objects as integer.
|
||||
@@ -108,9 +113,10 @@ async def count_objects(
|
||||
|
||||
Args:
|
||||
query: The search query string (Lucene/Solr compatible). Examples:
|
||||
- "/title:report" - Count objects with "report" in title
|
||||
- "/author:smith" - Count objects by author Smith
|
||||
- "/name:John AND type:Person" - Complex queries
|
||||
- /title:report - Find objects with 'report' in title
|
||||
- type:Person - Find all Persons. Note that "type" is special and uses no slash "/"
|
||||
- /author/name:Daniel - Find objects with author Daniel as nested property.
|
||||
- /name:John AND type:Person - Complex queries
|
||||
type: Optional filter by object type (e.g., "Person", "Document", "Project")
|
||||
|
||||
Returns:
|
||||
|
||||
Reference in New Issue
Block a user