openlayer-mcp 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.
- openlayer_mcp-0.1.0/.github/workflows/publish-pypi.yaml +28 -0
- openlayer_mcp-0.1.0/.gitignore +12 -0
- openlayer_mcp-0.1.0/.python-version +1 -0
- openlayer_mcp-0.1.0/PKG-INFO +62 -0
- openlayer_mcp-0.1.0/README.md +53 -0
- openlayer_mcp-0.1.0/pyproject.toml +17 -0
- openlayer_mcp-0.1.0/src/openlayer_mcp/__init__.py +6 -0
- openlayer_mcp-0.1.0/src/openlayer_mcp/__main__.py +4 -0
- openlayer_mcp-0.1.0/src/openlayer_mcp/openlayer_platform.py +164 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: "Publish to PyPI"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: ["published"]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
run:
|
|
9
|
+
name: "Build and publish release"
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Install uv
|
|
16
|
+
uses: astral-sh/setup-uv@v5
|
|
17
|
+
with:
|
|
18
|
+
enable-cache: true
|
|
19
|
+
cache-dependency-glob: uv.lock
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
run: uv python install 3.10
|
|
23
|
+
|
|
24
|
+
- name: Build
|
|
25
|
+
run: uv build
|
|
26
|
+
|
|
27
|
+
- name: Publish
|
|
28
|
+
run: uv publish -t ${{ secrets.PYPI_TOKEN }}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: openlayer-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for the Openlayer platform
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Requires-Dist: mcp[cli]>=1.6.0
|
|
7
|
+
Requires-Dist: openlayer>=0.2.0a51
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# Openlayer MCP
|
|
11
|
+
|
|
12
|
+
[MCP](https://github.com/modelcontextprotocol) (Model Context Protocol) server for
|
|
13
|
+
the Openlayer platform. This allows MCP clients (such as Cursor, VSCode,
|
|
14
|
+
Claude Desktop, etc.) to interact with the Openlayer platform.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
uv add openlayer-mcp
|
|
20
|
+
```
|
|
21
|
+
or
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install openlayer-mcp
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
To use the Openlayer MCP server in your IDE or desktop app, you need to add it
|
|
30
|
+
to the MCP configuration file.
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"openlayer": {
|
|
36
|
+
"command": "uvx",
|
|
37
|
+
"args": [
|
|
38
|
+
"openlayer_mcp"
|
|
39
|
+
],
|
|
40
|
+
"env": {
|
|
41
|
+
"OPENLAYER_API_KEY": "YOUR_OPENLAYER_API_KEY_HERE"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
You can alternatively run it as a standalone server with:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
uv run -m openlayer_mcp
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Openlayer MCP
|
|
2
|
+
|
|
3
|
+
[MCP](https://github.com/modelcontextprotocol) (Model Context Protocol) server for
|
|
4
|
+
the Openlayer platform. This allows MCP clients (such as Cursor, VSCode,
|
|
5
|
+
Claude Desktop, etc.) to interact with the Openlayer platform.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
uv add openlayer-mcp
|
|
11
|
+
```
|
|
12
|
+
or
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install openlayer-mcp
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
To use the Openlayer MCP server in your IDE or desktop app, you need to add it
|
|
21
|
+
to the MCP configuration file.
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"openlayer": {
|
|
27
|
+
"command": "uvx",
|
|
28
|
+
"args": [
|
|
29
|
+
"openlayer_mcp"
|
|
30
|
+
],
|
|
31
|
+
"env": {
|
|
32
|
+
"OPENLAYER_API_KEY": "YOUR_OPENLAYER_API_KEY_HERE"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
You can alternatively run it as a standalone server with:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
uv run -m openlayer_mcp
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "openlayer-mcp"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "MCP server for the Openlayer platform"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"mcp[cli]>=1.6.0",
|
|
9
|
+
"openlayer>=0.2.0a51",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[project.scripts]
|
|
13
|
+
openlayer-mcp = "openlayer_mcp:main"
|
|
14
|
+
|
|
15
|
+
[build-system]
|
|
16
|
+
requires = ["hatchling"]
|
|
17
|
+
build-backend = "hatchling.build"
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"""Openlayer platform MCP server.
|
|
2
|
+
|
|
3
|
+
Provides tools that an MCP client can use to interact with the Openlayer
|
|
4
|
+
platform.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
from typing import Dict, List
|
|
9
|
+
|
|
10
|
+
from mcp.server.fastmcp import FastMCP
|
|
11
|
+
from openlayer import Openlayer
|
|
12
|
+
from openlayer.lib.data import commit
|
|
13
|
+
|
|
14
|
+
mcp = FastMCP("openlayer-mcp")
|
|
15
|
+
client = Openlayer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# --------------------------------- Projects --------------------------------- #
|
|
19
|
+
@mcp.tool()
|
|
20
|
+
def list_projects() -> List[Dict]:
|
|
21
|
+
"""Get a list of the projects in the user's workspace."""
|
|
22
|
+
project_list = client.projects.list()
|
|
23
|
+
return [item.model_dump() for item in project_list.items]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@mcp.tool()
|
|
27
|
+
def create_project(
|
|
28
|
+
name: str,
|
|
29
|
+
task_type: str,
|
|
30
|
+
description: str,
|
|
31
|
+
) -> Dict:
|
|
32
|
+
"""Create a new project in the user's workspace.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
name: The name of the project to create.
|
|
36
|
+
task_type: The type of task the project will be used for. Must be one of
|
|
37
|
+
'llm-base', 'tabular-classification', 'tabular-regression', or
|
|
38
|
+
'text-classification'.
|
|
39
|
+
description: A short description for the project.
|
|
40
|
+
"""
|
|
41
|
+
project = client.projects.create(
|
|
42
|
+
name=name,
|
|
43
|
+
task_type=task_type,
|
|
44
|
+
description=description,
|
|
45
|
+
)
|
|
46
|
+
return project.model_dump()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# ---------------------------------- Commits --------------------------------- #
|
|
50
|
+
@mcp.tool()
|
|
51
|
+
def list_commits(project_id: str) -> List[Dict]:
|
|
52
|
+
"""List the commits in a project.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
project_id: The ID of the project to list the commits for.
|
|
56
|
+
"""
|
|
57
|
+
commits = client.projects.commits.list(project_id=project_id)
|
|
58
|
+
return [item.model_dump() for item in commits.items]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@mcp.tool()
|
|
62
|
+
def retrieve_commit(project_version_id: str) -> Dict:
|
|
63
|
+
"""Retrieve a commit by ID.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
project_version_id: The ID of the commit to retrieve.
|
|
67
|
+
"""
|
|
68
|
+
commit = client.commits.retrieve(project_version_id=project_version_id)
|
|
69
|
+
return commit.model_dump()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@mcp.tool()
|
|
73
|
+
def push_commit(
|
|
74
|
+
project_id: str,
|
|
75
|
+
directory: str,
|
|
76
|
+
message: str = "New commit",
|
|
77
|
+
) -> str:
|
|
78
|
+
"""Push a commit to the project.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
project_id: The ID of the project to push the commit to.
|
|
82
|
+
directory: The directory containing the files to push. Usually has at least
|
|
83
|
+
an `openlayer.json` file.
|
|
84
|
+
message: The commit message.
|
|
85
|
+
"""
|
|
86
|
+
# Check if the directory contains an openlayer.json file
|
|
87
|
+
if not os.path.exists(os.path.join(directory, "openlayer.json")):
|
|
88
|
+
raise ValueError(
|
|
89
|
+
f"Directory {directory} does not contain an openlayer.json file, so "
|
|
90
|
+
"it is not prepared to be pushed to Openlayer."
|
|
91
|
+
)
|
|
92
|
+
try:
|
|
93
|
+
commit.push(
|
|
94
|
+
client=client,
|
|
95
|
+
directory=directory,
|
|
96
|
+
project_id=project_id,
|
|
97
|
+
message=message,
|
|
98
|
+
)
|
|
99
|
+
except Exception as exc:
|
|
100
|
+
raise ValueError(f"Error pushing commit: {exc}")
|
|
101
|
+
return "Commit pushed successfully."
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# ---------------------------- Inference pipelines --------------------------- #
|
|
105
|
+
@mcp.tool()
|
|
106
|
+
def list_inference_pipelines(project_id: str) -> List[Dict]:
|
|
107
|
+
"""List the inference pipelines in a project."""
|
|
108
|
+
inference_pipelines = client.projects.inference_pipelines.list(
|
|
109
|
+
project_id=project_id
|
|
110
|
+
)
|
|
111
|
+
return [item.model_dump() for item in inference_pipelines.items]
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@mcp.tool()
|
|
115
|
+
def retrieve_inference_pipeline(project_id: str, inference_pipeline_id: str) -> Dict:
|
|
116
|
+
"""Retrieve an inference pipeline by ID."""
|
|
117
|
+
inference_pipeline = client.inference_pipelines.retrieve(
|
|
118
|
+
inference_pipeline_id=inference_pipeline_id
|
|
119
|
+
)
|
|
120
|
+
return inference_pipeline.model_dump()
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@mcp.tool()
|
|
124
|
+
def create_inference_pipeline(
|
|
125
|
+
project_id: str,
|
|
126
|
+
name: str,
|
|
127
|
+
description: str,
|
|
128
|
+
) -> Dict:
|
|
129
|
+
"""Create a new inference pipeline in project.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
project_id: The ID of the project to create the inference pipeline for.
|
|
133
|
+
name: The name of the inference pipeline to create.
|
|
134
|
+
description: The description of the inference pipeline to create.
|
|
135
|
+
"""
|
|
136
|
+
inference_pipeline = client.projects.inference_pipelines.create(
|
|
137
|
+
project_id=project_id,
|
|
138
|
+
name=name,
|
|
139
|
+
description=description,
|
|
140
|
+
)
|
|
141
|
+
return inference_pipeline.model_dump()
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
# ------------------------------- Test results ------------------------------- #
|
|
145
|
+
@mcp.tool()
|
|
146
|
+
def list_commit_test_results(project_version_id: str) -> List[Dict]:
|
|
147
|
+
"""List the test results for a commit.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
project_version_id: The ID of the commit to list the test results for.
|
|
151
|
+
"""
|
|
152
|
+
test_results = client.commits.test_results.list(
|
|
153
|
+
project_version_id=project_version_id
|
|
154
|
+
)
|
|
155
|
+
return [item.model_dump() for item in test_results.items]
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
@mcp.tool()
|
|
159
|
+
def list_inference_pipeline_test_results(inference_pipeline_id: str) -> List[Dict]:
|
|
160
|
+
"""List the test results for an inference pipeline."""
|
|
161
|
+
test_results = client.inference_pipelines.test_results.list(
|
|
162
|
+
inference_pipeline_id=inference_pipeline_id
|
|
163
|
+
)
|
|
164
|
+
return [item.model_dump() for item in test_results.items]
|