refactor: Convert MCP server implementation from Python to TypeScript.

This commit is contained in:
2025-12-01 20:46:50 +01:00
parent 7d96a657b3
commit 2a6584078c
12 changed files with 1868 additions and 643 deletions
@@ -0,0 +1,13 @@
## Why
The MCP server was originally implemented in Python, but the ecosystem for MCP is stronger in TypeScript/Node.js. Converting to TypeScript allows us to leverage the official SDK more effectively and aligns with the broader MCP community.
## What Changes
- Convert `src/mcp_server.py` to `src/mcp_server.ts`
- Add `package.json` and `tsconfig.json` for Node.js/TypeScript support
- Update `README.md` with new build and run instructions
- Update `.mcp.json` to point to the new Node.js server
- Update `.gitignore` to exclude `node_modules` and `dist`
## Impact
- Affected specs: `mcp-integration`
- Affected code: `src/mcp_server.py` (removed), `src/mcp_server.ts` (added), build configuration
@@ -0,0 +1,13 @@
## MODIFIED Requirements
### Requirement: MCP Server Implementation
The system SHALL provide an MCP (Model Context Protocol) server that exposes member management functionality as standardized AI tools.
#### Scenario: MCP server starts successfully
- **GIVEN** the GraphQL API is running at http://127.0.0.1:8000/graphql
- **WHEN** the MCP server is started with `node dist/mcp_server.js` (after building)
- **THEN** the server SHALL initialize and listen for MCP protocol requests via stdio transport
#### Scenario: MCP server connects to GraphQL API
- **GIVEN** the MCP server is running
- **WHEN** an MCP tool is invoked
- **THEN** the server SHALL send GraphQL queries to the configured API endpoint via HTTP
@@ -0,0 +1,9 @@
## 1. Implementation
- [x] 1.1 Initialize Node.js project (package.json, tsconfig.json)
- [x] 1.2 Install dependencies (@modelcontextprotocol/sdk, zod, typescript)
- [x] 1.3 Implement `src/mcp_server.ts`
- [x] 1.4 Add build scripts
- [x] 1.5 Remove `src/mcp_server.py`
- [x] 1.6 Update `.mcp.json` configuration
- [x] 1.7 Update README.md instructions
- [x] 1.8 Update .gitignore
+1 -1
View File
@@ -8,7 +8,7 @@ The system SHALL provide an MCP (Model Context Protocol) server that exposes mem
#### Scenario: MCP server starts successfully
- **GIVEN** the GraphQL API is running at http://127.0.0.1:8000/graphql
- **WHEN** the MCP server is started with `python -m src.mcp_server`
- **WHEN** the MCP server is started with `node dist/mcp_server.js` (after building)
- **THEN** the server SHALL initialize and listen for MCP protocol requests via stdio transport
#### Scenario: MCP server connects to GraphQL API