Skip to content

Commit 8d9b120

Browse files
committed
feat: add MCP server mode (--mcp flag)
Claude Code Organizer is now a real MCP server. 4 tools: - scan_inventory: scan all Claude configs across scopes - move_item: move memory/skill/MCP between scopes - delete_item: delete config items - list_destinations: list available scopes Run with --mcp for AI clients (stdio), without for web dashboard. This enables Glama listing + proper MCP discovery.
1 parent 1229336 commit 8d9b120

6 files changed

Lines changed: 1260 additions & 19 deletions

File tree

.claude-plugin/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{
2+
"mcpServers": {
3+
"claude-code-organizer": {
4+
"command": "npx",
5+
"args": ["-y", "@mcpware/claude-code-organizer", "--mcp"]
6+
}
7+
},
28
"permissions": {
39
"allow": [
410
"Bash(npx @mcpware/claude-code-organizer*)"

bin/cli.mjs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
#!/usr/bin/env node
22

33
/**
4-
* cli.mjs — Entry point for Claude Inventory Manager.
5-
* Usage: node bin/cli.mjs [--port 3847]
4+
* cli.mjs — Entry point for Claude Code Organizer.
5+
* Usage:
6+
* node bin/cli.mjs → Start web dashboard (HTTP server)
7+
* node bin/cli.mjs --mcp → Start MCP server (stdio, for AI clients)
8+
* node bin/cli.mjs --port 3847 → Start web dashboard on custom port
69
*/
710

8-
import { startServer } from "../src/server.mjs";
9-
import { execSync } from "node:child_process";
10-
1111
const args = process.argv.slice(2);
12-
const portIdx = args.indexOf("--port");
13-
const port = portIdx !== -1 ? parseInt(args[portIdx + 1], 10) : 3847;
1412

15-
const server = startServer(port);
13+
if (args.includes('--mcp')) {
14+
// MCP server mode — AI clients connect via stdio
15+
await import('../src/mcp-server.mjs');
16+
} else {
17+
// Web dashboard mode — human opens browser
18+
const { startServer } = await import('../src/server.mjs');
19+
const { execSync } = await import('node:child_process');
20+
21+
const portIdx = args.indexOf('--port');
22+
const port = portIdx !== -1 ? parseInt(args[portIdx + 1], 10) : 3847;
23+
24+
startServer(port);
1625

17-
// Try to open browser
18-
try {
19-
const openCmd = process.platform === "darwin" ? "open" : "xdg-open";
20-
execSync(`${openCmd} http://localhost:${port}`, { stdio: "ignore" });
21-
} catch {
22-
// Browser didn't open, user can navigate manually
26+
try {
27+
const openCmd = process.platform === 'darwin' ? 'open' : 'xdg-open';
28+
execSync(`${openCmd} http://localhost:${port}`, { stdio: 'ignore' });
29+
} catch {
30+
// Browser didn't open, user can navigate manually
31+
}
2332
}

0 commit comments

Comments
 (0)