@esaio/esa-mcp-server 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/.claude/settings.local.json +23 -0
  2. package/.dockerignore +36 -0
  3. package/.envrc +2 -0
  4. package/.github/dependabot.yml +18 -0
  5. package/.github/workflows/docker-publish.yml +120 -0
  6. package/.github/workflows/main.yml +41 -0
  7. package/.node-version +1 -0
  8. package/CLAUDE.md +94 -0
  9. package/Dockerfile +34 -0
  10. package/LICENSE +7 -0
  11. package/README.en.md +139 -0
  12. package/README.md +139 -0
  13. package/bin/index.js +30 -0
  14. package/biome.json +57 -0
  15. package/package.json +48 -0
  16. package/src/__tests__/fixtures/mock-comment.ts +90 -0
  17. package/src/__tests__/fixtures/mock-post.ts +79 -0
  18. package/src/__tests__/index.test.ts +209 -0
  19. package/src/api_client/__tests__/index.test.ts +149 -0
  20. package/src/api_client/__tests__/middleware.test.ts +119 -0
  21. package/src/api_client/__tests__/with-context.test.ts +98 -0
  22. package/src/api_client/index.ts +29 -0
  23. package/src/api_client/middleware.ts +21 -0
  24. package/src/api_client/with-context.ts +26 -0
  25. package/src/config/__tests__/index.test.ts +65 -0
  26. package/src/config/index.ts +20 -0
  27. package/src/context/mcp-context.ts +1 -0
  28. package/src/context/stdio-context.ts +6 -0
  29. package/src/errors/missing-team-name-error.ts +8 -0
  30. package/src/formatters/__tests__/mcp-response.test.ts +106 -0
  31. package/src/formatters/mcp-response.ts +95 -0
  32. package/src/generated/api-types.ts +2691 -0
  33. package/src/i18n/__tests__/index.test.ts +53 -0
  34. package/src/i18n/index.ts +39 -0
  35. package/src/index.ts +47 -0
  36. package/src/locales/en.json +13 -0
  37. package/src/locales/ja.json +13 -0
  38. package/src/prompts/__tests__/index.test.ts +47 -0
  39. package/src/prompts/__tests__/summarize-post.test.ts +291 -0
  40. package/src/prompts/index.ts +21 -0
  41. package/src/prompts/summarize-post.ts +94 -0
  42. package/src/resources/__tests__/index.test.ts +49 -0
  43. package/src/resources/__tests__/recent-posts-list.test.ts +91 -0
  44. package/src/resources/__tests__/recent-posts.test.ts +270 -0
  45. package/src/resources/index.ts +33 -0
  46. package/src/resources/recent-posts-list.ts +22 -0
  47. package/src/resources/recent-posts.ts +45 -0
  48. package/src/schemas/team-name-schema.ts +19 -0
  49. package/src/tools/__tests__/categories.test.ts +226 -0
  50. package/src/tools/__tests__/comments.test.ts +970 -0
  51. package/src/tools/__tests__/helps.test.ts +222 -0
  52. package/src/tools/__tests__/index.test.ts +47 -0
  53. package/src/tools/__tests__/post-actions.test.ts +445 -0
  54. package/src/tools/__tests__/posts.test.ts +917 -0
  55. package/src/tools/__tests__/search.test.ts +339 -0
  56. package/src/tools/__tests__/teams.test.ts +615 -0
  57. package/src/tools/categories.ts +93 -0
  58. package/src/tools/comments.ts +258 -0
  59. package/src/tools/helps.ts +50 -0
  60. package/src/tools/index.ts +324 -0
  61. package/src/tools/post-actions.ts +132 -0
  62. package/src/tools/posts.ts +179 -0
  63. package/src/tools/search.ts +98 -0
  64. package/src/tools/teams.ts +157 -0
  65. package/src/transformers/__tests__/category-transformer.test.ts +161 -0
  66. package/src/transformers/__tests__/comment-transformer.test.ts +129 -0
  67. package/src/transformers/__tests__/post-name-normalizer.test.ts +53 -0
  68. package/src/transformers/__tests__/post-transformer.test.ts +70 -0
  69. package/src/transformers/__tests__/query-normalizer.test.ts +98 -0
  70. package/src/transformers/__tests__/team-name-normalizer.test.ts +21 -0
  71. package/src/transformers/category-transformer.ts +36 -0
  72. package/src/transformers/comment-transformer.ts +34 -0
  73. package/src/transformers/post-name-normalizer.ts +30 -0
  74. package/src/transformers/post-transformer.ts +38 -0
  75. package/src/transformers/query-normalizer.ts +36 -0
  76. package/src/transformers/team-name-normalizer.ts +7 -0
  77. package/tsconfig.build.json +4 -0
  78. package/tsconfig.json +30 -0
  79. package/tsdown.config.ts +13 -0
  80. package/vitest.config.ts +24 -0
@@ -0,0 +1,23 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm run build:*)",
5
+ "WebFetch(domain:openapi-ts.dev)",
6
+ "WebFetch(domain:docs.esa.io)",
7
+ "WebFetch(domain:raw.githubusercontent.com)",
8
+ "Bash(rm:*)",
9
+ "Bash(mv:*)",
10
+ "Bash(npm run test:run:*)",
11
+ "Bash(npm run type-check:*)",
12
+ "Bash(npm test:*)",
13
+ "WebFetch(domain:modelcontextprotocol.io)",
14
+ "Bash(git mv:*)",
15
+ "Bash(git add:*)",
16
+ "Bash(node:*)",
17
+ "Bash(npm run lint:*)",
18
+ "Bash(git commit:*)",
19
+ "Bash(grep:*)"
20
+ ],
21
+ "deny": []
22
+ }
23
+ }
package/.dockerignore ADDED
@@ -0,0 +1,36 @@
1
+ .git
2
+ .github
3
+
4
+ .env
5
+ .env.*
6
+ .envrc
7
+
8
+ .vscode
9
+ .idea
10
+ *.swp
11
+ *.swo
12
+ *~
13
+ .DS_Store
14
+
15
+ *.log
16
+ npm-debug.log*
17
+
18
+ tmp
19
+ temp
20
+ .tmp
21
+
22
+ node_modules
23
+ .node-version
24
+
25
+ README.md
26
+ LICENSE
27
+
28
+ coverage
29
+
30
+ .claude
31
+ CLAUDE.md
32
+ Dockerfile
33
+
34
+ bin
35
+ build
36
+ dist
package/.envrc ADDED
@@ -0,0 +1,2 @@
1
+ export ESA_ACCESS_TOKEN=ep2_BI_DX0c-_GB-dlNEcbVYdJqZhkA4gKQtHvmL9LLWBqo
2
+ export ESA_API_BASE_URL=http://api.lvh.me:3000
@@ -0,0 +1,18 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ - package-ecosystem: npm
8
+ directory: "/"
9
+ schedule:
10
+ interval: daily
11
+ time: "03:00"
12
+ timezone: Asia/Tokyo
13
+ open-pull-requests-limit: 10
14
+ ignore:
15
+ - dependency-name: "zod"
16
+ update-types: ["version-update:semver-major"]
17
+ - dependency-name: "@types/node"
18
+ update-types: ["version-update:semver-major"]
@@ -0,0 +1,120 @@
1
+ name: Docker Build and Push
2
+
3
+ on:
4
+ push:
5
+ tags: [ 'v*' ]
6
+
7
+ env:
8
+ REGISTRY: ghcr.io
9
+ IMAGE_NAME: ${{ github.repository }}
10
+
11
+ jobs:
12
+ build:
13
+ strategy:
14
+ fail-fast: true
15
+ matrix:
16
+ include:
17
+ - platform: linux/amd64
18
+ runner: ubuntu-latest
19
+ - platform: linux/arm64
20
+ runner: ubuntu-24.04-arm
21
+ runs-on: ${{ matrix.runner }}
22
+ permissions:
23
+ contents: read
24
+ packages: write
25
+
26
+ steps:
27
+ - name: Prepare
28
+ run: |
29
+ platform=${{ matrix.platform }}
30
+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
31
+
32
+ - name: Checkout repository
33
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # https://github.com/actions/checkout/tree/v5
34
+
35
+ - name: Log in to Container Registry
36
+ uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # https://github.com/docker/login-action/tree/v3
37
+ with:
38
+ registry: ${{ env.REGISTRY }}
39
+ username: ${{ github.actor }}
40
+ password: ${{ secrets.GITHUB_TOKEN }}
41
+
42
+ - name: Extract metadata
43
+ id: meta
44
+ uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # https://github.com/docker/metadata-action/tree/v5
45
+ with:
46
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
47
+
48
+ - name: Set up Docker Buildx
49
+ uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # https://github.com/docker/setup-buildx-action/tree/v3
50
+
51
+ - name: Build and push by digest
52
+ id: build
53
+ uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # https://github.com/docker/build-push-action/tree/v6
54
+ with:
55
+ context: .
56
+ platforms: ${{ matrix.platform }}
57
+ labels: ${{ steps.meta.outputs.labels }}
58
+ outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
59
+ cache-from: type=gha
60
+ cache-to: type=gha,mode=max
61
+
62
+ - name: Export digest
63
+ run: |
64
+ mkdir -p /tmp/digests
65
+ digest="${{ steps.build.outputs.digest }}"
66
+ touch "/tmp/digests/${digest#sha256:}"
67
+
68
+ - name: Upload digest
69
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # https://github.com/actions/upload-artifact/tree/v4
70
+ with:
71
+ name: digests-${{ env.PLATFORM_PAIR }}
72
+ path: /tmp/digests/*
73
+ if-no-files-found: error
74
+ retention-days: 1
75
+
76
+ merge:
77
+ runs-on: ubuntu-latest
78
+ needs:
79
+ - build
80
+ permissions:
81
+ contents: read
82
+ packages: write
83
+
84
+ steps:
85
+ - name: Download digests
86
+ uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # https://github.com/actions/download-artifact/tree/v5
87
+ with:
88
+ path: /tmp/digests
89
+ pattern: digests-*
90
+ merge-multiple: true
91
+
92
+ - name: Log in to Container Registry
93
+ uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # https://github.com/docker/login-action/tree/v3
94
+ with:
95
+ registry: ${{ env.REGISTRY }}
96
+ username: ${{ github.actor }}
97
+ password: ${{ secrets.GITHUB_TOKEN }}
98
+
99
+ - name: Set up Docker Buildx
100
+ uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # https://github.com/docker/setup-buildx-action/tree/v3
101
+
102
+ - name: Extract metadata
103
+ id: meta
104
+ uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # https://github.com/docker/metadata-action/tree/v5
105
+ with:
106
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
107
+ tags: |
108
+ type=semver,pattern={{version}}
109
+ type=semver,pattern={{major}}.{{minor}}
110
+ type=semver,pattern={{major}}
111
+
112
+ - name: Create manifest list and push
113
+ working-directory: /tmp/digests
114
+ run: |
115
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
116
+ $(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
117
+
118
+ - name: Inspect image
119
+ run: |
120
+ docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
@@ -0,0 +1,41 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ pull_request:
7
+ types: [opened, synchronize, reopened]
8
+
9
+ env:
10
+ NODE_VERSION: 20.19.4
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # https://github.com/actions/checkout/tree/v5
17
+ - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # https://github.com/actions/setup-node/tree/v5
18
+ with:
19
+ node-version: ${{ env.NODE_VERSION }}
20
+ cache: 'npm'
21
+ - name: Install dependencies
22
+ run: npm ci
23
+ - name: Run linting
24
+ run: |
25
+ output=$(npm run lint 2>&1)
26
+ echo "$output"
27
+ if echo "$output" | grep -q "schema version does not match"; then
28
+ echo "::error::Biome schema version mismatch detected. Please run 'npx biome migrate --write' to update biome.json"
29
+ exit 1
30
+ fi
31
+ - name: Run type checking
32
+ run: npm run type-check
33
+ - name: Run tests
34
+ run: npm run test:coverage
35
+ - name: Upload coverage reports
36
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # https://github.com/actions/upload-artifact/tree/v4
37
+ with:
38
+ name: coverage
39
+ path: coverage/
40
+ - name: Build
41
+ run: npm run build
package/.node-version ADDED
@@ -0,0 +1 @@
1
+ 24.4.1
package/CLAUDE.md ADDED
@@ -0,0 +1,94 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Build and Development Commands
6
+
7
+ ```bash
8
+ # Install dependencies
9
+ npm install
10
+
11
+ # Build the project
12
+ npm run build
13
+
14
+ # Run tests
15
+ npm test # Watch mode
16
+ npm run test:run # Single run
17
+ npm run test:coverage # With coverage report
18
+
19
+ # Linting
20
+ npm run lint # Check for linting issues
21
+ npm run lint:fix # Auto-fix linting and formatting issues
22
+
23
+ # Type checking
24
+ npm run type-check # Check TypeScript types without building
25
+ ```
26
+
27
+ ## Architecture Overview
28
+
29
+ This is an MCP (Model Context Protocol) server implementation for esa.io, using STDIO transport for communication. The architecture follows a simple structure:
30
+
31
+ ### Core Components
32
+
33
+ 1. **MCP Server Setup** (`src/index.ts`): Entry point that initializes the MCP server with STDIO transport. Handles transport lifecycle events and graceful error handling.
34
+
35
+ 2. **Configuration** (`src/config/index.ts`): Centralized configuration management that reads from environment variables. Required env vars:
36
+ - `ESA_ACCESS_TOKEN`: Required for esa.io API authentication
37
+ - `ESA_API_BASE_URL`: Optional API base URL (defaults to https://api.esa.io)
38
+
39
+ ### Key Technical Details
40
+
41
+ - **Module System**: ES modules (type: "module" in package.json)
42
+ - **TypeScript**: Strict mode enabled with comprehensive type checking
43
+ - **Code Style**: Enforced by Biome (2 spaces, double quotes, semicolons, trailing commas)
44
+ - **Node Version**: Requires Node.js >= 20.19.4
45
+
46
+ ### MCP Server Pattern
47
+
48
+ The server follows the standard MCP pattern:
49
+ 1. Validate configuration on startup
50
+ 2. Create McpServer instance with name and version
51
+ 3. Initialize StdioServerTransport for STDIO communication
52
+ 4. Handle transport lifecycle (onclose, onerror)
53
+ 5. Connect server to transport
54
+
55
+ When extending functionality, new tools and resources should be registered with the server instance before connecting to transport.
56
+
57
+ ## Testing Guidelines
58
+
59
+ ### Test Writing Principles
60
+
61
+ When writing tests, follow these principles for maintainable and readable test code:
62
+
63
+ 1. **Import Order Optimization**
64
+ - Type imports first (`import type`)
65
+ - External dependencies next
66
+ - Internal modules last
67
+ - Group related imports together
68
+
69
+ 2. **Mock Creation Patterns**
70
+ - Use `as unknown as` pattern for type casting to keep mocks minimal and focused
71
+ - Create helper functions for complex mock objects (e.g., `createMockConfig`, `createMockServer`)
72
+ - Extract repetitive mock setup into shared helper functions (e.g., `setupServerMocks`)
73
+ - Return mock instances from helper functions for assertion access
74
+
75
+ 3. **Mock Documentation**
76
+ - Add concise comments explaining the purpose of each mock
77
+ - Focus on WHY the mock is needed, not WHAT it does
78
+ - Keep comments brief and directly above the mock definition
79
+
80
+ 4. **Module Mocking with vi.doMock**
81
+ - Use `vi.doMock` for replacing entire modules during import resolution
82
+ - Always call `vi.doMock` before the module import
83
+ - Use dynamic imports (`await import()`) after setting up module mocks
84
+ - Remember that `vi.doMock` is fundamentally different from `vi.fn()` - it intercepts module loading
85
+
86
+ 5. **Test Structure**
87
+ - Keep each test focused on a single behavior
88
+ - Use descriptive test names that explain the expected outcome
89
+ - Group related tests with `describe` blocks
90
+ - Clean up mocks in `beforeEach`/`afterEach` hooks
91
+
92
+ ### Example Test Pattern
93
+
94
+ - READ src/__tests__/index.test.ts
package/Dockerfile ADDED
@@ -0,0 +1,34 @@
1
+ # syntax=docker/dockerfile:1
2
+
3
+ FROM node:alpine AS base
4
+
5
+ WORKDIR /app
6
+
7
+ FROM base AS deps
8
+
9
+ RUN --mount=type=bind,source=package.json,target=package.json \
10
+ --mount=type=bind,source=package-lock.json,target=package-lock.json \
11
+ --mount=type=cache,target=/root/.npm \
12
+ npm ci --only=production
13
+
14
+ FROM base AS build
15
+
16
+ RUN --mount=type=bind,source=package.json,target=package.json \
17
+ --mount=type=bind,source=package-lock.json,target=package-lock.json \
18
+ --mount=type=cache,target=/root/.npm \
19
+ npm ci
20
+
21
+ COPY . .
22
+
23
+ RUN npm run build
24
+
25
+ FROM base AS production
26
+
27
+ ENV NODE_ENV=production
28
+
29
+ USER node
30
+
31
+ COPY --from=deps /app/node_modules ./node_modules
32
+ COPY --from=build /app/bin ./bin
33
+
34
+ ENTRYPOINT ["node", "bin/index.js"]
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2025 esa LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,139 @@
1
+ # esa MCP Server
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+
5
+ [日本語](README.md) | **English**
6
+
7
+ Official Model Context Protocol (MCP) server for esa.io - STDIO transport version.
8
+
9
+ ## Overview
10
+
11
+ This MCP server provides seamless integration between AI assistants and [esa.io](https://esa.io), a collaborative documentation platform. It enables AI assistants to read, create, update, and manage esa documents directly through the Model Context Protocol.
12
+
13
+ ## Available Tools
14
+
15
+ ### Team Management
16
+ - `esa_get_teams` - Get user's accessible esa teams
17
+ - `esa_get_team_stats` - Get team statistics (members, posts, comments, stars, watches, active users)
18
+ - `esa_get_team_tags` - Get all tags used in team posts with count
19
+ - `esa_get_team_members` - Get team members with roles and profile information
20
+
21
+ ### Post Management
22
+
23
+ - `esa_search_posts` - Search for posts in esa.io
24
+ - `esa_get_post` - Get a specific post by post number
25
+ - `esa_create_post` - Create a new post with tags, category, and WIP status
26
+ - `esa_update_post` - Update existing post (title, content, tags, category, WIP status)
27
+
28
+ ### Post Actions
29
+ - `esa_archive_post` - Archive a post by moving to Archived/ category
30
+ - `esa_ship_post` - Ship a post (mark as complete by setting wip to false)
31
+ - `esa_duplicate_post` - Prepare a post for duplication (retrieve name and body_md)
32
+
33
+ ### Comment Management
34
+ - `esa_get_comment` - Get a specific comment by ID
35
+ - `esa_create_comment` - Create a new comment on a post
36
+ - `esa_update_comment` - Update an existing comment
37
+ - `esa_delete_comment` - Delete a comment
38
+ - `esa_get_post_comments` - Get comments for a specific post with pagination
39
+ - `esa_get_team_comments` - Get team comments with pagination
40
+
41
+ ### Category Management
42
+ - `esa_get_categories` - Get categories and subcategories for a specific path
43
+ - `esa_get_top_categories` - Get all top-level categories for a team
44
+
45
+ ### Help & Documentation
46
+ - `esa_get_search_options_help` - Get esa search syntax documentation
47
+ - `esa_get_markdown_syntax_help` - Get esa Markdown syntax documentation
48
+ - `esa_search_help` - Search esa documentation for features and terminology
49
+
50
+ ## Available Resources
51
+
52
+ - `esa_recent_posts` - Fetch recent updated posts from esa team
53
+ - Template: `esa://teams/{teamName}/posts/recent`
54
+ - Returns: JSON list of recently updated posts
55
+
56
+ ## Available Prompts
57
+
58
+ - `esa_summarize_post` - Summarize an esa post content
59
+ - Input: Team name and post number
60
+ - Output: Structured summary of the post content
61
+
62
+ ## MCP Client Configuration
63
+
64
+ Add to your MCP client configuration file:
65
+
66
+ ### Required Environment Variables
67
+
68
+ - ESA_ACCESS_TOKEN: Access Token
69
+ - Required scopes: `read write` or `admin:comment read:post write:post read:category read:tag read:team read:member`
70
+ - [PAT v2](https://docs.esa.io/posts/559) is recommended.
71
+ - LANG: Language for UI
72
+
73
+ ### Claude Desktop Example
74
+
75
+ Add to `claude_desktop_config.json`:
76
+
77
+ #### Option 1: Docker (Recommended)
78
+
79
+ ```json
80
+ {
81
+ "mcpServers": {
82
+ "esa": {
83
+ "command": "docker",
84
+ "args": [
85
+ "run",
86
+ "-i",
87
+ "--rm",
88
+ "-e",
89
+ "ESA_ACCESS_TOKEN",
90
+ "-e",
91
+ "LANG",
92
+ "ghcr.io/esaio/esa-mcp-server"
93
+ ],
94
+ "env": {
95
+ "ESA_ACCESS_TOKEN": "your_personal_access_token",
96
+ "LANG": "en"
97
+ }
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ #### Option 2: npx
104
+
105
+ ```json
106
+ {
107
+ "mcpServers": {
108
+ "esa": {
109
+ "command": "/Users/your-username/.nodenv/shims/npx",
110
+ "args": [
111
+ "@esaio/esa-mcp-server"
112
+ ],
113
+ "env": {
114
+ "ESA_ACCESS_TOKEN": "your_personal_access_token",
115
+ "LANG": "en"
116
+ }
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ > **Note**: Replace `/path/to/your/node` with the output of `which node` command.
123
+
124
+ ## Links
125
+
126
+ - [esa.io](https://esa.io) - The collaborative documentation platform
127
+ - [Model Context Protocol](https://modelcontextprotocol.io) - Learn more about MCP
128
+ - [API Documentation](https://docs.esa.io/posts/102) - esa.io API reference
129
+ - [Claude Desktop](https://claude.ai/download) - AI assistant with MCP support
130
+
131
+ ## Support
132
+
133
+ - 📧 Support: [Feedback Form](https://esa.io/feedbacks/new)
134
+ - 🐛 Issues: [GitHub Issues](https://github.com/esaio/esa-mcp-server/issues)
135
+ - 📖 Help: [esa Docs](https://docs.esa.io)
136
+
137
+ ---
138
+
139
+ Made with ❤️ by the esa team
package/README.md ADDED
@@ -0,0 +1,139 @@
1
+ # esa MCP Server
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+
5
+ **日本語** | [English](README.en.md)
6
+
7
+ esa.io の公式 MCP(Model Context Protocol)サーバー(STDIO Transport版)
8
+
9
+ ## 概要
10
+
11
+ AI アシスタントと情報共有サービス [esa](https://esa.io) をつなぐ MCP サーバーです。Model Context Protocol 経由で、AI アシスタントから esa の記事を読んだり、作成・更新・管理などができます。
12
+
13
+ ## 使えるツール
14
+
15
+ ### チーム管理
16
+ - `esa_get_teams` - 所属している esa チームの一覧
17
+ - `esa_get_team_stats` - チームの統計情報(メンバー数、記事数、コメント数など)
18
+ - `esa_get_team_tags` - チーム内で使われているタグと使用回数
19
+ - `esa_get_team_members` - チームメンバーとその役割・プロフィール
20
+
21
+ ### 記事管理
22
+
23
+ - `esa_search_posts` - 記事を検索
24
+ - `esa_get_post` - 記事IDから記事を取得
25
+ - `esa_create_post` - 新しい記事を作成(タグ、カテゴリー、WIP ステータス付き)
26
+ - `esa_update_post` - 記事を更新(タイトル、本文、タグ、カテゴリー、WIP ステータス)
27
+
28
+ ### 記事の操作
29
+ - `esa_archive_post` - 記事をアーカイブ(Archived/ カテゴリーへ移動)
30
+ - `esa_ship_post` - 記事を Ship It!(WIP を外して公開)
31
+ - `esa_duplicate_post` - 記事を複製するための準備(タイトルと本文を取得)
32
+
33
+ ### コメント管理
34
+ - `esa_get_comment` - コメント ID からコメントを取得
35
+ - `esa_create_comment` - 記事にコメントを追加
36
+ - `esa_update_comment` - コメントを編集
37
+ - `esa_delete_comment` - コメントを削除
38
+ - `esa_get_post_comments` - 記事のコメント一覧(ページング対応)
39
+ - `esa_get_team_comments` - チーム全体のコメント一覧(ページング対応)
40
+
41
+ ### カテゴリー管理
42
+ - `esa_get_categories` - 指定パス配下のカテゴリー一覧
43
+ - `esa_get_top_categories` - トップレベルのカテゴリー一覧
44
+
45
+ ### ヘルプとドキュメント
46
+ - `esa_get_search_options_help` - esa の検索構文ヘルプ
47
+ - `esa_get_markdown_syntax_help` - esa の Markdown 記法ヘルプ
48
+ - `esa_search_help` - esa のドキュメントから機能や用語を検索
49
+
50
+ ## リソース
51
+
52
+ - `esa_recent_posts` - 最近更新された記事の一覧
53
+ - テンプレート: `esa://teams/{teamName}/posts/recent`
54
+ - 戻り値: 最近更新された記事の JSON リスト
55
+
56
+ ## プロンプト
57
+
58
+ - `esa_summarize_post` - esa の記事を要約
59
+ - 入力: チーム名と記事ID
60
+ - 出力: 記事の構造化された要約
61
+
62
+ ## MCP クライアントの設定
63
+
64
+ MCP クライアントの設定ファイルに以下を追加します:
65
+
66
+ ### 用意する環境変数
67
+
68
+ - ESA_ACCESS_TOKEN: アクセストークン
69
+ - 必要なスコープ: `read write` または `admin:comment read:post write:post read:category read:tag read:team read:member`
70
+ - [PAT v2](https://docs.esa.io/posts/559)を推奨します。
71
+ - LANG: UI の言語設定
72
+
73
+ ### Claude Desktop の例
74
+
75
+ `claude_desktop_config.json` への追加方法:
76
+
77
+ #### オプション 1: docker(推奨)
78
+
79
+ ```json
80
+ {
81
+ "mcpServers": {
82
+ "esa": {
83
+ "command": "docker",
84
+ "args": [
85
+ "run",
86
+ "-i",
87
+ "--rm",
88
+ "-e",
89
+ "ESA_ACCESS_TOKEN",
90
+ "-e",
91
+ "LANG",
92
+ "ghcr.io/esaio/esa-mcp-server"
93
+ ],
94
+ "env": {
95
+ "ESA_ACCESS_TOKEN": "your_personal_access_token",
96
+ "LANG": "ja"
97
+ }
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ #### オプション 2: npx
104
+
105
+ ```json
106
+ {
107
+ "mcpServers": {
108
+ "esa": {
109
+ "command": "/Users/your-username/.nodenv/shims/npx",
110
+ "args": [
111
+ "@esaio/esa-mcp-server"
112
+ ],
113
+ "env": {
114
+ "ESA_ACCESS_TOKEN": "your_personal_access_token",
115
+ "LANG": "ja"
116
+ }
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ > **注意**: `/path/to/your/node` は `which node` で調べたパスに置き換えてください。
123
+
124
+ ## リンク
125
+
126
+ - [esa.io](https://esa.io) - 情報共有サービス esa
127
+ - [Model Context Protocol](https://modelcontextprotocol.io) - MCP の詳細
128
+ - [API ドキュメント](https://docs.esa.io/posts/102) - esa API リファレンス
129
+ - [Claude Desktop](https://claude.ai/download) - MCP 対応の AI アシスタント
130
+
131
+ ## サポート
132
+
133
+ - 📧 Support: [Feedback Form](https://esa.io/feedbacks/new)
134
+ - 🐛 Issues: [GitHub Issues](https://github.com/esaio/esa-mcp-server/issues)
135
+ - 📖 Help: [esa Docs](https://docs.esa.io)
136
+
137
+ ---
138
+
139
+ Made with ❤️ by the esa team