CRM API服务器

Attio CRM的代码模式MCP服务器,通过3个工具提供130多个端点,简化API调用并减少令牌消耗。

  • by TrialAndErrorAI
  • TypeScript
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 TrialAndErrorAI/attio-mcp

使用说明

阿蒂奥mcp

代码模式MCP服务器 Attio CRM通过3个工具实现130多个端点。

建造于 试错公司.灵感来自 代码模式模式 来自Cloudflare。

为什么是代码模式?

传统MCP 编码模式
工具 35+(每个操作一个) 3(搜索、执行、上下文)
代币成本 ~8000个代币用于工具defs ~800个代币
新端点 更新每个工具定义 零更改
维护 按工具映射 只需更新规格

LLM编写JavaScript以查询API规范并直接调用端点。没有针对每个端点的工具映射。没有膨胀。

快速开始

git clone https://github.com/TrialAndErrorAI/attio-mcp.git
cd attio-mcp
npm install
npm run build

创建 .env:

ATTIO_API_KEY=your_api_key_here

从获取API密钥 Attio设置>开发人员>API密钥.

克劳德代码

添加到您的项目 .mcp.json:

{
  "mcpServers": {
    "attio": {
      "command": "node",
      "args": ["/path/to/attio-mcp/dist/index.js"],
      "env": {
        "ATTIO_API_KEY": "your_api_key_here"
      }
    }
  }
}

克劳德桌面版

添加 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "attio": {
      "command": "node",
      "args": ["/path/to/attio-mcp/dist/index.js"],
      "env": {
        "ATTIO_API_KEY": "your_api_key_here"
      }
    }
  }
}

工具

search(code)

编写JavaScript来探索Attio API规范。查找端点、检查参数、发现模式。

// Find all endpoints related to notes
const notes = Object.entries(spec.paths)
  .filter(([p]) => p.includes('notes'))
  .map(([path, methods]) => ({
    path,
    methods: Object.entries(methods).map(([m, op]) => ({
      method: m.toUpperCase(),
      summary: op.summary
    }))
  }));
return notes;

execute(code)

编写JavaScript来调用Attio API。身份验证是自动的。

// Find a company and create a note
const companies = await api.request({
  method: 'POST',
  path: '/v2/objects/companies/records/query',
  params: { filter: { name: { $contains: 'Acme' } }, limit: 1 }
});

const companyId = companies.data[0].id.record_id;

await api.request({
  method: 'POST',
  path: '/v2/notes',
  params: {
    data: {
      parent_object: 'companies',
      parent_record_id: companyId,
      title: 'Meeting Notes',
      content: 'Discussed Q1 roadmap...'
    }
  }
});

return { success: true, company: companies.data[0].values.name };

context(topic)

按主题查找Attio文档。在编写代码之前,对领域模型进行自我教育。

context("lists")     → docs about lists, entries, stages
context("attributes") → attribute types (select, status, text, etc.)
context("categories") → all top-level doc groupings
context("all")       → full documentation index

test_connection()

验证您的API密钥是否有效,并查看服务器统计信息。

建筑

src/
├── auth/api-key.ts       # API key auth (15 lines)
├── api/client.ts         # HTTP client with rate limiting
├── spec/
│   ├── openapi.json      # Attio's OpenAPI spec (embedded)
│   └── loader.ts         # Pre-resolves $refs for agent traversal
├── context/
│   ├── llms.txt          # Attio's documentation index
│   └── loader.ts         # Topic-based doc search
├── executor/sandbox.ts   # Node.js vm sandbox (proven pattern)
├── server/mcp-server.ts  # 4 tools: search, execute, context, test_connection
└── index.ts              # Entry point

安全

  • API密钥通过环境变量注入,从不暴露于LLM生成的代码
  • 代码执行在Node.js中运行 vm 沙盒——无文件系统、无网络、无环境访问
  • 仅注入全局变量(spec, api)在沙盒中可用
  • 输出截断为40000个字符,以防止上下文膨胀

许可证

麻省理工学院试错公司