Skip to main content
Glama
d4nshields

Bibliomantic MCP Server

by d4nshields

Bibliomantic MCP Server

高层摘要(一句话):

提供一个 Model-Context-Protocol 服务器,你的 AI 聊天工具可在任何需要从《易经》中随机选取一段中国智慧以完成其给定任务时调用它。

Related MCP server: taibu

原始简短摘要

一个将《易经》占卜与 AI 回复集成的 Model Context Protocol 服务器,探索了 Philip K. Dick 的 高堡奇人 中所描述的书籍占卜法。

目的

该服务器展示了如何通过 MCP 将传统智慧体系与现代 AI 进行审慎地集成。它提供:

  • 教育探索:对中国古代哲学和《易经》的探索

  • 文学背景:来自 Philip K. Dick 的影响深远的科幻作品

  • 哲学反思工具:用于创造性思维和换位思考

  • 技术展示:展示 FastMCP 在工具、资源和提示词方面的能力

功能

  • 传统《易经》系统:全部 64 个卦象,模拟正统的三枚硬币占卜法

  • 书籍占卜咨询:遵循 Philip K. Dick 在《高堡奇人》中采用的方法

  • FastMCP 实现:专业的 MCP 合规性,支持工具、资源和提示词

  • 伦理保障:明确声明其仅供娱乐/反思之用

  • 教育背景:每次咨询都附带历史与哲学背景

  • 资源访问:直接访问卦象数据库以加载 AI 上下文

先决条件

  • Python 3.10+(MCP SDK 所需)

  • MCP 兼容主机(Claude Desktop 等)

安装

从源码安装

git clone https://github.com/d4nshields/bibliomantic-mcp-server.git
cd bibliomantic-mcp-server
pip install -e .

备选配置:

{
  "mcpServers": {
    "bibliomantic": {
      "command": "python",
      "args": ["-m", "bibliomantic_server"]
    }
  }
}

可用工具

  • i_ching_divination - 生成带有传统解读的随机卦象

  • bibliomantic_consultation - 完整的书籍占卜流程,并带有查询增强

  • get_hexagram_details - 按编号(1-64)查找特定卦象

  • server_statistics - 查看系统信息和能力

资源

  • hexagram://{number} - 加载单个卦象数据以供 AI 上下文使用

  • iching://database - 访问完整 64 卦象数据库概览

提示模板

  • career_guidance_prompt - 用于职业决策的结构化提示

  • creative_guidance_prompt - 用于艺术和创意项目的提示

  • general_guidance_prompt - 通用的生活指导模板

使用示例

基本占卜

向 Claude 提问:

"你能为我的创意项目进行一次《易经》占卜,以获得哲学指引吗?"

书籍占卜咨询

"我正面临关于职业道路的艰难决定。你能用书籍占卜法咨询《易经》吗?"

资源访问

"加载 hexagram://1 资源以理解乾卦。"

特定卦象查询

"你能告诉我《易经》第 42 卦吗?"

书籍占卜法

该实现遵循 Philip K. Dick 的 高堡奇人 中描述的占卜方法,书中人物通过咨询《易经》来获得重要决策的指导。该系统:

  • 使用传统的《易经》方法,通过投掷三枚硬币进行占卜

  • 生成密码学上安全的随机数,以确保占卜的真实性

  • 将古老智慧与现代 AI 能力相结合

  • 保持书籍占卜的哲学与反思特性

  • 在占卜过程中提供透明度

伦理框架

所有回复都包含明确的免责声明,说明这仅用于哲学反思和娱乐,并非超自然指引或生活建议。对于重要决策,用户应咨询合格的专业人士。

该服务器强调:

  • 对智慧传统的教育性探索

  • 创造性思维和换位思考

  • 哲学反思而非预测

  • 尊重古代传统与现代伦理标准

开发

使用 MCP Inspector 进行测试

mcp dev bibliomantic_server.py

本地运行

python bibliomantic_server.py

技术实现

基于以下技术构建:

  • FastMCP - 官方 MCP Python SDK,确保专业合规性

  • 传统《易经》 - 包含完整 64 卦数据库和真实的解读

  • 密码学随机性 - 使用 Python 的 secrets 模块进行安全的三枚硬币模拟

  • 类型安全 - 完整的类型提示,自动生成 JSON schema

  • 伦理保障 - 所有回复中都有面向用户的免责声明

使用场景

  • 教育工具:用于学习《易经》哲学和中国智慧传统

  • 创意写作辅助:用于生成新视角和灵感

  • 哲学反思工具:用于思考人生决策和变化

  • 文化桥梁:连接古老智慧与现代 AI 能力

  • 技术演示:展示带有文化内容的 MCP 服务器开发

  • 文学分析:分析 Philip K. Dick 的主题和书籍占卜概念

安全注意事项

  • 对所有用户查询和参数进行输入验证

  • 没有外部网络请求或 API 依赖

  • 生成密码学上安全的随机数

  • 清晰的伦理边界和用户教育

  • 不持久化存储数据或跟踪用户

贡献

欢迎贡献!请:

  1. 遵循现有的代码风格和模式

  2. 使用 MCP Inspector 为新功能添加测试

  3. 更新任何更改的文档

  4. 确保与官方 MCP SDK 的兼容性

  5. 保持伦理框架和教育重点

许可证

MIT 许可证 - 详见 LICENSE 文件。

致谢

  • Philip K. Dick:感谢其提供的文学灵感和书籍占卜方法

  • 中国古代哲学家:感谢其贡献的《易经》智慧传统

  • Anthropic:感谢其提供的 Model Context Protocol 和 FastMCP 框架

  • MCP 社区:感谢其对创新 AI 集成的推动


"神谕是对的。未来仍在前方。" - Philip K. Dick,《高堡奇人》

Available Tools

4 tools
bibliomantic_consultationC

Enhanced bibliomantic consultation with full traditional I Ching elements. DRAMATICALLY IMPROVED CONTENT while maintaining exact interface compatibility.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'enhanced content' and 'maintaining exact interface compatibility' which gives some implementation context, but doesn't describe what the tool actually does behaviorally - whether it performs calculations, returns interpretations, requires authentication, has rate limits, or what 'consultation' entails. The description is too vague about the actual operation and output.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief (two sentences) and doesn't waste words, but it's not effectively structured. The first sentence is somewhat informative while the second is technical implementation detail that doesn't help an AI agent understand when or how to use the tool. While concise, it's not optimally front-loaded with the most important information for tool selection.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which reduces the need to describe return values) and only one parameter, the description is somewhat complete but inadequate. It mentions 'enhanced' and 'traditional I Ching elements' which provides some context, but doesn't explain what makes it different from i_ching_divination or what 'consultation' means. For a single-parameter tool with output schema, more could be done to explain the tool's unique value and use cases.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 1 parameter (query) with 0% description coverage in the schema itself. The tool description provides no information about what the 'query' parameter should contain, its format, or examples of valid inputs. For a single parameter tool with zero schema documentation, the description should compensate by explaining the parameter's purpose and expected content, which it fails to do.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'Enhanced bibliomantic consultation with full traditional I Ching elements' which provides some purpose context, but it's vague about what the tool actually does. It doesn't specify the action (consult? analyze? interpret?) or what resource it operates on. The second sentence about 'maintaining exact interface compatibility' is technical rather than functional. This is better than a tautology but lacks the specific verb+resource clarity needed for high scores.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There are no explicit guidelines about when to use this tool versus the sibling tools (get_hexagram_details, i_ching_divination, server_statistics). The description mentions 'enhanced' and 'full traditional I Ching elements' which might imply this is a more comprehensive option than i_ching_divination, but this is only implied rather than stated. No explicit when/when-not guidance or alternative recommendations are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_hexagram_detailsC

Enhanced hexagram details with traditional Chinese names, Unicode symbols, and rich commentary. MAINTAINS BACKWARD COMPATIBILITY while dramatically improving content quality.

ParametersJSON Schema
NameRequiredDescriptionDefault
hexagram_numberYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'enhanced' details and 'improving content quality,' which suggests this might return more or better data than a basic version, but doesn't specify what that entails (e.g., format, structure, or performance). It also doesn't cover critical aspects like whether it's a read-only operation, error handling, or any rate limits, leaving significant gaps for an AI agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief (two sentences) and front-loaded with key information ('Enhanced hexagram details...'), making it efficient. Every sentence adds value: the first specifies content, and the second addresses compatibility. There's no unnecessary repetition or fluff, though it could be slightly more structured for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 1 simple parameter, an output schema (which handles return values), and no annotations, the description is minimally adequate. It states the purpose and content enhancements but lacks details on behavioral traits, usage context, and parameter meaning. For a tool with low complexity, it meets basic needs but leaves gaps that could confuse an AI agent, especially without annotations to fill in behavioral aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description doesn't mention the 'hexagram_number' parameter at all, and schema description coverage is 0%, so it adds no meaning beyond the schema. However, with only 1 parameter and an output schema present, the baseline is 3 as the schema handles the input definition adequately, and the output schema can cover return values. The description fails to compensate for the lack of schema descriptions but doesn't severely hinder understanding due to simplicity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool provides 'enhanced hexagram details' with specific content elements (traditional Chinese names, Unicode symbols, rich commentary), which gives a general purpose. However, it doesn't specify the exact verb (retrieve? fetch? display?) or clearly distinguish from sibling tools like 'i_ching_divination' which might also provide hexagram information. The mention of 'backward compatibility' suggests this might replace or enhance an existing tool, but this isn't explicitly stated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives like 'i_ching_divination' or 'bibliomantic_consultation' is provided. The description implies it's for getting detailed hexagram information, but doesn't specify use cases, prerequisites, or exclusions. The backward compatibility note hints at context for existing users but doesn't help an AI agent decide when to invoke it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

i_ching_divinationC

Enhanced I Ching divination with traditional three-coin method and changing lines. MAINTAINS EXACT BACKWARD COMPATIBILITY while providing richer content.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions 'enhanced' divination and 'richer content,' but doesn't disclose key behavioral traits such as whether it's read-only, if it has side effects, rate limits, or authentication needs. The backward compatibility note is useful but insufficient for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief and front-loaded, with two sentences that convey the main points efficiently. There's no unnecessary verbosity, and each sentence adds value (method details and compatibility). However, it could be more structured with clearer separation of features.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (divination with a method) and the presence of an output schema, the description covers the basic purpose and method. However, with no annotations and low parameter coverage, it lacks details on behavior and inputs. It's minimally adequate but has clear gaps in context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has one parameter ('query') with 0% description coverage, and the tool description adds no information about parameters. It doesn't explain what the 'query' parameter is for, its format, or examples. With low schema coverage, the description fails to compensate, leaving parameters undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool performs 'I Ching divination with traditional three-coin method and changing lines,' which provides a general purpose. However, it's somewhat vague about what 'enhanced' and 'richer content' mean, and it doesn't clearly differentiate from sibling tools like 'bibliomantic_consultation' or 'get_hexagram_details.' The mention of backward compatibility adds context but doesn't sharpen the core purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives like 'bibliomantic_consultation' or 'get_hexagram_details.' The description implies it's for I Ching divination but doesn't specify scenarios, prerequisites, or exclusions. Without explicit when/when-not instructions, it offers minimal usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

server_statisticsD

Enhanced server statistics

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

D1.9/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but fails completely. 'Enhanced server statistics' gives no indication of whether this is a read operation, a calculation, a report generation, or something else. It doesn't mention permissions required, rate limits, side effects, or what 'enhanced' means in practical terms. The description provides zero behavioral context beyond the vague name.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

While technically concise (only two words), this is a case of under-specification rather than effective conciseness. The description doesn't provide enough information to be useful. Every word should earn its place, but here the words don't convey meaningful information - 'Enhanced' is vague and 'server statistics' merely repeats the tool name. This isn't front-loaded with critical information; it's just insufficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that this tool has no parameters, has an output schema (which helps), and has 100% schema coverage, the description should be more complete. However, 'Enhanced server statistics' fails to explain what the tool actually does, when to use it, or what makes it 'enhanced'. For a tool with zero parameters, the description could easily provide more context about what statistics are returned, their format, or their purpose. The existence of an output schema helps, but the description itself is inadequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters (schema description coverage is 100%), so there are no parameters to document. The description doesn't need to compensate for any parameter documentation gaps. While it could theoretically mention that no parameters are required, this is adequately covered by the structured schema information. The baseline for zero-parameter tools is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Enhanced server statistics' is tautological - it essentially restates the tool name 'server_statistics' with the adjective 'Enhanced'. It doesn't specify what action the tool performs (e.g., 'retrieve', 'generate', 'analyze') or what specific statistics it provides. While it distinguishes from the three sibling tools (which are all related to divination/consultation), it doesn't clearly articulate what makes these statistics 'enhanced' compared to basic statistics.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides absolutely no guidance on when to use this tool versus alternatives. It doesn't mention any context, prerequisites, or scenarios where this tool would be appropriate. Given that the sibling tools are all divination-related (bibliomantic_consultation, get_hexagram_details, i_ching_divination), there's no indication of whether this tool is part of that same domain or serves a different purpose entirely.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updates
    • First observedbibliomantic_consultation
    • First observedget_hexagram_details
    • First observedi_ching_divination
    • First observedserver_statistics

TDQS

C2.8/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: bibliomantic_consultation for general consultation, get_hexagram_details for retrieving specific hexagram information, i_ching_divination for performing divination, and server_statistics for monitoring usage. There is no overlap or ambiguity between these functions.

Naming Consistency3/5

The naming is mixed: bibliomantic_consultation and get_hexagram_details follow a verb_noun pattern, while i_ching_divination is a noun-based name and server_statistics is a simple noun phrase. This inconsistency makes the set less predictable, though the names remain readable.

Tool Count5/5

With 4 tools, the count is well-scoped for a server focused on I Ching and bibliomancy. Each tool serves a distinct role in consultation, divination, information retrieval, and monitoring, making the set efficient and purposeful.

Completeness4/5

The toolset covers core I Ching functionalities: consultation, divination, and hexagram details, with server_statistics for operational insights. A minor gap might be the lack of tools for saving or managing past consultations, but agents can work around this with existing tools.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Provides traditional Chinese metaphysics analysis capabilities including I Ching divination (hexagram generation and interpretation) and Bazi (Four Pillars) fortune-telling with comprehensive life analysis covering career, wealth, relationships, and health predictions.
    10
    52 npm
    30
    MIT
  • F
    license
    Not graded
    quality
    A
    maintenance
    Enables traditional Chinese metaphysics tools like Bazi, Ziwei, and Qimen via MCP, integrating AI analysis for divination and fortune-telling.
    614
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    An I-Ching oracle MCP server for casting hexagrams, looking up bilingual classical sources, and generating grounded Wilhelm/Baynes-style reflections.
    1
    -