feat: implement MCP adapter, add mock server, and improve configs#11
Merged
Conversation
- Add open-context-mock-server for local testing - Update open-context-mcp-adapter to depend on mock server - Switch MCP adapter communication from stdin to HTTP
- Update Dockerfile - Add index.ts with core MCP server logic and API endpoints - Add mock-server.ts for testing with a mock server - Add lib/api.ts and lib/types.ts for API calls, implementing `find_knowledge` and `get_content` tools - Add tsconfig.json for TypeScript configuration - Update package.json to include TypeScript dependencies and update scripts
- Add build output and test coverage entries to '.dockerignore' - Add build output entries to '.gitignore'
- Change comments from Korean to English for consistency - Update error messages to English for better user understanding
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a comprehensive TypeScript-based MCP (Model Context Protocol) adapter to replace the basic health-check only JavaScript implementation, adding core server functionality, API integration, and testing infrastructure.
- Replaces simple health-check server with full MCP server implementation supporting both stdio and HTTP transports
- Introduces TypeScript for type safety with proper API interfaces and error handling
- Adds mock server functionality for local development and testing without requiring actual OpenContext Core server
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| mcp-adapter/tsconfig.json | Configures TypeScript compilation with ES2022 target and module resolution |
| mcp-adapter/package.json | Updates dependencies, scripts, and metadata for TypeScript-based MCP development |
| mcp-adapter/mock-server.ts | Implements comprehensive mock server with realistic API responses for testing |
| mcp-adapter/lib/types.ts | Defines TypeScript interfaces for API responses and data structures |
| mcp-adapter/lib/api.ts | Implements API client functions for find_knowledge and get_content operations |
| mcp-adapter/index.ts | Core MCP server implementation with tool registration and transport handling |
| mcp-adapter/index.js | Removes legacy JavaScript implementation |
| mcp-adapter/Dockerfile | Updates build process to support TypeScript compilation and production optimization |
| mcp-adapter/.gitignore | Adds build output directory to ignore list |
| mcp-adapter/.dockerignore | Excludes build artifacts and test coverage from Docker context |
| docker-compose.yml | Adds mock server service and updates MCP adapter configuration |
| CMD node -e "console.log('MCP Server health check passed')" || exit 1 | ||
|
|
||
| # Start MCP server | ||
| CMD ["node", "dist/index.js"] |
There was a problem hiding this comment.
The command starts index.js without the required transport arguments that are expected by the application. Based on the index.ts code, you should specify transport type, e.g., CMD ["node", "dist/index.js", "--transport", "stdio"] or use environment variables.
Suggested change
| CMD ["node", "dist/index.js"] | |
| CMD ["node", "dist/index.js", "--transport", "stdio"] |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Key Implementation Notes
mock-server.ts) to enable local environment testingindex.jsfile and updated.dockerignore&.gitignorefor build output exclusionmcp.jsonto set the MCP server URL for OpenContext:Usage
To try out the new MCP adapter and mock server, you can use the following example queries:
Major Components
MCP Adapter
index.ts: Core MCP server logic and API endpointslib/api.ts: API call implementations includingfind_knowledgeandget_contenttoolslib/types.ts: TypeScript interface definitions for API response structures and data typesMock Server
mock-server.ts: Simulates MCP server responses for testingConfigurations
tsconfig.json: TypeScript configurationpackage.json: Added TypeScript dependencies and updated scriptsCleanup
index.jsto avoid legacy conflicts.dockerignoreand.gitignore: Added entries for build outputs and test coverage