Token导航 LogoToken导航TokenDH.com
Cedarscript MCP Server logo
开发工具stdio官方级别未说明来源级核验

Cedarscript MCP Server

MCP Server

CEDARScript MCP Server通过模型上下文协议(MCP)提供AI辅助的代码转换功能,支持安全、语义感知的代码修改。

工具数

3

提示词数

0

GitHub Stars

0

资源数

0
PythonClaude开发工具Claude DesktopClaudeVS Code

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

CEDARScript

提供方

CEDARScript

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install cedarscript-mcp-server

详细介绍

CEDARScript MCP服务器

通过模型上下文协议进行人工智能辅助代码转换

![License](https://opensource.org/licenses/Apache-2.0) ![Python](https://www.python.org/downloads/)

概述

CEDARScript MCP服务器展示了强大的 CEDARScript编辑器 通过模型上下文协议(MCP),使像Claude这样的AI代理能够执行智能、语义感知的代码转换。

主要特点

  • 🔒 缺省巩固安全:路径验证、沙盒、只读模式
  • 🎯 干运行模式:应用前预览更改
  • 🌲 树保姆供电:语言感知代码分析
  • 📡 STDIO传输:简单的子流程集成(无HTTP开销)
  • 🛠️ 生产准备就绪:全面的日志记录、错误处理、测试

快速开始

安装

pip install cedarscript-mcp-server

使用Claude Desktop

  1. 打开克劳德桌面配置(通常 ~/.config/Claude/claude_desktop_config.json)
  1. 添加CEDARScript MCP服务器:
{
  "mcpServers": {
    "cedarscript": {
      "command": "python",
      "args": [
        "-m",
        "cedarscript_mcp.server",
        "--root",
        "/path/to/your/project"
      ]
    }
  }
}
  1. 重新启动克劳德桌面
  1. 让Claude使用CEDARScript:

- “解析此CEDARScript命令: UPDATE myfile.py SET imports.append('import os')" - “应用此转换(先预览): UPDATE calculator.py SET function:calculate REPLACE 'x + 1' WITH 'x + 2'"

命令行用法

# Start server (STDIO mode)
python -m cedarscript_mcp.server --root /path/to/project

# With custom options
python -m cedarscript_mcp.server \
  --root /path/to/project \
  --read-only \
  --log-level DEBUG \
  --max-file-size 10485760

建筑

CEDARScript MCP服务器是一个精简的适配器层,它:

  1. 通过STDIO接受JSON-RPC请求
  2. 验证路径和安全约束
  3. 代表们 CEDARScript编辑器 执行
  4. 返回结构化结果或错误消息
┌─────────────────────────────────┐
│   Claude Desktop / VS Code      │
│        (MCP Client)             │
└────────────┬────────────────────┘
             │ JSON-RPC over STDIO
┌────────────▼────────────────────┐
│  CEDARScript MCP Server         │
│  • Security (path validation)   │
│  • Tools (parse, apply, list)   │
│  • Adapters (protocol mapping)  │
└────────────┬────────────────────┘
             │
┌────────────▼────────────────────┐
│   CEDARScript Editor (core)     │
│  • AST parsing                  │
│  • Tree-sitter analysis         │
│  • File transformations         │
└─────────────────────────────────┘

可用工具

parse_cedarscript

无需执行即可解析和验证CEDARScript命令。

参数:

  • content (字符串):CEDARScript命令

退货: 解析的AST命令

例子:

{
  "content": "UPDATE myfile.py SET imports.append('import os')"
}

apply_cedarscript

将CEDARScript转换应用于代码文件。

参数:

  • commands (字符串):CEDARScript命令
  • root (string):项目根目录路径
  • dry_run (boolean,默认值:true):预览更改而不写入

退货: 结果、差异(如果dry_run)、受影响的文件

例子:

{
  "commands": "UPDATE calculator.py SET function:add REPLACE 'x + y' WITH 'x + y + 1'",
  "root": "/path/to/project",
  "dry_run": true
}

list_capabilities

列出服务器功能和支持的功能。

退货: 服务器版本、功能、安全设置

配置

环境变量

  • CEDARSCRIPT_ROOT:默认项目根目录(默认:当前目录)
  • CEDARSCRIPT_LOG_LEVEL:日志记录级别(调试、信息、警告、错误)
  • CEDARSCRIPT_LOG_FORMAT:日志格式(文本、json)
  • CEDARSCRIPT_READ_ONLY:强制只读模式(真/假)
  • CEDARSCRIPT_MAX_FILE_SIZE:最大文件大小(以字节为单位)(默认值:10485760)

CLI参数

python -m cedarscript_mcp.server \
  --root /path/to/project \         # Project root directory
  --read-only \                     # Enable read-only mode
  --log-level DEBUG \               # Logging level
  --max-file-size 10485760          # Max file size (bytes)

安全

路径验证

  • 所有文件路径都会根据指定的根目录进行验证
  • 路径遍历攻击(../../../etc/passwd)被封锁
  • Symlinks已解析并验证

Denylist图案

与这些模式匹配的文件将被自动拒绝:

  • .git/**, node_modules/**, __pycache__/**
  • .env, *.env, .env.*
  • credentials.json, *.key, *.pem

只读模式

启用后,将拒绝所有写入操作(仅解析/分析)。

文件大小限制

可配置的最大文件大小(默认值:10MB),以防止资源耗尽。

发展

设置

# Clone repository
git clone https://github.com/CEDARScript/cedarscript-mcp-server.git
cd cedarscript-mcp-server

# Install development dependencies
make install

# Run tests
make test

# Run with coverage
make test-cov

# Format and lint
make check

生成文件目标

make help              # Show all available targets
make install           # Install with dev dependencies
make test              # Run full test suite
make test-fast         # Run tests (skip integration)
make check             # Format, lint, security checks
make run               # Launch server (demo mode)
make build             # Build distribution packages

planning/MAKEFILE_DESIGN.md 获取完整的目标文档。

测试

# Run all tests
make test

# With coverage report
make test-cov

# Watch mode (auto-rerun on changes)
make test-watch

# Test against multiple cedarscript-editor versions
make test-matrix

文档

示例

Claude桌面配置

examples/claude_desktop.json 用于插入式配置。

VS代码MCP客户端

examples/vscode_mcp.json 用于VS代码设置。

程序化使用

from cedarscript_mcp import PathValidator, apply_cedarscript_tool

# Create validator
validator = PathValidator(Path("/path/to/project"))

# Apply transformation (dry-run)
result = apply_cedarscript_tool(
    commands="UPDATE myfile.py SET imports.append('import os')",
    root="/path/to/project",
    dry_run=True,
    validator=validator
)

print(result)

故障排除

服务器未启动

问题: ModuleNotFoundError: No module named 'mcp'

解决方案:安装MCP SDK: pip install mcp>=1.0.0

路径验证错误

问题: SecurityError: Path escape attempt

解决方案:确保文件路径在指定的根目录内。

只读模式阻止写入

问题: SecurityError: Write operation rejected

解决方案:删除 --read-only 标志或集合 CEDARSCRIPT_READ_ONLY=false.

贡献

欢迎投稿!拜托:

  1. 分叉存储库
  2. 创建要素分支
  3. make check test 在承诺之前
  4. 提交拉取请求

许可证

Apache许可证2.0-请参阅 许可证 了解详情。

相关项目

支持

  • 问题:
  • 文档:
  • 电子邮件: cedarscript@orgecc.com

______________________________________________________________________

由以下材料制成❤️ CEDARScript团队

目录标签

目录标签

PythonClaude开发工具代码转换本地部署AI辅助开发安全代码编辑语义分析

支持客户端

Claude DesktopClaudeVS Code

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

3

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP