altalandi-mcp 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +53 -0
- package/package.json +21 -0
- package/server.mjs +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Altalandi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# altalandi-mcp
|
|
2
|
+
|
|
3
|
+
An [MCP](https://modelcontextprotocol.io) server that exposes
|
|
4
|
+
[Altalandi](https://altalandi.is) — native-Icelandic refinement with a
|
|
5
|
+
meaning-preservation check — as a tool any MCP client (Claude Code, etc.) can
|
|
6
|
+
call. stdio transport.
|
|
7
|
+
|
|
8
|
+
## Use it in Claude Code
|
|
9
|
+
|
|
10
|
+
Add to your MCP config (`.mcp.json` in the project, or your Claude Code config):
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"mcpServers": {
|
|
15
|
+
"altalandi": {
|
|
16
|
+
"command": "npx",
|
|
17
|
+
"args": ["-y", "altalandi-mcp"],
|
|
18
|
+
"env": { "ALTALANDI_API_KEY": "rtv_..." }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Mint a key at <https://altalandi.is/portal>. Then ask Claude to use the
|
|
25
|
+
**`refine_icelandic`** tool.
|
|
26
|
+
|
|
27
|
+
## The tool
|
|
28
|
+
|
|
29
|
+
`refine_icelandic({ text, domain?, register?, sourceLang? })` → the native
|
|
30
|
+
Icelandic text, a 0–100 nativeness score, and whether meaning was preserved.
|
|
31
|
+
|
|
32
|
+
- `domain`: `general` \| `marketing` \| `data-analysis` \| `childrens-fiction`
|
|
33
|
+
- `register`: `formal` \| `neutral` \| `warm`
|
|
34
|
+
- `sourceLang`: `auto` \| `en` \| `is`
|
|
35
|
+
|
|
36
|
+
**Meaning guarantee:** on Icelandic input where the rewrite can't be verified to
|
|
37
|
+
preserve meaning, the tool returns the **original unchanged** and flags it —
|
|
38
|
+
never a silent change.
|
|
39
|
+
|
|
40
|
+
## Config
|
|
41
|
+
|
|
42
|
+
| env | default | purpose |
|
|
43
|
+
|-----|---------|---------|
|
|
44
|
+
| `ALTALANDI_API_KEY` | — | your key (Bearer). Mint at https://altalandi.is/portal |
|
|
45
|
+
| `ALTALANDI_BASE_URL` | `https://altalandi.is/api` | API base (override for self-hosting) |
|
|
46
|
+
|
|
47
|
+
## Run standalone
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
ALTALANDI_API_KEY=rtv_... npx -y altalandi-mcp # speaks MCP over stdio
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
MIT licensed. Requires Node ≥ 18. The hosted API is metered per key.
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "altalandi-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server exposing Altalandi (native-Icelandic refinement) as a tool for Claude Code and any MCP client.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": { "altalandi-mcp": "./server.mjs" },
|
|
7
|
+
"files": ["server.mjs", "README.md", "LICENSE"],
|
|
8
|
+
"keywords": [
|
|
9
|
+
"icelandic", "íslenska", "mcp", "model-context-protocol", "claude",
|
|
10
|
+
"claude-code", "altalandi", "nlp", "translation", "agent"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://altalandi.is",
|
|
13
|
+
"repository": { "type": "git", "url": "git+https://github.com/pbidhjorvar/ritvit.git", "directory": "tools/mcp" },
|
|
14
|
+
"bugs": { "url": "https://github.com/pbidhjorvar/ritvit/issues" },
|
|
15
|
+
"engines": { "node": ">=18" },
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
18
|
+
"zod": "^3.23.8"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT"
|
|
21
|
+
}
|
package/server.mjs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Altalandi MCP server — exposes native-Icelandic refinement as a tool that
|
|
3
|
+
// Claude Code (and any MCP client) can call. stdio transport.
|
|
4
|
+
//
|
|
5
|
+
// ALTALANDI_API_KEY=... npx -y altalandi-mcp
|
|
6
|
+
//
|
|
7
|
+
// Claude Code config (.mcp.json or your Claude Code config) — no install:
|
|
8
|
+
// { "mcpServers": { "altalandi": {
|
|
9
|
+
// "command": "npx",
|
|
10
|
+
// "args": ["-y", "altalandi-mcp"],
|
|
11
|
+
// "env": { "ALTALANDI_API_KEY": "rtv_..." } } } }
|
|
12
|
+
|
|
13
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
14
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
|
|
17
|
+
const BASE = (process.env.ALTALANDI_BASE_URL || "https://altalandi.is/api").replace(/\/$/, "");
|
|
18
|
+
const KEY = process.env.ALTALANDI_API_KEY || process.env.ALTALANDI_KEY;
|
|
19
|
+
|
|
20
|
+
const server = new McpServer({ name: "altalandi", version: "0.1.0" });
|
|
21
|
+
|
|
22
|
+
server.tool(
|
|
23
|
+
"refine_icelandic",
|
|
24
|
+
"Rewrite English or stiff/AI-translated Icelandic into native-sounding Icelandic, with a meaning-preservation check. Use whenever you need Icelandic that must read like a native wrote it (marketing copy, UI strings, prose). Returns the refined text, a 0-100 nativeness score, and whether meaning was preserved (on drift it returns the original unchanged).",
|
|
25
|
+
{
|
|
26
|
+
text: z.string().describe("Text to refine (English or Icelandic)."),
|
|
27
|
+
domain: z.enum(["general", "marketing", "data-analysis", "childrens-fiction"]).optional()
|
|
28
|
+
.describe("Tunes register/idiom. Default general."),
|
|
29
|
+
register: z.enum(["formal", "neutral", "warm"]).optional().describe("Tone. Default neutral."),
|
|
30
|
+
},
|
|
31
|
+
async ({ text, domain, register }) => {
|
|
32
|
+
if (!KEY) {
|
|
33
|
+
return { content: [{ type: "text", text: "ALTALANDI_API_KEY is not set for the MCP server." }], isError: true };
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const res = await fetch(`${BASE}/v1/refine`, {
|
|
37
|
+
method: "POST",
|
|
38
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${KEY}` },
|
|
39
|
+
body: JSON.stringify({ text, domain, register }),
|
|
40
|
+
});
|
|
41
|
+
const data = await res.json().catch(() => ({}));
|
|
42
|
+
if (!res.ok) {
|
|
43
|
+
return { content: [{ type: "text", text: `Altalandi error ${res.status}: ${data.detail || res.statusText}` }], isError: true };
|
|
44
|
+
}
|
|
45
|
+
const q = data.quality || {};
|
|
46
|
+
const drift = data.meaningPreserved === false ? " (MEANING DRIFT — original returned unchanged)" : "";
|
|
47
|
+
return {
|
|
48
|
+
content: [{ type: "text", text: `${data.output}\n\n— nativeness ${q.nativenessScore ?? "n/a"}/100${drift}` }],
|
|
49
|
+
};
|
|
50
|
+
} catch (e) {
|
|
51
|
+
return { content: [{ type: "text", text: `Request failed: ${e.message}` }], isError: true };
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
await server.connect(new StdioServerTransport());
|