非传统思维服务器(v0.3.0)
一个上下文高效的MCP服务器,用于大胆、非传统和突破边界的问题解决。
这是一个基于TypeScript的MCP服务器,它实现了一个针对以下内容进行优化的非传统思维系统 节省上下文空间 基于Anthropic最新的MCP架构模式。它生成并跟踪问题的创造性解决方案,同时保持效率。
符合MCP规范2025-11-25 --用途@modelcontextprotocol/sdkv1.27.1带工具title,annotations,outputSchema,structuredContent响应,以及resource_link内容类型。
架构:上下文保存设计
此服务器演示了Anthropic的 将上下文开销减少98.7%的推荐模式:
关键上下文保存功能
- 用于随需数据加载的资源API
- 思想内容作为资源存储(thought://id) - Claude仅在明确需要时加载完整内容 - 默认情况下返回元数据,保存令牌
- 服务器端过滤
- search_thoughts 在本地过滤数据,而不是将未过滤的集传递给Claude - 只返回匹配的结果,而不是整个数据集 - 通过在源位置进行过滤来减少上下文消耗
- 元数据优先返回
- 工具只返回基本元数据+资源URI - 可通过资源API访问完整的思想内容 - Claude根据需要决定是否获取完整内容
- 基于文件的持久存储
- 数据持续存在 .thoughts/ 目录 - 没有跨会话累积的内存膨胀 - 易于在本地检查和调试想法
特性
工具(全上下文高效,MCP规范2025-11-25)
每个工具现在都包括:
title--客户端UI中显示的可读显示名称annotations--行为提示(readOnlyHint,destructiveHint,idempotentHint,openWorldHint)outputSchema--描述结构化结果的JSON模式structuredContent响应中——符合模式的机器可读输出resource_link内容项--客户端可以订阅或获取的显式链接
______________________________________________________________________
generate_unreasonable_thought--产生新的非传统想法
- 退货 resource_link + structuredContent,不是原始文本blob - 可以建立或反抗以前的想法 - 通过资源API提供完整的思想内容
branch_thought--创造新的思维分支
- 支持方向: more_extreme, opposite, tangential (现在为枚举类型) - 退货 resource_link + structuredContent 对于新的分支机构
search_thoughts--高效的元数据搜索
- 按branchId、isRebellion、challengesAssumption筛选 - 退货 structuredContent 输入计数+想法数组 - 包含限制参数以控制结果大小
资源(按需内容加载)
- 每个想法都可以作为一种资源:
thought://[thoughtId] - 元数据包括:isRebellion、挑战发布、时间戳、分支机构信息
- 只有当克劳德明确请求时,才会加载完整的思想内容
- 当存在许多想法时,大大减少了令牌的使用
这如何实现上下文效率
1.渐进式披露
克劳德不需要预先了解100个想法的全部内容。相反:
search_thoughts仅返回ID和元数据(每个想法100字节)- Claude有选择地通过参考资料API获取完整内容,以获取相关想法
- 类似于文件系统的工作方式:列出文件,然后打开特定文件
2.服务器端过滤
传统方法(❌ 效率低下):
All 1000 thoughts → Claude → Claude filters → Uses only 10
(costs tokens for all 1000)此服务器(✅ 高效):
search_thoughts filter params → Server filters locally → Returns only 10 results
(Claude never sees the unused 990)3.元数据优先模式
工具响应包括:
- 思想ID
- 访问完整内容的资源URI
- 简要元数据(每个2-3KB)
- 不是完整的500个字符的想法(每个想法节省约5KB)
节约示例:有100个想法:
- 旧方法:500KB上下文使用率
- 新方法:~30KB+只获取所需内容
发展
安装依赖项:
npm install构建服务器:
npm run build对于自动重建的开发:
npm run watch安装
要与Claude Desktop一起使用,请添加服务器配置:
在MacOS上: ~/Library/Application Support/Claude/claude_desktop_config.json 在Windows上: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"unconventional-thinking": {
"command": "/path/to/unconventional-thinking/build/index.js"
}
}
}用法示例
Claude: Generate an unreasonable thought about scaling problems
→ Tool: generate_unreasonable_thought("scaling problems")
← Returns: resource_link (thought://...) + structuredContent { thoughtId, isRebellion, ... }
Claude: What are all the rebellious thoughts?
→ Tool: search_thoughts(isRebellion=true, limit=5)
← Returns: structuredContent { count, thoughts: [...metadata] }
Claude: I need to see the full content of thought_xyz
→ Resource: Read thought://thought_xyz
← Returns: Full thought content (loaded only when needed)调试
由于MCP服务器通过stdio进行通信,调试可能具有挑战性。我们建议使用 MCP检查员,可作为包脚本使用:
npm run inspector检查器将提供一个URL,用于访问浏览器中的调试工具。
参考文献
此服务器实现了以下模式:
