Skip to content

feat: add MCP server for tool-agnostic AI integration#27

Open
CoderMungan wants to merge 2 commits intoActiveMemory:mainfrom
CoderMungan:feat/mcp-server
Open

feat: add MCP server for tool-agnostic AI integration#27
CoderMungan wants to merge 2 commits intoActiveMemory:mainfrom
CoderMungan:feat/mcp-server

Conversation

@CoderMungan
Copy link

Implement Model Context Protocol (JSON-RPC 2.0 over stdin/stdout) server that exposes ctx context as MCP resources and tools.

Resources: 7 context files + assembled agent packet
Tools: ctx_status, ctx_add, ctx_complete, ctx_drift

All tools delegate to existing internal packages — no duplicated logic. Works with Claude Desktop, Cursor, VS Code Copilot, and any MCP-compatible client.

Implement Model Context Protocol (JSON-RPC 2.0 over stdin/stdout)
server that exposes ctx context as MCP resources and tools.

Resources: 7 context files + assembled agent packet
Tools: ctx_status, ctx_add, ctx_complete, ctx_drift

All tools delegate to existing internal packages — no duplicated
logic. Works with Claude Desktop, Cursor, VS Code Copilot, and
any MCP-compatible client.

Signed-off-by: CoderMungan <codermungan@gmail.com>
- errcheck: check fmt.Fprintf return values
- gosec G705: suppress false positive (stdout, not HTTP)
- staticcheck QF1012: use fmt.Fprintf instead of WriteString+Sprintf
- staticcheck S1005: remove unnecessary blank identifier

Signed-off-by: CoderMungan <codermungan@gmail.com>
@josealekhine
Copy link
Member

Thanks for your contributions @CoderMungan 🙏

This is a great proof-of-concept.

I'll come up with details.

@josealekhine
Copy link
Member

josealekhine commented Mar 6, 2026

Before I beat this to the ground here are the strength in this PR that I see:

  • Clean separation: protocol.go (types), server.go (dispatch), resources.go (read), tools.go (write) — well-organized
  • Delegates to existing internal packages (context.Load, drift.Detect, task, add.WriteEntry) instead of reimplementing logic
  • Good test coverage (337 lines) with table-driven-ish patterns and a reusable request() helper
  • Correctly uses config.FileReadOrder, config.FileType, config.RegExTask — plays by the project's rules
  • Injectable in/out on Server makes testing clean
  • Follows project conventions: copyright headers, doc.go, Godoc format, constants from config.

Expext constructive criticisim, and a hint of ctx-Manifesto-driven opinions next :D .

--

To be clear; this is the right path. I do want to land it.

I just want to land the the right way: The ctx way, if you will.

josealekhine added a commit that referenced this pull request Mar 6, 2026
Design spec for exposing ctx context over Model Context Protocol.
Covers resources, tools, prompts, behavioral discipline stack,
path-agnostic multi-project serving, and coexistence with hooks.
Includes immediate action items for PR #27 alignment.

Signed-off-by: Jose Alekhinne <jose@ctx.ist>
@josealekhine
Copy link
Member

@CoderMungan I've added some outstanding items to be done before a "minimally delightful" PR merge; and also scooped our near and mid future of the capability here: https://github.com/ActiveMemory/ctx/blob/main/specs/mcp-server.md

Thank you again for your valuable contribution 🙏 .

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.

2 participants