Skip to content

Commit 81fc057

Browse files
committed
refactor!: replace domain-specific tools with generic HTTP method tools
BREAKING CHANGE: This replaces 8+ domain-specific tools with 5 generic HTTP method tools. Before (v2.x): conf_ls_spaces, conf_get_space, conf_ls_pages, conf_get_page, conf_search, conf_ls_comments, conf_add_comment, ... After (v3.0): conf_get, conf_post, conf_put, conf_patch, conf_delete Migration examples: - conf_ls_spaces -> conf_get with path /wiki/api/v2/spaces - conf_get_page -> conf_get with path /wiki/api/v2/pages/{id} - conf_search -> conf_get with path /wiki/rest/api/search?cql=... - conf_add_comment -> conf_post with path /wiki/api/v2/pages/{id}/footer-comments New features: - Full Confluence API access via generic HTTP methods - JMESPath filtering support for response transformation - Consistent with Bitbucket v2.0 and Jira v3.0 patterns - PATCH method support for partial updates - Proper handling of 204 No Content responses Removed: - 8 domain-specific tools and their types - 5 controllers with formatters - 12 service files with vendor types - 7 utility files (ADF, markdown, pagination, etc.) - CLI tests for old commands Added: - src/tools/atlassian.api.tool.ts (5 generic tools) - src/tools/atlassian.api.types.ts (Zod schemas) - src/controllers/atlassian.api.controller.ts - src/cli/atlassian.api.cli.ts - src/utils/jq.util.ts (JMESPath wrapper)
1 parent 1d877f8 commit 81fc057

File tree

59 files changed

+1155
-10684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1155
-10684
lines changed

README.md

Lines changed: 161 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ Transform how you access and interact with your team's knowledge by connecting C
66

77
## What You Can Do
88

9-
**Ask AI about your documentation**: *"What's our API authentication process?"*
10-
**Search across all spaces**: *"Find all pages about security best practices"*
11-
**Get instant answers**: *"Show me the latest release notes from the Product space"*
12-
**Access team knowledge**: *"What are our HR policies for remote work?"*
13-
**Review page comments**: *"Show me the discussion on the architecture document"*
14-
**Find specific content**: *"Search for pages with 'onboarding' in the title"*
9+
- **Ask AI about your documentation**: "What's our API authentication process?"
10+
- **Search across all spaces**: "Find all pages about security best practices"
11+
- **Get instant answers**: "Show me the latest release notes from the Product space"
12+
- **Access team knowledge**: "What are our HR policies for remote work?"
13+
- **Review page comments**: "Show me the discussion on the architecture document"
14+
- **Create and update content**: "Create a new page in the DEV space"
1515

1616
## Perfect For
1717

1818
- **Developers** who need quick access to technical documentation and API guides
1919
- **Product Managers** searching for requirements, specs, and project updates
20-
- **HR Teams** accessing policy documents and employee resources quickly
20+
- **HR Teams** accessing policy documents and employee resources quickly
2121
- **Support Teams** finding troubleshooting guides and knowledge base articles
2222
- **Anyone** who wants to interact with Confluence using natural language
2323

@@ -39,16 +39,16 @@ Generate a Confluence API Token:
3939
# Set your credentials
4040
export ATLASSIAN_SITE_NAME="your-company" # for your-company.atlassian.net
4141
export ATLASSIAN_USER_EMAIL="your.email@company.com"
42-
export ATLASSIAN_API_TOKEN="your_copied_token"
42+
export ATLASSIAN_API_TOKEN="your_api_token"
4343

4444
# List your Confluence spaces
45-
npx -y @aashari/mcp-server-atlassian-confluence ls-spaces
45+
npx -y @aashari/mcp-server-atlassian-confluence get --path "/wiki/api/v2/spaces"
4646

4747
# Get details about a specific space
48-
npx -y @aashari/mcp-server-atlassian-confluence get-space --space-key DEV
48+
npx -y @aashari/mcp-server-atlassian-confluence get --path "/wiki/api/v2/spaces/123456"
4949

50-
# Search for pages
51-
npx -y @aashari/mcp-server-atlassian-confluence search --query "API documentation"
50+
# Get a page with JMESPath filtering
51+
npx -y @aashari/mcp-server-atlassian-confluence get --path "/wiki/api/v2/pages/789" --jq "{id: id, title: title, status: status}"
5252
```
5353

5454
## Connect to AI Assistants
@@ -73,7 +73,7 @@ Add this to your Claude configuration file (`~/.claude/claude_desktop_config.jso
7373
}
7474
```
7575

76-
Restart Claude Desktop, and you'll see "🔗 confluence" in the status bar.
76+
Restart Claude Desktop, and you'll see the confluence server in the status bar.
7777

7878
### For Other AI Assistants
7979

@@ -94,7 +94,7 @@ Create `~/.mcp/configs.json` for system-wide configuration:
9494
"confluence": {
9595
"environments": {
9696
"ATLASSIAN_SITE_NAME": "your-company",
97-
"ATLASSIAN_USER_EMAIL": "your.email@company.com",
97+
"ATLASSIAN_USER_EMAIL": "your.email@company.com",
9898
"ATLASSIAN_API_TOKEN": "your_api_token"
9999
}
100100
}
@@ -103,94 +103,168 @@ Create `~/.mcp/configs.json` for system-wide configuration:
103103

104104
**Alternative config keys:** The system also accepts `"atlassian-confluence"`, `"@aashari/mcp-server-atlassian-confluence"`, or `"mcp-server-atlassian-confluence"` instead of `"confluence"`.
105105

106+
## Available Tools
107+
108+
This MCP server provides 5 generic tools that can access any Confluence API endpoint:
109+
110+
| Tool | Description |
111+
|------|-------------|
112+
| `conf_get` | GET any Confluence API endpoint (read data) |
113+
| `conf_post` | POST to any endpoint (create resources) |
114+
| `conf_put` | PUT to any endpoint (replace resources) |
115+
| `conf_patch` | PATCH any endpoint (partial updates) |
116+
| `conf_delete` | DELETE any endpoint (remove resources) |
117+
118+
### Common API Paths
119+
120+
**Spaces:**
121+
- `/wiki/api/v2/spaces` - List all spaces
122+
- `/wiki/api/v2/spaces/{id}` - Get space details
123+
124+
**Pages:**
125+
- `/wiki/api/v2/pages` - List pages (use `space-id` query param to filter)
126+
- `/wiki/api/v2/pages/{id}` - Get page details
127+
- `/wiki/api/v2/pages/{id}/body` - Get page body (use `body-format` param)
128+
- `/wiki/api/v2/pages/{id}/children` - Get child pages
129+
- `/wiki/api/v2/pages/{id}/labels` - Get page labels
130+
131+
**Comments:**
132+
- `/wiki/api/v2/pages/{id}/footer-comments` - List/add footer comments
133+
- `/wiki/api/v2/pages/{id}/inline-comments` - List/add inline comments
134+
- `/wiki/api/v2/footer-comments/{comment-id}` - Get/update/delete comment
135+
136+
**Blog Posts:**
137+
- `/wiki/api/v2/blogposts` - List blog posts
138+
- `/wiki/api/v2/blogposts/{id}` - Get blog post
139+
140+
**Search:**
141+
- `/wiki/rest/api/search` - Search content (use `cql` query param)
142+
143+
### JMESPath Filtering
144+
145+
All tools support optional JMESPath (`jq`) filtering to extract specific data:
146+
147+
```bash
148+
# Get just space names and keys
149+
npx -y @aashari/mcp-server-atlassian-confluence get \
150+
--path "/wiki/api/v2/spaces" \
151+
--jq "results[].{id: id, key: key, name: name}"
152+
153+
# Get page title and status
154+
npx -y @aashari/mcp-server-atlassian-confluence get \
155+
--path "/wiki/api/v2/pages/123456" \
156+
--jq "{id: id, title: title, status: status}"
157+
```
158+
106159
## Real-World Examples
107160

108-
### 📚 Explore Your Knowledge Base
161+
### Explore Your Knowledge Base
109162

110163
Ask your AI assistant:
111164
- *"List all the spaces in our Confluence"*
112-
- *"Show me details about the Engineering space"*
165+
- *"Show me details about the Engineering space"*
113166
- *"What pages are in our Product space?"*
114167
- *"Find the latest pages in the Marketing space"*
115168

116-
### 🔍 Search and Find Information
169+
### Search and Find Information
117170

118171
Ask your AI assistant:
119172
- *"Search for pages about API authentication"*
120173
- *"Find all documentation with 'security' in the title"*
121174
- *"Show me pages labeled with 'getting-started'"*
122175
- *"Search for content in the DEV space about deployment"*
123176

124-
### 📄 Access Specific Content
177+
### Access Specific Content
125178

126179
Ask your AI assistant:
127180
- *"Get the content of the API Authentication Guide page"*
128181
- *"Show me the onboarding checklist document"*
129182
- *"What's in our security policies page?"*
130183
- *"Display the latest release notes"*
131184

132-
### 💬 Review Discussions
185+
### Create and Update Content
133186

134187
Ask your AI assistant:
135-
- *"Show me comments on the architecture design document"*
136-
- *"What feedback was left on the new feature proposal?"*
137-
- *"Display discussion on the API changes page"*
188+
- *"Create a new page in the DEV space titled 'API Guide'"*
189+
- *"Add a comment to the architecture document"*
190+
- *"Update the page content with the new release info"*
138191

139-
### 🎯 Advanced Searches
192+
## CLI Commands
140193

141-
Ask your AI assistant:
142-
- *"Find all pages created by John in the last month"*
143-
- *"Show me archived pages in the Product space"*
144-
- *"Search for pages with both 'API' and 'tutorial' labels"*
145-
- *"Find documentation updated in the last week"*
194+
The CLI mirrors the MCP tools for direct terminal access:
195+
196+
```bash
197+
# GET request
198+
npx -y @aashari/mcp-server-atlassian-confluence get --path "/wiki/api/v2/spaces"
199+
200+
# GET with query parameters
201+
npx -y @aashari/mcp-server-atlassian-confluence get \
202+
--path "/wiki/api/v2/pages" \
203+
--query-params '{"space-id": "123456", "limit": "10"}'
204+
205+
# POST request (create a page)
206+
npx -y @aashari/mcp-server-atlassian-confluence post \
207+
--path "/wiki/api/v2/pages" \
208+
--body '{"spaceId": "123456", "status": "current", "title": "New Page", "body": {"representation": "storage", "value": "<p>Content here</p>"}}'
209+
210+
# POST request (add a comment)
211+
npx -y @aashari/mcp-server-atlassian-confluence post \
212+
--path "/wiki/api/v2/pages/789/footer-comments" \
213+
--body '{"body": {"representation": "storage", "value": "<p>My comment</p>"}}'
214+
215+
# PUT request (update page - requires version increment)
216+
npx -y @aashari/mcp-server-atlassian-confluence put \
217+
--path "/wiki/api/v2/pages/789" \
218+
--body '{"id": "789", "status": "current", "title": "Updated Title", "spaceId": "123456", "body": {"representation": "storage", "value": "<p>Updated content</p>"}, "version": {"number": 2}}'
219+
220+
# DELETE request
221+
npx -y @aashari/mcp-server-atlassian-confluence delete \
222+
--path "/wiki/api/v2/pages/789"
223+
```
146224

147225
## Troubleshooting
148226

149227
### "Authentication failed" or "403 Forbidden"
150228

151229
1. **Check your API Token permissions**:
152230
- Go to [Atlassian API Tokens](https://id.atlassian.com/manage-profile/security/api-tokens)
153-
- Make sure your token is still active and has the right permissions
231+
- Make sure your token is still active and hasn't expired
154232

155-
2. **Verify your site name**:
156-
```bash
157-
# Test your credentials work
158-
npx -y @aashari/mcp-server-atlassian-confluence ls-spaces
159-
```
160-
161-
3. **Check your site name format**:
233+
2. **Verify your site name format**:
162234
- If your Confluence URL is `https://mycompany.atlassian.net`
163235
- Your site name should be just `mycompany`
164236

165-
### "Space not found" or "Page not found"
166-
167-
1. **Check space key spelling**:
237+
3. **Test your credentials**:
168238
```bash
169-
# List your spaces to see the correct keys
170-
npx -y @aashari/mcp-server-atlassian-confluence ls-spaces
239+
npx -y @aashari/mcp-server-atlassian-confluence get --path "/wiki/api/v2/spaces?limit=1"
171240
```
172241

242+
### "Resource not found" or "404"
243+
244+
1. **Check the API path**:
245+
- Paths are case-sensitive
246+
- Use numeric IDs for spaces and pages (not keys)
247+
- Verify the resource exists in your browser
248+
173249
2. **Verify access permissions**:
174-
- Make sure you have access to the space in your browser
175-
- Some spaces may be restricted to certain users
250+
- Make sure you have access to the space/page in your browser
251+
- Some content may be restricted to certain users
176252

177253
### "No results found" when searching
178254

179-
1. **Try broader search terms**:
180-
- Use single keywords instead of full phrases
181-
- Try different variations of your search terms
255+
1. **Try different search terms**:
256+
- Use CQL syntax for advanced searches
257+
- Try broader search criteria
182258

183-
2. **Check space permissions**:
184-
- You can only search content you have permission to view
185-
- Ask your admin if you should have access to specific spaces
259+
2. **Check CQL syntax**:
260+
- Validate your CQL in Confluence's advanced search first
186261

187262
### Claude Desktop Integration Issues
188263

189264
1. **Restart Claude Desktop** after updating the config file
190-
2. **Check the status bar** for the "🔗 confluence" indicator
191-
3. **Verify config file location**:
265+
2. **Verify config file location**:
192266
- macOS: `~/.claude/claude_desktop_config.json`
193-
- Windows: `%APPDATA%\\Claude\\claude_desktop_config.json`
267+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
194268

195269
### Getting Help
196270

@@ -204,23 +278,23 @@ If you're still having issues:
204278
### What permissions do I need?
205279

206280
Your Atlassian account needs:
207-
- **Read access** to the Confluence spaces you want to search
281+
- **Access to Confluence** with the appropriate permissions for the spaces you want to query
208282
- **API token** with appropriate permissions (automatically granted when you create one)
209283

210284
### Can I use this with Confluence Server (on-premise)?
211285

212-
Currently, this tool only supports **Confluence Cloud**. Confluence Server support may be added in future versions.
286+
Currently, this tool only supports **Confluence Cloud**. Confluence Server/Data Center support may be added in future versions.
213287

214288
### How do I find my site name?
215289

216290
Your site name is the first part of your Confluence URL:
217-
- URL: `https://mycompany.atlassian.net` Site name: `mycompany`
218-
- URL: `https://acme-corp.atlassian.net` Site name: `acme-corp`
291+
- URL: `https://mycompany.atlassian.net` -> Site name: `mycompany`
292+
- URL: `https://acme-corp.atlassian.net` -> Site name: `acme-corp`
219293

220294
### What AI assistants does this work with?
221295

222296
Any AI assistant that supports the Model Context Protocol (MCP):
223-
- Claude Desktop (most popular)
297+
- Claude Desktop
224298
- Cursor AI
225299
- Continue.dev
226300
- Many others
@@ -235,7 +309,35 @@ Yes! This tool:
235309

236310
### Can I search across all my spaces at once?
237311

238-
Yes! When you don't specify a space, searches will look across all spaces you have access to.
312+
Yes! Use CQL queries for cross-space searches. For example:
313+
```bash
314+
npx -y @aashari/mcp-server-atlassian-confluence get \
315+
--path "/wiki/rest/api/search" \
316+
--query-params '{"cql": "type=page AND text~\"API documentation\""}'
317+
```
318+
319+
## Migration from v2.x
320+
321+
Version 3.0 replaces 8+ specific tools with 5 generic HTTP method tools. If you're upgrading from v2.x:
322+
323+
**Before (v2.x):**
324+
```
325+
conf_ls_spaces, conf_get_space, conf_ls_pages, conf_get_page,
326+
conf_search, conf_ls_comments, conf_add_comment, ...
327+
```
328+
329+
**After (v3.0):**
330+
```
331+
conf_get, conf_post, conf_put, conf_patch, conf_delete
332+
```
333+
334+
**Migration examples:**
335+
- `conf_ls_spaces` -> `conf_get` with path `/wiki/api/v2/spaces`
336+
- `conf_get_space` -> `conf_get` with path `/wiki/api/v2/spaces/{id}`
337+
- `conf_ls_pages` -> `conf_get` with path `/wiki/api/v2/pages?space-id={id}`
338+
- `conf_get_page` -> `conf_get` with path `/wiki/api/v2/pages/{id}`
339+
- `conf_search` -> `conf_get` with path `/wiki/rest/api/search?cql=...`
340+
- `conf_add_comment` -> `conf_post` with path `/wiki/api/v2/pages/{id}/footer-comments`
239341

240342
## Support
241343

@@ -248,4 +350,4 @@ Need help? Here's how to get assistance:
248350

249351
---
250352

251-
*Made with ❤️ for teams who want to bring AI into their knowledge management workflow.*
353+
*Made with care for teams who want to bring AI into their knowledge management workflow.*

0 commit comments

Comments
 (0)