agimus-mcp 0.4.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.
- agimus_mcp-0.4.0/.gitignore +10 -0
- agimus_mcp-0.4.0/PKG-INFO +198 -0
- agimus_mcp-0.4.0/README.md +173 -0
- agimus_mcp-0.4.0/pyproject.toml +50 -0
- agimus_mcp-0.4.0/src/agimus_mcp/__init__.py +19 -0
- agimus_mcp-0.4.0/src/agimus_mcp/__main__.py +82 -0
- agimus_mcp-0.4.0/src/agimus_mcp/docs/sdk_reference.md +554 -0
- agimus_mcp-0.4.0/src/agimus_mcp/errors.py +51 -0
- agimus_mcp-0.4.0/src/agimus_mcp/formatters.py +505 -0
- agimus_mcp-0.4.0/src/agimus_mcp/resources.py +85 -0
- agimus_mcp-0.4.0/src/agimus_mcp/server.py +69 -0
- agimus_mcp-0.4.0/src/agimus_mcp/tools.py +678 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agimus-mcp
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: MCP server for the Agimus data platform — connects AI coding tools to your ontology
|
|
5
|
+
Project-URL: Homepage, https://agimus.ai
|
|
6
|
+
Project-URL: Repository, https://github.com/agimus-ai/agimus-platform
|
|
7
|
+
Project-URL: Issues, https://github.com/agimus-ai/agimus-platform/issues
|
|
8
|
+
Author-email: Agimus <support@agimus.ai>
|
|
9
|
+
License: MIT
|
|
10
|
+
Keywords: agimus,ai,data-platform,llm,mcp,ontology
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: agimus>=0.4.0
|
|
22
|
+
Requires-Dist: mcp>=1.2.0
|
|
23
|
+
Requires-Dist: pydantic>=2.7
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# Agimus MCP Server
|
|
27
|
+
|
|
28
|
+
Connects AI coding tools — Claude Desktop, Claude Code, Cursor, OpenAI Codex,
|
|
29
|
+
and other [Model Context Protocol](https://modelcontextprotocol.io) clients —
|
|
30
|
+
to the Agimus data platform. The server gives the AI live awareness of your
|
|
31
|
+
ontology (entities, properties, links, types) and bundled reference docs for
|
|
32
|
+
the Agimus Python SDK, so it writes correct code instead of guessing field
|
|
33
|
+
names.
|
|
34
|
+
|
|
35
|
+
## What the AI gets
|
|
36
|
+
|
|
37
|
+
### Tools (13)
|
|
38
|
+
|
|
39
|
+
**Discovery:**
|
|
40
|
+
|
|
41
|
+
| Tool | What it does |
|
|
42
|
+
|------|--------------|
|
|
43
|
+
| `agimus_list_entities` | Every entity, with PK, property/link counts |
|
|
44
|
+
| `agimus_get_entity_schema` | Full schema for one entity (properties + rich link details) |
|
|
45
|
+
| `agimus_list_links` | Every link in the ontology (both directions per link) |
|
|
46
|
+
| `agimus_get_link` | Full details for a link by api_name |
|
|
47
|
+
| `agimus_list_datasets` | All datasets, optionally filtered by source/name |
|
|
48
|
+
| `agimus_get_dataset_schema` | Columns, types, row count + SDK usage snippet |
|
|
49
|
+
| `agimus_whoami` | Tenant name, scope, rate limit for the current API key |
|
|
50
|
+
|
|
51
|
+
**Read (read-only — writes happen via the SDK in user code):**
|
|
52
|
+
|
|
53
|
+
| Tool | What it does |
|
|
54
|
+
|------|--------------|
|
|
55
|
+
| `agimus_query_objects` | Filter / sort / project / expand / paginate |
|
|
56
|
+
| `agimus_get_object` | Single object by primary key |
|
|
57
|
+
| `agimus_get_related_objects` | Traverse a link from one object (cursor-paginated) |
|
|
58
|
+
| `agimus_count_objects` | Cheap COUNT(*) with optional filter |
|
|
59
|
+
| `agimus_distinct_values` | Distinct values, optionally with frequency counts |
|
|
60
|
+
| `agimus_aggregate` | group_by + metrics (count/sum/avg/min/max/...) |
|
|
61
|
+
|
|
62
|
+
### Resources
|
|
63
|
+
|
|
64
|
+
* `agimus://schema/entities/{entity}` — live, full schema for one entity
|
|
65
|
+
* `agimus://docs/sdk-reference` — the full Agimus Python SDK reference
|
|
66
|
+
(sourced directly from the SDK's README so it never drifts)
|
|
67
|
+
|
|
68
|
+
## Install & configure
|
|
69
|
+
|
|
70
|
+
The recommended path is [`uvx`](https://docs.astral.sh/uv/) — it auto-installs
|
|
71
|
+
the latest version on first run and keeps it isolated. No prior `pip install`
|
|
72
|
+
is required.
|
|
73
|
+
|
|
74
|
+
### Claude Code
|
|
75
|
+
|
|
76
|
+
Add to `~/.claude/claude_code_config.json`:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"mcpServers": {
|
|
81
|
+
"agimus": {
|
|
82
|
+
"command": "uvx",
|
|
83
|
+
"args": ["agimus-mcp"],
|
|
84
|
+
"env": { "AGIMUS_API_KEY": "agm_your_api_key_here" }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Cursor
|
|
91
|
+
|
|
92
|
+
Create `.cursor/mcp.json` in your project root:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"agimus": {
|
|
98
|
+
"command": "uvx",
|
|
99
|
+
"args": ["agimus-mcp"],
|
|
100
|
+
"env": { "AGIMUS_API_KEY": "agm_your_api_key_here" }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### OpenAI Codex
|
|
107
|
+
|
|
108
|
+
Add to `~/.codex/config.toml`:
|
|
109
|
+
|
|
110
|
+
```toml
|
|
111
|
+
[mcp_servers.agimus]
|
|
112
|
+
command = "uvx"
|
|
113
|
+
args = ["agimus-mcp"]
|
|
114
|
+
env = { AGIMUS_API_KEY = "agm_your_api_key_here" }
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Claude Desktop
|
|
118
|
+
|
|
119
|
+
Add to `claude_desktop_config.json` (Claude → Settings → Developer → Edit Config):
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"mcpServers": {
|
|
124
|
+
"agimus": {
|
|
125
|
+
"command": "uvx",
|
|
126
|
+
"args": ["agimus-mcp"],
|
|
127
|
+
"env": { "AGIMUS_API_KEY": "agm_your_api_key_here" }
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Alternative install: `pip`
|
|
134
|
+
|
|
135
|
+
If you prefer a pinned global install:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pip install agimus-mcp
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Then replace `"command": "uvx", "args": ["agimus-mcp"]` with
|
|
142
|
+
`"command": "agimus-mcp"` in any config above.
|
|
143
|
+
|
|
144
|
+
## CLI options
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
agimus-mcp [--api-key agm_xxx] [--base-url URL] [--timeout SECONDS] [--log-level LEVEL]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Every flag has an environment-variable equivalent:
|
|
151
|
+
|
|
152
|
+
| Flag | Env var | Default |
|
|
153
|
+
|------|---------|---------|
|
|
154
|
+
| `--api-key` | `AGIMUS_API_KEY` | _(required)_ |
|
|
155
|
+
| `--base-url` | `AGIMUS_BASE_URL` | `https://api.agimus.ai` |
|
|
156
|
+
| `--timeout` | `AGIMUS_TIMEOUT` | `30` |
|
|
157
|
+
| `--log-level` | `AGIMUS_LOG_LEVEL` | `WARNING` |
|
|
158
|
+
|
|
159
|
+
Logs are written to stderr — stdout is reserved for the MCP stdio protocol.
|
|
160
|
+
|
|
161
|
+
## Programmatic use
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from agimus_mcp import create_server
|
|
165
|
+
|
|
166
|
+
create_server(api_key="agm_...").run()
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Security model
|
|
170
|
+
|
|
171
|
+
* The server authenticates with your Agimus API key — it can only see what the
|
|
172
|
+
key allows.
|
|
173
|
+
* It runs locally as a subprocess of your AI tool. No hosted server, no open
|
|
174
|
+
ports.
|
|
175
|
+
* All API calls go to `https://api.agimus.ai` (or your configured base URL)
|
|
176
|
+
over HTTPS.
|
|
177
|
+
|
|
178
|
+
## Development
|
|
179
|
+
|
|
180
|
+
This package lives in the Agimus monorepo at `sdk/python-mcp/` alongside the
|
|
181
|
+
[`agimus`](../python) Python SDK that it wraps.
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
cd sdk/python-mcp
|
|
185
|
+
pip install -e ".[dev]"
|
|
186
|
+
pytest
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
The package depends on a published `agimus` SDK — for development against an
|
|
190
|
+
unreleased SDK, install both in editable mode:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
pip install -e ../python -e ".[dev]"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Agimus MCP Server
|
|
2
|
+
|
|
3
|
+
Connects AI coding tools — Claude Desktop, Claude Code, Cursor, OpenAI Codex,
|
|
4
|
+
and other [Model Context Protocol](https://modelcontextprotocol.io) clients —
|
|
5
|
+
to the Agimus data platform. The server gives the AI live awareness of your
|
|
6
|
+
ontology (entities, properties, links, types) and bundled reference docs for
|
|
7
|
+
the Agimus Python SDK, so it writes correct code instead of guessing field
|
|
8
|
+
names.
|
|
9
|
+
|
|
10
|
+
## What the AI gets
|
|
11
|
+
|
|
12
|
+
### Tools (13)
|
|
13
|
+
|
|
14
|
+
**Discovery:**
|
|
15
|
+
|
|
16
|
+
| Tool | What it does |
|
|
17
|
+
|------|--------------|
|
|
18
|
+
| `agimus_list_entities` | Every entity, with PK, property/link counts |
|
|
19
|
+
| `agimus_get_entity_schema` | Full schema for one entity (properties + rich link details) |
|
|
20
|
+
| `agimus_list_links` | Every link in the ontology (both directions per link) |
|
|
21
|
+
| `agimus_get_link` | Full details for a link by api_name |
|
|
22
|
+
| `agimus_list_datasets` | All datasets, optionally filtered by source/name |
|
|
23
|
+
| `agimus_get_dataset_schema` | Columns, types, row count + SDK usage snippet |
|
|
24
|
+
| `agimus_whoami` | Tenant name, scope, rate limit for the current API key |
|
|
25
|
+
|
|
26
|
+
**Read (read-only — writes happen via the SDK in user code):**
|
|
27
|
+
|
|
28
|
+
| Tool | What it does |
|
|
29
|
+
|------|--------------|
|
|
30
|
+
| `agimus_query_objects` | Filter / sort / project / expand / paginate |
|
|
31
|
+
| `agimus_get_object` | Single object by primary key |
|
|
32
|
+
| `agimus_get_related_objects` | Traverse a link from one object (cursor-paginated) |
|
|
33
|
+
| `agimus_count_objects` | Cheap COUNT(*) with optional filter |
|
|
34
|
+
| `agimus_distinct_values` | Distinct values, optionally with frequency counts |
|
|
35
|
+
| `agimus_aggregate` | group_by + metrics (count/sum/avg/min/max/...) |
|
|
36
|
+
|
|
37
|
+
### Resources
|
|
38
|
+
|
|
39
|
+
* `agimus://schema/entities/{entity}` — live, full schema for one entity
|
|
40
|
+
* `agimus://docs/sdk-reference` — the full Agimus Python SDK reference
|
|
41
|
+
(sourced directly from the SDK's README so it never drifts)
|
|
42
|
+
|
|
43
|
+
## Install & configure
|
|
44
|
+
|
|
45
|
+
The recommended path is [`uvx`](https://docs.astral.sh/uv/) — it auto-installs
|
|
46
|
+
the latest version on first run and keeps it isolated. No prior `pip install`
|
|
47
|
+
is required.
|
|
48
|
+
|
|
49
|
+
### Claude Code
|
|
50
|
+
|
|
51
|
+
Add to `~/.claude/claude_code_config.json`:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"agimus": {
|
|
57
|
+
"command": "uvx",
|
|
58
|
+
"args": ["agimus-mcp"],
|
|
59
|
+
"env": { "AGIMUS_API_KEY": "agm_your_api_key_here" }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Cursor
|
|
66
|
+
|
|
67
|
+
Create `.cursor/mcp.json` in your project root:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"mcpServers": {
|
|
72
|
+
"agimus": {
|
|
73
|
+
"command": "uvx",
|
|
74
|
+
"args": ["agimus-mcp"],
|
|
75
|
+
"env": { "AGIMUS_API_KEY": "agm_your_api_key_here" }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### OpenAI Codex
|
|
82
|
+
|
|
83
|
+
Add to `~/.codex/config.toml`:
|
|
84
|
+
|
|
85
|
+
```toml
|
|
86
|
+
[mcp_servers.agimus]
|
|
87
|
+
command = "uvx"
|
|
88
|
+
args = ["agimus-mcp"]
|
|
89
|
+
env = { AGIMUS_API_KEY = "agm_your_api_key_here" }
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Claude Desktop
|
|
93
|
+
|
|
94
|
+
Add to `claude_desktop_config.json` (Claude → Settings → Developer → Edit Config):
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"mcpServers": {
|
|
99
|
+
"agimus": {
|
|
100
|
+
"command": "uvx",
|
|
101
|
+
"args": ["agimus-mcp"],
|
|
102
|
+
"env": { "AGIMUS_API_KEY": "agm_your_api_key_here" }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Alternative install: `pip`
|
|
109
|
+
|
|
110
|
+
If you prefer a pinned global install:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pip install agimus-mcp
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Then replace `"command": "uvx", "args": ["agimus-mcp"]` with
|
|
117
|
+
`"command": "agimus-mcp"` in any config above.
|
|
118
|
+
|
|
119
|
+
## CLI options
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
agimus-mcp [--api-key agm_xxx] [--base-url URL] [--timeout SECONDS] [--log-level LEVEL]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Every flag has an environment-variable equivalent:
|
|
126
|
+
|
|
127
|
+
| Flag | Env var | Default |
|
|
128
|
+
|------|---------|---------|
|
|
129
|
+
| `--api-key` | `AGIMUS_API_KEY` | _(required)_ |
|
|
130
|
+
| `--base-url` | `AGIMUS_BASE_URL` | `https://api.agimus.ai` |
|
|
131
|
+
| `--timeout` | `AGIMUS_TIMEOUT` | `30` |
|
|
132
|
+
| `--log-level` | `AGIMUS_LOG_LEVEL` | `WARNING` |
|
|
133
|
+
|
|
134
|
+
Logs are written to stderr — stdout is reserved for the MCP stdio protocol.
|
|
135
|
+
|
|
136
|
+
## Programmatic use
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from agimus_mcp import create_server
|
|
140
|
+
|
|
141
|
+
create_server(api_key="agm_...").run()
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Security model
|
|
145
|
+
|
|
146
|
+
* The server authenticates with your Agimus API key — it can only see what the
|
|
147
|
+
key allows.
|
|
148
|
+
* It runs locally as a subprocess of your AI tool. No hosted server, no open
|
|
149
|
+
ports.
|
|
150
|
+
* All API calls go to `https://api.agimus.ai` (or your configured base URL)
|
|
151
|
+
over HTTPS.
|
|
152
|
+
|
|
153
|
+
## Development
|
|
154
|
+
|
|
155
|
+
This package lives in the Agimus monorepo at `sdk/python-mcp/` alongside the
|
|
156
|
+
[`agimus`](../python) Python SDK that it wraps.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
cd sdk/python-mcp
|
|
160
|
+
pip install -e ".[dev]"
|
|
161
|
+
pytest
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The package depends on a published `agimus` SDK — for development against an
|
|
165
|
+
unreleased SDK, install both in editable mode:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
pip install -e ../python -e ".[dev]"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
MIT
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "agimus-mcp"
|
|
7
|
+
version = "0.4.0"
|
|
8
|
+
description = "MCP server for the Agimus data platform — connects AI coding tools to your ontology"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Agimus", email = "support@agimus.ai" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["mcp", "agimus", "data-platform", "ai", "llm", "ontology"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Topic :: Software Development :: Libraries",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"agimus>=0.4.0",
|
|
29
|
+
"mcp>=1.2.0",
|
|
30
|
+
"pydantic>=2.7",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
agimus-mcp = "agimus_mcp.__main__:main"
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://agimus.ai"
|
|
38
|
+
Repository = "https://github.com/agimus-ai/agimus-platform"
|
|
39
|
+
Issues = "https://github.com/agimus-ai/agimus-platform/issues"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.build.targets.wheel]
|
|
42
|
+
packages = ["src/agimus_mcp"]
|
|
43
|
+
|
|
44
|
+
# The single bundled doc is the Agimus SDK README. Source-of-truth lives in
|
|
45
|
+
# the SDK package next door. We force-include it into the sdist at the
|
|
46
|
+
# canonical package location; when the wheel is then built from the sdist
|
|
47
|
+
# (the default `python -m build` flow), hatchling picks it up naturally as
|
|
48
|
+
# part of `packages = ["src/agimus_mcp"]`. No drift, one source of truth.
|
|
49
|
+
[tool.hatch.build.targets.sdist.force-include]
|
|
50
|
+
"../python/README.md" = "src/agimus_mcp/docs/sdk_reference.md"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agimus MCP Server.
|
|
3
|
+
|
|
4
|
+
Exposes the Agimus data platform to MCP-aware AI tools (Claude Desktop,
|
|
5
|
+
Claude Code, Cursor, OpenAI Codex, …) so the LLM can discover entities,
|
|
6
|
+
inspect schemas, traverse the link graph, query the object store, and write
|
|
7
|
+
correct code against the Agimus Python SDK.
|
|
8
|
+
|
|
9
|
+
Programmatic use::
|
|
10
|
+
|
|
11
|
+
from agimus_mcp import create_server
|
|
12
|
+
create_server(api_key="agm_...").run()
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from .server import create_server
|
|
16
|
+
|
|
17
|
+
__version__ = "0.4.0"
|
|
18
|
+
|
|
19
|
+
__all__ = ["create_server", "__version__"]
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CLI entry point for the Agimus MCP server.
|
|
3
|
+
|
|
4
|
+
Usage::
|
|
5
|
+
|
|
6
|
+
agimus-mcp # reads AGIMUS_API_KEY
|
|
7
|
+
agimus-mcp --api-key agm_xxx
|
|
8
|
+
agimus-mcp --api-key agm_xxx --base-url https://staging-api.agimus.ai
|
|
9
|
+
|
|
10
|
+
Wired in pyproject.toml as the ``agimus-mcp`` console script and runnable
|
|
11
|
+
as ``python -m agimus_mcp``.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import argparse
|
|
17
|
+
import logging
|
|
18
|
+
import os
|
|
19
|
+
import sys
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def main() -> None:
|
|
23
|
+
parser = argparse.ArgumentParser(
|
|
24
|
+
prog="agimus-mcp",
|
|
25
|
+
description="MCP server for the Agimus data platform.",
|
|
26
|
+
)
|
|
27
|
+
parser.add_argument(
|
|
28
|
+
"--api-key",
|
|
29
|
+
default=os.environ.get("AGIMUS_API_KEY"),
|
|
30
|
+
help="Agimus API key (starts with 'agm_'). Can also be set via AGIMUS_API_KEY.",
|
|
31
|
+
)
|
|
32
|
+
parser.add_argument(
|
|
33
|
+
"--base-url",
|
|
34
|
+
default=os.environ.get("AGIMUS_BASE_URL", "https://api.agimus.ai"),
|
|
35
|
+
help=(
|
|
36
|
+
"Agimus API base URL (default: https://api.agimus.ai). "
|
|
37
|
+
"Can also be set via AGIMUS_BASE_URL."
|
|
38
|
+
),
|
|
39
|
+
)
|
|
40
|
+
parser.add_argument(
|
|
41
|
+
"--timeout",
|
|
42
|
+
type=float,
|
|
43
|
+
default=float(os.environ.get("AGIMUS_TIMEOUT", "30")),
|
|
44
|
+
help="Per-request timeout in seconds (default: 30).",
|
|
45
|
+
)
|
|
46
|
+
parser.add_argument(
|
|
47
|
+
"--log-level",
|
|
48
|
+
default=os.environ.get("AGIMUS_LOG_LEVEL", "WARNING"),
|
|
49
|
+
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
|
|
50
|
+
help=(
|
|
51
|
+
"Log level. Logs go to stderr (stdout is reserved for the MCP "
|
|
52
|
+
"stdio protocol)."
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
args = parser.parse_args()
|
|
56
|
+
|
|
57
|
+
if not args.api_key:
|
|
58
|
+
sys.exit(
|
|
59
|
+
"Error: API key is required.\n"
|
|
60
|
+
"Set AGIMUS_API_KEY or pass --api-key agm_your_key_here."
|
|
61
|
+
)
|
|
62
|
+
if not args.api_key.startswith("agm_"):
|
|
63
|
+
sys.exit("Error: Invalid API key format. Agimus keys start with 'agm_'.")
|
|
64
|
+
|
|
65
|
+
logging.basicConfig(
|
|
66
|
+
level=args.log_level,
|
|
67
|
+
stream=sys.stderr,
|
|
68
|
+
format="%(asctime)s %(name)s %(levelname)s: %(message)s",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Lazy import so --help doesn't pay the SDK + MCP import cost.
|
|
72
|
+
from .server import create_server
|
|
73
|
+
|
|
74
|
+
create_server(
|
|
75
|
+
api_key=args.api_key,
|
|
76
|
+
base_url=args.base_url,
|
|
77
|
+
timeout=args.timeout,
|
|
78
|
+
).run()
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
main()
|