Skip to content

Add MCP server implementation for ProcessGit repositories#87

Merged
rg4444 merged 1 commit into
mainfrom
claude/add-mcp-server-support-w57ON
Feb 6, 2026
Merged

Add MCP server implementation for ProcessGit repositories#87
rg4444 merged 1 commit into
mainfrom
claude/add-mcp-server-support-w57ON

Conversation

@rg4444
Copy link
Copy Markdown
Contributor

@rg4444 rg4444 commented Feb 6, 2026

Summary

This PR introduces a complete Model Context Protocol (MCP) server implementation for ProcessGit repositories. The MCP server enables AI agents to query and interact with structured data stored in Git repositories through a standardized interface.

Key Features

  • Configuration Management (config.go): Loads and validates processgit.mcp.yaml configuration files from repository roots, supporting version 1 with XML data sources
  • XML Parsing (parser_xml.go): Parses XML files from Git commits, extracting entities based on a "code" attribute heuristic and building hierarchical relationships
  • Entity Indexing (index.go): Builds and caches entity indexes per repository+commit, supporting full-text search across entity names and attributes
  • MCP Server (server.go): Implements JSON-RPC 2.0 protocol handlers for MCP methods (initialize, tools/list, tools/call)
  • Tool Suite (8 tools):
    • help: Server capabilities and workflow guidance
    • identify: Server identity and repository metadata
    • describe_model: Data model overview with entity types and hierarchy
    • search: Full-text search across all entities
    • get_entity: Retrieve detailed information for specific entities
    • list_entities: List entities with optional type/parent filtering
    • validate: XML validation and data statistics
    • generate_document: Generate Markdown/CSV formatted output

Data Model

Entities are identified by type:code format (e.g., ministry:01, organization:0001) and support:

  • Hierarchical parent-child relationships
  • Arbitrary attributes from XML elements
  • Name resolution from both name attributes and <n> child elements
  • Type-based and parent-based indexing for efficient queries

Testing

Comprehensive test coverage includes:

  • Configuration validation (version, required fields, source types)
  • XML parsing with real-world Latvian government register structure
  • Entity extraction and hierarchy building
  • JSON-RPC request/response handling
  • Tool execution and error handling

Validation

  • Does this change affect BPMN render/diff? — No
  • Does this change require regenerating images? — No
  • Any schema/validator updates? — Yes, adds support for processgit.mcp.yaml schema validation

Testing

All new code includes unit tests:

go test ./modules/mcp/...

Tests cover:

  • Config validation with valid and invalid configurations
  • XML parsing with various entity structures
  • Entity indexing and search functionality
  • JSON-RPC protocol handling
  • All 8 tool implementations

https://claude.ai/code/session_015eAF8G3GZ6iGuwL3WznqAB

Implement a read-only MCP server that exposes structured repository data
(XML entities) via JSON-RPC 2.0 over Streamable HTTP transport. Repos
opt in by placing a processgit.mcp.yaml config file in their root.

MVP includes 8 tools: help, identify, describe_model, search, get_entity,
list_entities, validate, and generate_document. The XML parser extracts
entities using a code-attribute heuristic and builds an in-memory index
with per-commit caching.

New files:
- modules/setting/mcp.go — [mcp] app.ini settings
- modules/mcp/ — config parser, XML parser, entity index, tool registry,
  JSON-RPC dispatcher, HTTP transport, and 8 tool implementations
- routers/web/repo/mcp.go — route handler wiring MCP to repo context

Route registered at /{username}/{reponame}/mcp (POST+GET) with
reqSignIn and reqUnitCodeReader middleware.

https://claude.ai/code/session_015eAF8G3GZ6iGuwL3WznqAB
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e8378ce39

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread routers/web/web.go
Comment on lines +1195 to +1199
// MCP endpoint — Model Context Protocol server for repository
m.Group("/{username}/{reponame}/mcp", func() {
m.Post("", repo.MCPEndpoint)
m.Get("", repo.MCPEndpoint)
}, reqSignIn, context.RepoAssignment, reqUnitCodeReader)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove non-functional GET route for MCP

The router exposes GET /{user}/{repo}/mcp, but ServeHTTP only accepts POST and unconditionally returns 405 for any other method (see modules/mcp/transport.go around the method check). That means every GET to this endpoint will always fail despite being advertised, which breaks clients that try a GET-based MCP flow (e.g., streamable HTTP). Either drop the GET route here or add GET handling in the transport to avoid a guaranteed 405.

Useful? React with 👍 / 👎.

@rg4444 rg4444 merged commit aaabee2 into main Feb 6, 2026
12 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants