gliner2-mcp
MCP server that exposes GLiNER2 entity extraction, classification, and JSON extraction as tools.
Quickstart
- Install dependencies:
uv sync
- Run the MCP server:
uv run gliner2-mcp
Environment configuration
This server is configured via environment variables (optionally loaded from .env).
| Variable | Default | Description |
|---|---|---|
GLINER2_MODEL_ID |
fastino/gliner2-base-v1 |
GLiNER2 model id or path. |
GLINER2_DEVICE |
empty | Device override passed to from_pretrained when supported. |
GLINER2_MAX_TEXT_LENGTH |
0 |
Maximum input length. 0 disables the limit. |
GLINER2_MCP_LOG_LEVEL |
INFO |
Log level for server logging. |
GLINER2_MCP_ENV_FILE |
empty | Path to an env file to load before reading the variables above. |
If GLINER2_MCP_ENV_FILE is not set, the server will load .env from the working directory when it exists.
MCP tools
extractEntities(text, labels)returns a mapping of label to entity spans.classifyText(text, schema)returns a mapping of field name to chosen label or list of labels.extractJson(text, schema)returns a JSON object that matches the provided schema.
Available Models
GLiNER2 family models on Hugging Face
Development
uv sync --dev
uv run ruff check .
Testing
Run the default test suite (unit + contract tests):
uv sync --extra dev
uv run --extra dev pytest -q
Run real-model integration tests (downloads/loads actual GLiNER2 weights):
GLINER2_MCP_RUN_INTEGRATION=1 uv run --extra dev pytest -q -m integration
Recommended pre-release check:
uv run --extra dev pytest -q
GLINER2_MCP_RUN_INTEGRATION=1 uv run --extra dev pytest -q -m integration
License
MIT. See LICENSE.
Metadata
Release files for gliner2-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gliner2_mcp-0.1.0.tar.gz | 98.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gliner2_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 105.8 kB
Release files / gliner2_mcp-0.1.0.tar.gz
| Download URL | gliner2_mcp-0.1.0.tar.gz |
|---|---|
| Size | 98.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f78254b286b5866ca34920d9a7f6a033a05f238b64b4e404516208c056336655
|
|
BLAKE2b-256 checksum How to use checksums |
e41126b9e9497cba7ad3539f742c2597d275402bbdd09fd7d469bdcd21d58edd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / gliner2_mcp-0.1.0-py3-none-any.whl
| Download URL | gliner2_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e174052f3ff8081f2a711ce8e7eec2a79a3b36c80f16c95e6c72edaf5b02f662
|
|
BLAKE2b-256 checksum How to use checksums |
0a655dd960a84c56ba4b2aa737c0bb58ee5ae9a860b1aae74a7962853ee93471
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|