gramps-effect-mcp
An Effect TypeScript MCP server for safe access to Gramps Web, exposing records, relationships, timelines, media, and verified mutations to MCP clients.
README
gramps-effect-mcp
An Effect TypeScript MCP server for safe access to Gramps Web. It exposes Gramps records, relationships, timelines, media, and verified mutations to Claude Desktop, OpenCode, and other Model Context Protocol clients over stdio.
Overview
This project is a replacement for the legacy Gramps MCP surface. It keeps the familiar read, analysis, create, update, delete, media, and convenience tools while putting every mutation through one serialized write pipeline. References are resolved at every registered depth, writes are read back from Gramps, and integrity scans report repair suggestions without changing records.
The tested target is Gramps Web API 3.19.0 with Gramps 6.0.8. Other Gramps Web 3.x releases are unverified compatibility targets. The MCP integration uses the experimental @effect/ai@0.37.0 package and has been tested with MCP protocol version 2025-06-18. See the dependency matrix for every exact Effect package pin.
Install
Requirements:
- Node.js 22 or newer
- A reachable Gramps Web instance with an API user
git clone https://example.com/your/gramps-effect-mcp.git
cd gramps-effect-mcp
npm ci
npm run build
The compiled stdio server starts with:
npm start
It communicates on stdin and stdout. It doesn't open an HTTP port.
Config
Set the required connection variables in the MCP client's environment. Keep credentials in the client configuration or its secret store, not in this repository.
| Variable | Default | Description |
|---|---|---|
GRAMPS_API_URL |
Required | Gramps Web base URL, for example https://gramps.example.com. Trailing slashes are removed. |
GRAMPS_USERNAME |
Required | Gramps Web API username. |
GRAMPS_PASSWORD |
Required | Gramps Web API password. It is held as a redacted value by the application. |
GRAMPS_TEST_API_URL |
Unset | Optional API URL for test configuration. Production clients normally leave this unset. |
GRAMPS_IF_MATCH_ENABLED |
false |
Enables conditional writes only when the server supplies an ETag accepted by PUT preconditions. Leave disabled for 3.19.0. |
GRAMPS_READ_RATE_LIMIT |
10 |
Maximum number of GET attempts started per second, including retries. |
GRAMPS_HTTP_TIMEOUT_MS |
30000 |
HTTP request timeout in milliseconds. |
GRAMPS_RETRY_MAX_ATTEMPTS |
5 |
Maximum read attempts, including the first request. Mutations are never retried automatically. |
GRAMPS_MEDIA_RESOURCES_ENABLED |
false |
Allows MCP clients to read media file and thumbnail bytes. |
GRAMPS_MEDIA_UPLOAD_ENABLED |
true |
Allows media uploads through the verified write pipeline. Independent of media exposure. |
GRAMPS_MEDIA_MAX_BYTES |
10485760 |
Maximum exposed or uploaded media size in bytes, 10 MiB by default. |
GRAMPS_MEDIA_ALLOWED_MIME_TYPES |
image/jpeg,image/png,application/pdf |
Comma-separated allowlist used by media exposure and upload policy. |
GRAMPS_MEDIA_ALLOW_PRIVATE |
false |
Allows media marked private to cross the media boundary. |
Client Wiring
Build the project first, then point the MCP client at the absolute path to dist/main.js. The same mcpServers entry works in Claude Desktop and MCP clients that use the standard JSON shape:
{
"mcpServers": {
"gramps": {
"command": "node",
"args": ["/absolute/path/to/gramps-effect-mcp/dist/main.js"],
"env": {
"GRAMPS_API_URL": "https://gramps.example.com",
"GRAMPS_USERNAME": "your-api-user",
"GRAMPS_PASSWORD": "set-this-in-your-client-secret-store"
}
}
}
}
For Claude Desktop, add the entry to the application's MCP configuration and restart Claude Desktop. For OpenCode, add the same server command, arguments, and environment to its MCP configuration. Other stdio MCP clients need the equivalent command and environment fields. Don't run the server through a shell wrapper that writes status messages to stdout, since stdout is reserved for MCP JSON-RPC messages.
Operational Docs
Safety and capability model
- Deep resolution: Gramps IDs and opaque handles are resolved at every registered reference path before a write is sent. Free text isn't scanned for ID-like strings.
- Serialized writes: one semaphore covers reference resolution, mutation, read-back verification, and resolver cache invalidation for a complete logical write.
- Verified results: each returned handle is fetched again. Supplied semantic fields are compared with the canonical server form rather than raw request bytes.
- Integrity scans:
scan_integrityreports stale references, reciprocal-link problems, and suggested repair tools. It doesn't mutate the tree. - Capability states: metadata, JWT permissions, server media support, and local policy determine media exposure, upload, semantic-search, task-queue, and transaction availability. Transaction eligibility requires
AddObject,EditObject, andDeleteObjectpermissions.
Gramps fills defaults, recalculates date sort values, normalizes handles, expands type values, and updates server-owned fields. The verifier accounts for these transforms. See server canonicalizations for the exact 3.19.0 behavior.
Write outcomes
The write pipeline has four outcomes. A client must not treat all four as interchangeable:
| Outcome | Meaning | Operator action |
|---|---|---|
VerifiedCommitted |
Gramps committed the write and a fresh read matched the requested semantic fields. | Continue normally. |
CommittedVerificationFailed |
Gramps committed the write, but read-back verification found missing or different fields. | Inspect the returned reference and problems before another write. Don't retry blindly. |
RejectedBeforeMutation |
Validation, resolution, permissions, conflict checks, or another pre-mutation step rejected the operation. Compound operations can still report refs committed by earlier sequential steps. | Correct the reported error. Review any returned refs before retrying a compound operation. |
CommitIndeterminate |
A transport failure happened after mutation bytes may have been sent, so commit status can't be proven. Compound operations can report earlier committed refs. | Read the target state before deciding whether to retry. |
Mutation retries are disabled because a dropped response can't prove that Gramps received no request bytes. Reads retry only transport failures, rate limits, HTTP 429, and HTTP 5xx responses, using jittered exponential backoff with bounded attempts and elapsed time. See the retry policy for the exact schedule.
Media flags
Media exposure and upload are separate controls:
GRAMPS_MEDIA_RESOURCES_ENABLEDgates downloads and thumbnails returned to the MCP client. It defaults tofalseto prevent accidental file disclosure.GRAMPS_MEDIA_UPLOAD_ENABLEDgates binary uploads. It defaults totrue, but uploads still require server support, permissions, MIME approval, size approval, and read-back verification.GRAMPS_MEDIA_MAX_BYTES,GRAMPS_MEDIA_ALLOWED_MIME_TYPES, andGRAMPS_MEDIA_ALLOW_PRIVATEapply to both boundaries.
Disabling exposure doesn't disable upload. Disabling upload doesn't expose existing files.
ETags and concurrent writes
GRAMPS_IF_MATCH_ENABLED defaults to false for Gramps Web API 3.19.0. In the tested server, GET ETags hash response JSON while PUT compares an internal object digest that the item endpoint doesn't expose. A GET token therefore fails an immediate PUT precondition. Enable conditional writes only after proving that the target server returns a usable token. The full probe and decision are recorded in ETag findings.
The server still serializes and verifies writes when ETags are disabled. If a target has working conditional writes, overlapping field changes are rejected, while disjoint changes can be merged and retried once.
Secret Scanning
Install the tracked pre-commit hook once per clone:
npm run hooks:install
The hook requires gitleaks on PATH and scans staged changes before every
commit. Scan the complete working tree manually with:
npm run secrets:scan
Test Commands
npm test
npm run test:live
npm run test:final
npm run typecheck
npm run build
npm testruns the unit project without starting Gramps.npm run test:liveboots a disposable loopback instance pinned togramps-webapi==3.19.0and Gramps 6.0.8. It requiresuvand never usesGRAMPS_API_URL.npm run test:finalruns final compliance and scope checks.npm run typecheckchecks the strict TypeScript project without emitting files.npm run buildcompiles the stdio server intodist/.
The captured legacy tool schemas and parity baseline are in docs/legacy-tools.json. Final compliance tests check the production registry against that contract.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。