Skip to content

shell 함수 (curl wrapper)

Node 설치 없이 ainote 호출하는 가장 간단한 방법.

셋업

~/.zshrc (또는 ~/.bashrc) 에 추가:

bash
# ainote MCP 환경
export AINOTE_API_URL="https://api.ainote.dev"
export AINOTE_API_KEY="h7Axq9XPsDTD2qr5yqtcCSaQ..."

# ainote 함수 — JSON-RPC 호출 wrapper (이름은 자유롭게 변경 가능)
ainote() {
  local method="$1"
  local args="${2:-{\}}"
  curl -s -X POST "$AINOTE_API_URL/api/mcp" \
    -H "Content-Type: application/json" \
    -H "Authorization: McpKey $AINOTE_API_KEY" \
    -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"${method}\",\"arguments\":${args}}}" \
    | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('result',{}).get('content',[{}])[0].get('text','') or json.dumps(d,indent=2,ensure_ascii=False))" 2>/dev/null
}

reload:

bash
source ~/.zshrc

사용

태스크

bash
# 오늘 할 일
ainote list_tasks '{"due_today":true,"limit":20}'

# 새 태스크 (필수: content)
ainote create_task '{"content":"테스트","due_date":"2026-05-08T10:00:00+09:00"}'

# 완료 처리 (completed_at 으로 ISO 시각)
ainote update_task '{"id":"<uuid>","completed_at":"2026-05-08T10:35:00+09:00"}'

# 삭제 (id 는 UUID)
ainote delete_task '{"id":"<uuid>"}'

메모리

bash
# 카테고리별 목록
ainote list_dev_docs '{"category":"claude","limit":50}'

# 단일 조회
ainote get_dev_doc '{"title":"global-claude-guidelines.md"}'

# 검색
ainote list_dev_docs '{"search":"firebase"}'

# 일괄 복원 (새 기기)
ainote pull_dev_docs '{}'

Vault / Sync

🚧 설계 단계 — 아직 구현 안 됨

vault_* / sync_* 도구는 아직 @ainote/mcp 에 포함돼 있지 않습니다. 호출 시 Tool not found. vault 개요 / sync 개요 참고.

헬퍼 함수

자주 쓰는 패턴 wrap:

bash
# 오늘 할 일 (alias)
ainote-today() { ainote list_tasks '{"due_today":true}'; }

# Push (파일 → ainote)
ainote-push() {
  local file="$1"
  local title="$2"
  local category="${3:-docs}"
  local content
  content=$(python3 -c "import sys,json; print(json.dumps(open('$file').read()))")
  local local_path
  local_path=$(realpath "$file")
  ainote update_dev_doc "{\"title\":\"$title\",\"content\":$content,\"local_path\":\"$local_path\",\"subcategory\":\"$category\"}" \
    || ainote create_dev_doc "{\"title\":\"$title\",\"content\":$content,\"local_path\":\"$local_path\",\"subcategory\":\"$category\"}"
}

# 사용
ainote-push ~/CLAUDE.md global-claude-guidelines.md claude
ainote-push ~/tennis_bracket/CLAUDE.md tennis-bracket-claude.md claude

디버그 모드

원시 응답 보고 싶을 때:

bash
ainote-raw() {
  curl -sv -X POST "$AINOTE_API_URL" \
    -H "Content-Type: application/json" \
    -H "Authorization: McpKey $AINOTE_API_KEY" \
    -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"$1\",\"arguments\":${2:-{\}}}}"
}

ainote-raw list_tasks '{}'  # 헤더 + 본문 모두

.env 보호

키를 ~/.zshrc 직접 X — ~/.zshenv 또는 별도 파일:

bash
# ~/.zshenv (gui app 도 읽음)
export AINOTE_API_KEY="..."

# ~/.zshrc 또는 별도
[ -f ~/.ainote-env ] && source ~/.ainote-env

~/.ainote-env 는 chmod 600:

bash
chmod 600 ~/.ainote-env

다음

MIT License · ainote.dev