arcanna-mcp-server 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- arcanna_mcp_server-0.1.0/.github/workflows/build_image_and_package.yml +83 -0
- arcanna_mcp_server-0.1.0/.gitignore +4 -0
- arcanna_mcp_server-0.1.0/.python-version +1 -0
- arcanna_mcp_server-0.1.0/Dockerfile +36 -0
- arcanna_mcp_server-0.1.0/PKG-INFO +141 -0
- arcanna_mcp_server-0.1.0/README.md +126 -0
- arcanna_mcp_server-0.1.0/pyproject.toml +31 -0
- arcanna_mcp_server-0.1.0/src/__init__.py +0 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/__init__.py +7 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/constants.py +36 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/environment.py +20 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/models/base_resource.py +108 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/models/generic_events.py +30 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/models/resource_type.py +7 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/server.py +17 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/tools/__init__.py +21 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/tools/custom_code_block.py +168 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/tools/events.py +173 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/tools/generic_events.py +197 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/tools/health_check.py +31 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/tools/jobs.py +265 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/tools/resources.py +446 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/utils/__init__.py +0 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/utils/exceptions_handler.py +13 -0
- arcanna_mcp_server-0.1.0/src/arcanna_mcp_server/utils/tool_exception_response.py +10 -0
- arcanna_mcp_server-0.1.0/uv.lock +614 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: Build and Publish Docker Image and Pypi package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
- test-build
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
# First job to request approval
|
|
12
|
+
# request-approval:
|
|
13
|
+
# runs-on: ubuntu-latest
|
|
14
|
+
# steps:
|
|
15
|
+
# - name: Request approval
|
|
16
|
+
# uses: trstringer/manual-approval@v1
|
|
17
|
+
# with:
|
|
18
|
+
# secret: ${{ secrets.GITHUB_TOKEN }}
|
|
19
|
+
# approvers: DenisStefanAndrei,alinmanolache,AlexCornigeanu,marian-craciunescu,marius-avram,mateibm,AndreiTudose95,smmihai,RazvanKokovicsSiscale,hutanmihai,aburnaz
|
|
20
|
+
# minimum-approvals: 1
|
|
21
|
+
# issue-title: "Approval needed for Docker image push"
|
|
22
|
+
# issue-body: "Please approve this workflow to push a new Docker image to DockerHub"
|
|
23
|
+
# exclude-workflow-initiator-as-approver: false
|
|
24
|
+
# timeout-minutes: 120
|
|
25
|
+
|
|
26
|
+
deploy:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
environment: pypi-publish
|
|
29
|
+
permissions:
|
|
30
|
+
contents: read
|
|
31
|
+
id-token: write
|
|
32
|
+
|
|
33
|
+
steps:
|
|
34
|
+
- name: Checkout code
|
|
35
|
+
uses: actions/checkout@v3
|
|
36
|
+
|
|
37
|
+
- name: Set up Python
|
|
38
|
+
uses: actions/setup-python@v4
|
|
39
|
+
with:
|
|
40
|
+
python-version: '3.10'
|
|
41
|
+
|
|
42
|
+
- name: Install uv
|
|
43
|
+
run: |
|
|
44
|
+
python -m pip install --upgrade pip
|
|
45
|
+
pip install uv
|
|
46
|
+
|
|
47
|
+
- name: Install dependencies from pyproject.toml
|
|
48
|
+
run: |
|
|
49
|
+
uv pip install --system .
|
|
50
|
+
|
|
51
|
+
- name: Build package
|
|
52
|
+
run: uv build
|
|
53
|
+
|
|
54
|
+
- name: Verify package
|
|
55
|
+
run: |
|
|
56
|
+
ls -la dist/
|
|
57
|
+
|
|
58
|
+
- name: Publish package to PyPI
|
|
59
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
60
|
+
|
|
61
|
+
# Second job to build and push Docker image
|
|
62
|
+
# build-and-push:
|
|
63
|
+
# needs: request-approval # This ensures the approval job completes first
|
|
64
|
+
# runs-on: ubuntu-latest
|
|
65
|
+
# steps:
|
|
66
|
+
# - name: Checkout code
|
|
67
|
+
# uses: actions/checkout@v3
|
|
68
|
+
#
|
|
69
|
+
# - name: Set up Docker Buildx
|
|
70
|
+
# uses: docker/setup-buildx-action@v2
|
|
71
|
+
#
|
|
72
|
+
# - name: Login to DockerHub
|
|
73
|
+
# uses: docker/login-action@v2
|
|
74
|
+
# with:
|
|
75
|
+
# username: devsiscale
|
|
76
|
+
# password: ${{ secrets.DOCKERHUB_DEVSISCALE_PAT }}
|
|
77
|
+
#
|
|
78
|
+
# - name: Build and push
|
|
79
|
+
# uses: docker/build-push-action@v4
|
|
80
|
+
# with:
|
|
81
|
+
# context: .
|
|
82
|
+
# push: true
|
|
83
|
+
# tags: arcanna/arcanna-mcp-server:latest
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Use a Python image with uv pre-installed
|
|
2
|
+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS uv
|
|
3
|
+
|
|
4
|
+
# Install the project into `/app`
|
|
5
|
+
WORKDIR /app
|
|
6
|
+
|
|
7
|
+
# Enable bytecode compilation
|
|
8
|
+
ENV UV_COMPILE_BYTECODE=1
|
|
9
|
+
|
|
10
|
+
# Copy from the cache instead of linking since it's a mounted volume
|
|
11
|
+
ENV UV_LINK_MODE=copy
|
|
12
|
+
|
|
13
|
+
# Install the project's dependencies using the lockfile and settings
|
|
14
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
15
|
+
--mount=type=bind,source=uv.lock,target=uv.lock \
|
|
16
|
+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
|
17
|
+
uv sync --frozen --no-install-project --no-dev --no-editable
|
|
18
|
+
|
|
19
|
+
# Then, add the rest of the project source code and install it
|
|
20
|
+
# Installing separately from its dependencies allows optimal layer caching
|
|
21
|
+
ADD . /app
|
|
22
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
23
|
+
uv sync --frozen --no-dev --no-editable
|
|
24
|
+
|
|
25
|
+
FROM python:3.12-slim-bookworm
|
|
26
|
+
|
|
27
|
+
WORKDIR /app
|
|
28
|
+
|
|
29
|
+
COPY --from=uv /root/.local /root/.local
|
|
30
|
+
COPY --from=uv --chown=app:app /app/.venv /app/.venv
|
|
31
|
+
|
|
32
|
+
# Place executables in the environment at the front of the path
|
|
33
|
+
ENV PATH="/app/.venv/bin:$PATH"
|
|
34
|
+
|
|
35
|
+
# when running the container, add --db-path and a bind mount to the host's db file
|
|
36
|
+
ENTRYPOINT ["arcanna-mcp-server"]
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: arcanna-mcp-server
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Arcanna MCP server allows user to interact with Arcanna's AI use cases through the Model Context Protocol (MCP).
|
|
5
|
+
Project-URL: homepage, https://github.com/siscale/arcanna-mcp-server
|
|
6
|
+
Author-email: DevSiscale <dev@siscale.com>
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Requires-Dist: fastapi>=0.115.6
|
|
9
|
+
Requires-Dist: mcp[cli]>=1.2.1
|
|
10
|
+
Requires-Dist: requests>=2.32.3
|
|
11
|
+
Requires-Dist: starlette>=0.46.0
|
|
12
|
+
Requires-Dist: uv>=0.6.9
|
|
13
|
+
Requires-Dist: uvx>=2.5.1
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# Arcanna MCP Server
|
|
17
|
+
|
|
18
|
+
The Arcanna MCP server allows user to interact with Arcanna's AI use cases through the Model Context Protocol (MCP).
|
|
19
|
+
|
|
20
|
+
## Usage with Claude Desktop or other MCP Clients
|
|
21
|
+
|
|
22
|
+
### Option 1 - uvx
|
|
23
|
+
#### Prerequisites
|
|
24
|
+
- uv - https://docs.astral.sh/uv/getting-started/installation/#installation-methods
|
|
25
|
+
|
|
26
|
+
#### Configuration
|
|
27
|
+
Add the following entry to the `mcpServers` section in your MCP client config file (`claude_desktop_config.json` for Claude
|
|
28
|
+
Desktop).
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"arcanna": {
|
|
34
|
+
"command": "uvx",
|
|
35
|
+
"args": [
|
|
36
|
+
"arcanna-mcp"
|
|
37
|
+
],
|
|
38
|
+
"env": {
|
|
39
|
+
"ARCANNA_INPUT_API_KEY": "YOUR_ARCANNA_INPUT_API_KEY",
|
|
40
|
+
"ARCANNA_MANAGEMENT_API_KEY": "YOUR_ARCANNA_MANAGEMENT_API_KEY",
|
|
41
|
+
"ARCANNA_HOST": "YOUR_ARCANNA_HOST",
|
|
42
|
+
"ARCANNA_USER": "YOUR_USERNAME"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Option 2 - Building local image from this repository
|
|
50
|
+
#### Prerequisites
|
|
51
|
+
- Docker - https://docs.docker.com/engine/install/
|
|
52
|
+
|
|
53
|
+
#### Configuration
|
|
54
|
+
1. Change directory to the directory where the Dockerfile is.
|
|
55
|
+
2. Run ```docker build -t mcp/arcanna . --progress=plain --no-cache```
|
|
56
|
+
3. Add the configuration bellow to your claude desktop config.
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"mcpServers": {
|
|
60
|
+
"arcanna-mcp": {
|
|
61
|
+
"command": "docker",
|
|
62
|
+
"args": [
|
|
63
|
+
"run",
|
|
64
|
+
"-i",
|
|
65
|
+
"--rm",
|
|
66
|
+
"-e",
|
|
67
|
+
"ARCANNA_INPUT_API_KEY",
|
|
68
|
+
"-e",
|
|
69
|
+
"ARCANNA_MANAGEMENT_API_KEY",
|
|
70
|
+
"-e",
|
|
71
|
+
"ARCANNA_HOST",
|
|
72
|
+
"-e",
|
|
73
|
+
"ARCANNA_USER",
|
|
74
|
+
"mcp/arcanna"
|
|
75
|
+
],
|
|
76
|
+
"env": {
|
|
77
|
+
"ARCANNA_INPUT_API_KEY": "<YOUR_ARCANNA_API_KEY_HERE>",
|
|
78
|
+
"ARCANNA_MANAGEMENT_API_KEY": "<ARCANNA_MANAGEMENT_API_KEY>",
|
|
79
|
+
"ARCANNA_HOST": "<YOUR_ARCANNA_HOST_HERE>",
|
|
80
|
+
"ARCANNA_USER": "<YOUR_USERNAME_HERE>"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## Features
|
|
89
|
+
|
|
90
|
+
- **Job Management**: Create, retrieve, start, stop, and train jobs
|
|
91
|
+
- **Event Processing**: Send events for AI-powered decision making
|
|
92
|
+
- **Feedback System**: Provide feedback on decisions to improve model accuracy
|
|
93
|
+
- **Health Monitoring**: Check server and API key status
|
|
94
|
+
|
|
95
|
+
## Tools
|
|
96
|
+
|
|
97
|
+
### Job Management
|
|
98
|
+
- **get_jobs**
|
|
99
|
+
- Retrieve all jobs associated with your API key
|
|
100
|
+
- Returns a list of job details including status, labels, and processing metrics
|
|
101
|
+
|
|
102
|
+
- **get_job_by_id**
|
|
103
|
+
- Retrieve specific job details by ID
|
|
104
|
+
|
|
105
|
+
- **get_job_by_name**
|
|
106
|
+
- Retrieve specific job details by name
|
|
107
|
+
|
|
108
|
+
- **get_job_labels**
|
|
109
|
+
- Retrieve decision labels for a specific job
|
|
110
|
+
|
|
111
|
+
- **get_labels_of_job_by_name**
|
|
112
|
+
- Retrieve decision labels for a job by name
|
|
113
|
+
|
|
114
|
+
- **start_job**
|
|
115
|
+
- Begin event ingestion for a job
|
|
116
|
+
|
|
117
|
+
- **stop_job**
|
|
118
|
+
- Stop event ingestion for a job
|
|
119
|
+
|
|
120
|
+
- **train_job**
|
|
121
|
+
- Train the job's AI model using the provided feedback
|
|
122
|
+
|
|
123
|
+
### Event Management
|
|
124
|
+
- **send_event**
|
|
125
|
+
- Submit an event to Arcanna for AI decision-making
|
|
126
|
+
|
|
127
|
+
- **send_event_with_id**
|
|
128
|
+
- Submit an event with a custom identifier
|
|
129
|
+
|
|
130
|
+
- **get_event_by_id**
|
|
131
|
+
- Retrieve event details and decision results
|
|
132
|
+
|
|
133
|
+
### Feedback System
|
|
134
|
+
- **send_feedback_for_event**
|
|
135
|
+
- Provide feedback on AI decisions for model improvement
|
|
136
|
+
|
|
137
|
+
### System Health
|
|
138
|
+
- **health_check**
|
|
139
|
+
- Verify server status and API key validity
|
|
140
|
+
- Returns API key authorization status
|
|
141
|
+
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Arcanna MCP Server
|
|
2
|
+
|
|
3
|
+
The Arcanna MCP server allows user to interact with Arcanna's AI use cases through the Model Context Protocol (MCP).
|
|
4
|
+
|
|
5
|
+
## Usage with Claude Desktop or other MCP Clients
|
|
6
|
+
|
|
7
|
+
### Option 1 - uvx
|
|
8
|
+
#### Prerequisites
|
|
9
|
+
- uv - https://docs.astral.sh/uv/getting-started/installation/#installation-methods
|
|
10
|
+
|
|
11
|
+
#### Configuration
|
|
12
|
+
Add the following entry to the `mcpServers` section in your MCP client config file (`claude_desktop_config.json` for Claude
|
|
13
|
+
Desktop).
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"mcpServers": {
|
|
18
|
+
"arcanna": {
|
|
19
|
+
"command": "uvx",
|
|
20
|
+
"args": [
|
|
21
|
+
"arcanna-mcp"
|
|
22
|
+
],
|
|
23
|
+
"env": {
|
|
24
|
+
"ARCANNA_INPUT_API_KEY": "YOUR_ARCANNA_INPUT_API_KEY",
|
|
25
|
+
"ARCANNA_MANAGEMENT_API_KEY": "YOUR_ARCANNA_MANAGEMENT_API_KEY",
|
|
26
|
+
"ARCANNA_HOST": "YOUR_ARCANNA_HOST",
|
|
27
|
+
"ARCANNA_USER": "YOUR_USERNAME"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Option 2 - Building local image from this repository
|
|
35
|
+
#### Prerequisites
|
|
36
|
+
- Docker - https://docs.docker.com/engine/install/
|
|
37
|
+
|
|
38
|
+
#### Configuration
|
|
39
|
+
1. Change directory to the directory where the Dockerfile is.
|
|
40
|
+
2. Run ```docker build -t mcp/arcanna . --progress=plain --no-cache```
|
|
41
|
+
3. Add the configuration bellow to your claude desktop config.
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"mcpServers": {
|
|
45
|
+
"arcanna-mcp": {
|
|
46
|
+
"command": "docker",
|
|
47
|
+
"args": [
|
|
48
|
+
"run",
|
|
49
|
+
"-i",
|
|
50
|
+
"--rm",
|
|
51
|
+
"-e",
|
|
52
|
+
"ARCANNA_INPUT_API_KEY",
|
|
53
|
+
"-e",
|
|
54
|
+
"ARCANNA_MANAGEMENT_API_KEY",
|
|
55
|
+
"-e",
|
|
56
|
+
"ARCANNA_HOST",
|
|
57
|
+
"-e",
|
|
58
|
+
"ARCANNA_USER",
|
|
59
|
+
"mcp/arcanna"
|
|
60
|
+
],
|
|
61
|
+
"env": {
|
|
62
|
+
"ARCANNA_INPUT_API_KEY": "<YOUR_ARCANNA_API_KEY_HERE>",
|
|
63
|
+
"ARCANNA_MANAGEMENT_API_KEY": "<ARCANNA_MANAGEMENT_API_KEY>",
|
|
64
|
+
"ARCANNA_HOST": "<YOUR_ARCANNA_HOST_HERE>",
|
|
65
|
+
"ARCANNA_USER": "<YOUR_USERNAME_HERE>"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Features
|
|
74
|
+
|
|
75
|
+
- **Job Management**: Create, retrieve, start, stop, and train jobs
|
|
76
|
+
- **Event Processing**: Send events for AI-powered decision making
|
|
77
|
+
- **Feedback System**: Provide feedback on decisions to improve model accuracy
|
|
78
|
+
- **Health Monitoring**: Check server and API key status
|
|
79
|
+
|
|
80
|
+
## Tools
|
|
81
|
+
|
|
82
|
+
### Job Management
|
|
83
|
+
- **get_jobs**
|
|
84
|
+
- Retrieve all jobs associated with your API key
|
|
85
|
+
- Returns a list of job details including status, labels, and processing metrics
|
|
86
|
+
|
|
87
|
+
- **get_job_by_id**
|
|
88
|
+
- Retrieve specific job details by ID
|
|
89
|
+
|
|
90
|
+
- **get_job_by_name**
|
|
91
|
+
- Retrieve specific job details by name
|
|
92
|
+
|
|
93
|
+
- **get_job_labels**
|
|
94
|
+
- Retrieve decision labels for a specific job
|
|
95
|
+
|
|
96
|
+
- **get_labels_of_job_by_name**
|
|
97
|
+
- Retrieve decision labels for a job by name
|
|
98
|
+
|
|
99
|
+
- **start_job**
|
|
100
|
+
- Begin event ingestion for a job
|
|
101
|
+
|
|
102
|
+
- **stop_job**
|
|
103
|
+
- Stop event ingestion for a job
|
|
104
|
+
|
|
105
|
+
- **train_job**
|
|
106
|
+
- Train the job's AI model using the provided feedback
|
|
107
|
+
|
|
108
|
+
### Event Management
|
|
109
|
+
- **send_event**
|
|
110
|
+
- Submit an event to Arcanna for AI decision-making
|
|
111
|
+
|
|
112
|
+
- **send_event_with_id**
|
|
113
|
+
- Submit an event with a custom identifier
|
|
114
|
+
|
|
115
|
+
- **get_event_by_id**
|
|
116
|
+
- Retrieve event details and decision results
|
|
117
|
+
|
|
118
|
+
### Feedback System
|
|
119
|
+
- **send_feedback_for_event**
|
|
120
|
+
- Provide feedback on AI decisions for model improvement
|
|
121
|
+
|
|
122
|
+
### System Health
|
|
123
|
+
- **health_check**
|
|
124
|
+
- Verify server status and API key validity
|
|
125
|
+
- Returns API key authorization status
|
|
126
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "arcanna-mcp-server"
|
|
3
|
+
authors = [
|
|
4
|
+
{ name="DevSiscale", email="dev@siscale.com" },
|
|
5
|
+
]
|
|
6
|
+
version = "0.1.0"
|
|
7
|
+
description = "The Arcanna MCP server allows user to interact with Arcanna's AI use cases through the Model Context Protocol (MCP)."
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"mcp[cli]>=1.2.1",
|
|
12
|
+
"requests>=2.32.3",
|
|
13
|
+
"fastapi>=0.115.6",
|
|
14
|
+
"starlette>=0.46.0",
|
|
15
|
+
"uv>=0.6.9",
|
|
16
|
+
"uvx>=2.5.1"
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
[build-system]
|
|
21
|
+
requires = ["hatchling"]
|
|
22
|
+
build-backend = "hatchling.build"
|
|
23
|
+
|
|
24
|
+
[tool.uv]
|
|
25
|
+
dev-dependencies = ["pyright>=1.1.389"]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
arcanna-mcp-server = "arcanna_mcp_server:main"
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
homepage = "https://github.com/siscale/arcanna-mcp-server"
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from arcanna_mcp_server.environment import ARCANNA_HOST
|
|
2
|
+
|
|
3
|
+
# event ingestion
|
|
4
|
+
SEND_EVENT_URL = ARCANNA_HOST + "/api/v1/events"
|
|
5
|
+
SEND_EVENT_WITH_ID_URL = ARCANNA_HOST + "/api/v1/events/{}"
|
|
6
|
+
|
|
7
|
+
# event retrieval
|
|
8
|
+
RETRIEVE_EVENT_BY_ID_URL = ARCANNA_HOST + "/api/v1/events/{}/{}" # /job_id/event_id
|
|
9
|
+
|
|
10
|
+
# event feedback
|
|
11
|
+
EVENT_FEEDBACK_URL = ARCANNA_HOST + "/api/v1/events/{}/{}/feedback"
|
|
12
|
+
|
|
13
|
+
GET_JOBS_URL = ARCANNA_HOST + "/api/v1/jobs"
|
|
14
|
+
GET_JOB_BY_ID_URL = ARCANNA_HOST + "/api/v1/jobs/{}"
|
|
15
|
+
GET_JOB_LABELS_URL = ARCANNA_HOST + "/api/v1/jobs/{}/labels"
|
|
16
|
+
START_JOB_URL = ARCANNA_HOST + "/api/v1/jobs/{}/start"
|
|
17
|
+
STOP_JOB_URL = ARCANNA_HOST + "/api/v1/jobs/{}/stop"
|
|
18
|
+
TRAIN_JOB_URL = ARCANNA_HOST + "/api/v1/jobs/{}/train"
|
|
19
|
+
GET_JOB_BY_NAME_URL = ARCANNA_HOST + "/api/v1/jobs/get_by_name"
|
|
20
|
+
GET_LABELS_OF_JOB_BY_NAME_URL = ARCANNA_HOST + "/api/v1/jobs/get_by_name/labels"
|
|
21
|
+
|
|
22
|
+
# healthcheck
|
|
23
|
+
HEALTH_CHECK_URL = ARCANNA_HOST + "/api/v1/health/"
|
|
24
|
+
|
|
25
|
+
# custom code block
|
|
26
|
+
CUSTOM_CODE_BLOCK_TEST_URL = ARCANNA_HOST + "/api/v2/custom_code_execution/test"
|
|
27
|
+
CUSTOM_CODE_BLOCK_SAVE_URL = ARCANNA_HOST + "/api/v2/custom_code_execution/save"
|
|
28
|
+
|
|
29
|
+
# resources CRUD operations
|
|
30
|
+
RESOURCES_CRUD_URL = ARCANNA_HOST + "/api/v2/resources"
|
|
31
|
+
|
|
32
|
+
# integration parameters schema
|
|
33
|
+
INTEGRATION_PARAMETERS_SCHEMA_URL = ARCANNA_HOST + "/api/v2/resources/integration/parameters/schema"
|
|
34
|
+
|
|
35
|
+
# events operations
|
|
36
|
+
QUERY_EVENTS_URL = ARCANNA_HOST + "/api/v2/events/query"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
MANAGEMENT_API_KEY = os.getenv("ARCANNA_MANAGEMENT_API_KEY")
|
|
4
|
+
API_KEY = os.getenv("ARCANNA_INPUT_API_KEY")
|
|
5
|
+
ARCANNA_HOST = os.getenv("ARCANNA_HOST", "")
|
|
6
|
+
ARCANNA_USER = "MCP" + "-" + (os.getenv("ARCANNA_USER") or "user")
|
|
7
|
+
TRANSPORT_MODE = os.getenv("TRANSPORT_MODE", "stdio")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def validate_environment_variables():
|
|
11
|
+
if MANAGEMENT_API_KEY is None:
|
|
12
|
+
raise Exception("Arcanna management api key not found")
|
|
13
|
+
if API_KEY is None:
|
|
14
|
+
raise Exception("Arcanna input API KEY not found.")
|
|
15
|
+
|
|
16
|
+
if ARCANNA_HOST is None:
|
|
17
|
+
raise Exception("Arcanna HOST not found.")
|
|
18
|
+
|
|
19
|
+
if TRANSPORT_MODE not in ["stdio", "sse"]:
|
|
20
|
+
raise Exception(f"TRANSPORT_MODE {TRANSPORT_MODE} not supported.")
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
|
|
2
|
+
from pydantic import BaseModel, Field, computed_field
|
|
3
|
+
from typing import Annotated, Any, Dict, List, Literal, Optional, Union
|
|
4
|
+
|
|
5
|
+
from arcanna_mcp_server.models.resource_type import ResourceType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ApiKeyProperties(BaseModel):
|
|
9
|
+
name: str
|
|
10
|
+
|
|
11
|
+
@computed_field
|
|
12
|
+
@property
|
|
13
|
+
def title(self) -> str:
|
|
14
|
+
return self.name
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class IntegrationProperties(BaseModel):
|
|
18
|
+
title: str
|
|
19
|
+
integration_type: str
|
|
20
|
+
parameters: Dict[str, Any]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Label(BaseModel):
|
|
24
|
+
name: str
|
|
25
|
+
hex_color: str
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class AutoRetrainOptions(BaseModel):
|
|
29
|
+
class AutoRetrainBlockers(BaseModel):
|
|
30
|
+
consensus_flipping: bool = Field(default=False, description="Buckets/events with flipping consensus")
|
|
31
|
+
low_confidence_score: bool = Field(default=False, description="Buckets/events with low confidence score")
|
|
32
|
+
undecided_consensus: bool = Field(default=False, description="Bucket/events with undecided consensus")
|
|
33
|
+
consensus_low_score: bool = Field(default=False, description="Buckets/events with low consensus score")
|
|
34
|
+
outliers: bool = Field(default=False, description="Outliers")
|
|
35
|
+
consensus_changes: bool = Field(default=False, description="Consensus changes since last training session")
|
|
36
|
+
|
|
37
|
+
enabled: bool
|
|
38
|
+
cron: str
|
|
39
|
+
blockers: Optional[AutoRetrainBlockers] = Field(default=None)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class MonitoringSettings(BaseModel):
|
|
43
|
+
class MonitorInfo(BaseModel):
|
|
44
|
+
name: Literal[
|
|
45
|
+
"results_with_error_logs_in_last_x_minutes",
|
|
46
|
+
"error_job_state_in_last_x_minutes",
|
|
47
|
+
"no_data_processed_in_last_x_minutes"
|
|
48
|
+
]
|
|
49
|
+
active: bool
|
|
50
|
+
interval_check: int
|
|
51
|
+
|
|
52
|
+
throttling: int
|
|
53
|
+
monitors: List[MonitorInfo]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class JobProperties(BaseModel):
|
|
57
|
+
class PipelineIntegration(BaseModel):
|
|
58
|
+
resource: str
|
|
59
|
+
integration_type: str
|
|
60
|
+
enabled: bool
|
|
61
|
+
auto_id: Optional[str] = Field(default=None)
|
|
62
|
+
parameters: Dict[str, Any]
|
|
63
|
+
|
|
64
|
+
class Feature(BaseModel):
|
|
65
|
+
name: str
|
|
66
|
+
type: str
|
|
67
|
+
|
|
68
|
+
class AdvancedSettings(BaseModel):
|
|
69
|
+
custom_labels: Optional[List[Label]] = Field(default=None)
|
|
70
|
+
auto_retrain: Optional[AutoRetrainOptions] = Field(default=None, description="Auto retrain settings")
|
|
71
|
+
monitoring_settings: Optional[MonitoringSettings] = Field(default=None, description="Monitoring settings")
|
|
72
|
+
|
|
73
|
+
title: str
|
|
74
|
+
description: Optional[str] = None
|
|
75
|
+
category: str
|
|
76
|
+
features: List[str]
|
|
77
|
+
feedback_columns: Optional[List[str]] = None
|
|
78
|
+
advanced_settings: Optional[AdvancedSettings] = None
|
|
79
|
+
pipeline_integrations: List[PipelineIntegration]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
ResourcePropertiesType = Union[ApiKeyProperties, IntegrationProperties, JobProperties]
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class ResourceCommon(BaseModel):
|
|
86
|
+
type: Any
|
|
87
|
+
depends_on: Optional[List[str]] = Field(default=[])
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class ApiKeyResource(ResourceCommon):
|
|
91
|
+
type: Literal[ResourceType.API_KEY] = ResourceType.API_KEY.value
|
|
92
|
+
properties: ApiKeyProperties
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class IntegrationResource(ResourceCommon):
|
|
96
|
+
type: Literal[ResourceType.INTEGRATION] = ResourceType.INTEGRATION.value
|
|
97
|
+
properties: IntegrationProperties
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class JobResource(ResourceCommon):
|
|
101
|
+
type: Literal[ResourceType.JOB] = ResourceType.JOB.value
|
|
102
|
+
properties: JobProperties
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
ResourceUnionType = Union[ApiKeyResource, IntegrationResource, JobResource]
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
BaseResource = Annotated[ResourceUnionType, Field(discriminator='type')]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from typing import Optional, List, Any, Union, Dict, Literal
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Filter(BaseModel):
|
|
6
|
+
field: str
|
|
7
|
+
operator: Literal["is", "is not", "is one of", "is not one of", "starts with", "not starts with", "contains", "not contains", "exists", "not exists", "lt", "lte", "gte", "gte"]
|
|
8
|
+
value: Any
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class QueryEventsRequest(BaseModel):
|
|
12
|
+
job_ids: Optional[Union[List[int], int]] = None
|
|
13
|
+
job_titles: Optional[Union[List[str], str]] = None
|
|
14
|
+
event_ids: Optional[Union[List[str], str]] = None
|
|
15
|
+
decision_points_only: Optional[bool] = False
|
|
16
|
+
start_date: Optional[str] = None
|
|
17
|
+
end_date: Optional[str] = None
|
|
18
|
+
size: Optional[int] = Field(default=5)
|
|
19
|
+
sort_by_column: Optional[str] = Field(default="timestamp_inference")
|
|
20
|
+
sort_order: Literal['desc', 'asc'] = Field(default="desc")
|
|
21
|
+
filters: List[Filter] = Field(default_factory=list)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class EventModel(BaseModel):
|
|
25
|
+
event_id: str
|
|
26
|
+
job_id: int
|
|
27
|
+
job_title: str
|
|
28
|
+
decision_points: Dict[str, Any]
|
|
29
|
+
arcanna: Dict[str, Any]
|
|
30
|
+
raw_event: Optional[Dict[str, Any]] = None
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from mcp.server import FastMCP
|
|
2
|
+
|
|
3
|
+
from arcanna_mcp_server.environment import TRANSPORT_MODE
|
|
4
|
+
from arcanna_mcp_server.tools import attach_tools
|
|
5
|
+
|
|
6
|
+
mcp = FastMCP("arcanna_mcp-server")
|
|
7
|
+
|
|
8
|
+
attach_tools(mcp)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def main():
|
|
12
|
+
# Initialize and run the server
|
|
13
|
+
mcp.run(transport=TRANSPORT_MODE)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
if __name__ == '__main__':
|
|
17
|
+
main()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import arcanna_mcp_server.tools.resources
|
|
2
|
+
from mcp.server import FastMCP
|
|
3
|
+
import arcanna_mcp_server.tools.jobs
|
|
4
|
+
import arcanna_mcp_server.tools.events
|
|
5
|
+
import arcanna_mcp_server.tools.health_check
|
|
6
|
+
import arcanna_mcp_server.tools.custom_code_block
|
|
7
|
+
import arcanna_mcp_server.tools.generic_events
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def attach_tools(mcp_server: FastMCP):
|
|
11
|
+
modules = [
|
|
12
|
+
arcanna_mcp_server.tools.jobs,
|
|
13
|
+
arcanna_mcp_server.tools.events,
|
|
14
|
+
arcanna_mcp_server.tools.health_check,
|
|
15
|
+
arcanna_mcp_server.tools.custom_code_block,
|
|
16
|
+
arcanna_mcp_server.tools.resources,
|
|
17
|
+
arcanna_mcp_server.tools.generic_events
|
|
18
|
+
]
|
|
19
|
+
for module in modules:
|
|
20
|
+
for tool_fn in module.export_tools():
|
|
21
|
+
mcp_server.add_tool(tool_fn)
|