Skip to content

feat: refactor MCP server and add install command#135

Merged
jung-thomas merged 1 commit intomainfrom
feature/mcp-server-refactor
Apr 23, 2026
Merged

feat: refactor MCP server and add install command#135
jung-thomas merged 1 commit intomainfrom
feature/mcp-server-refactor

Conversation

@jung-thomas
Copy link
Copy Markdown
Contributor

Summary

  • Modularize MCP server: Split monolithic index.ts (1,821 → ~250 lines) into 5 focused tool modules under mcp-server/src/tools/
  • Reduce tool count from ~230 to ~166 by removing aliases, consolidating search tools, and moving static content to MCP resources
  • Fix bugs: add isError: true to all error responses, fix output formatter substring matching, read version from package.json, remove no-op validateEnvironment
  • Add hana-cli mcp install command for auto-configuring MCP server in Claude Desktop, Claude Code, Cursor, VSCode, and Windsurf
  • Add hana-cli mcp-status to check MCP configuration across all supported clients
  • Add MCP Registry publishing via server.json and GitHub OIDC authentication in release workflow
  • Update documentation with three install paths (auto-configure, npx, MCP Registry) and new architecture docs

Test plan

  • cd mcp-server && npm run build compiles clean
  • node mcp-server/build/index.js starts without errors (CTRL+C to stop)
  • hana-cli mcp --dry-run --client claude-code shows config without writing
  • hana-cli mcp-status reports current MCP configuration status
  • npm test passes
  • Verify tool count in ListTools response is ~166, not 230+
  • Verify alias names (e.g. hana_s for status) still resolve when called

Major refactor of the MCP server (mcp-server/src/) and new CLI commands:

**MCP Server Modularization**
- Split monolithic index.ts (1,821 lines) into ~250-line bootstrap + 5 tool modules
- New modules: tools/types.ts, tools/discovery-tools.ts, tools/content-tools.ts,
  tools/search-tools.ts, tools/cli-tools.ts

**Tool Count Reduction (~230 → ~166)**
- Remove alias tool registrations (aliases still resolve when called)
- Consolidate search tools into single hana_search with scope parameter
- Move static knowledge tools to MCP resources
- Remove simulated workflow execution (LLMs orchestrate better)

**Bug Fixes**
- Add isError: true to all error responses (MCP protocol compliance)
- Fix output formatter fragile substring matching (Map lookup instead of includes())
- Read version from package.json instead of hardcoded '1.0.0'
- Remove no-op validateEnvironment function

**New Commands**
- hana-cli mcp (mcpServerInstall) — auto-configure MCP server in AI clients
- hana-cli mcp-status (mcpServerStatus) — check MCP configuration across clients
- Supports Claude Desktop, Claude Code, Cursor, VSCode, and Windsurf

**MCP Registry Publishing**
- Add server.json for MCP Registry discovery
- Add publish-mcp-registry job to release workflow (GitHub OIDC auth)
- Bump server.json version in prepare-release.js

**Documentation**
- Update MCP integration docs with three install paths
- Add command docs for mcp-server-install and mcp-server-status
- Update development docs to reflect new architecture
@jung-thomas jung-thomas merged commit 8e96285 into main Apr 23, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant