Skip to content

feat: implement MCP adapter, add mock server, and improve configs#11

Merged
kAYI0019 merged 7 commits into
developfrom
implement-mcp-adapter
Aug 11, 2025
Merged

feat: implement MCP adapter, add mock server, and improve configs#11
kAYI0019 merged 7 commits into
developfrom
implement-mcp-adapter

Conversation

@kAYI0019

Copy link
Copy Markdown
Member

Summary

  • Implement TypeScript-based MCP adapter with core server logic and API endpoints
  • Add mock server to facilitate local testing and development
  • Update build and dependency configurations to support TypeScript development
  • Clean up obsolete files and update ignore files for better project hygiene

Key Implementation Notes

  • TypeScript Adoption: Introduced TypeScript for improved type safety and maintainability
  • Build Process: Enhanced Dockerfile to include devDependencies and build steps
  • Testing: Added a mock server (mock-server.ts) to enable local environment testing
  • Project Hygiene: Removed deprecated index.js file and updated .dockerignore & .gitignore for build output exclusion
  • Internationalization: Standardized comments and error messages in English
  • Configuration Update: Added the following entry in mcp.json to set the MCP server URL for OpenContext:
"opencontext": {
  "url": "http://localhost:3000/mcp"}

Usage

To try out the new MCP adapter and mock server, you can use the following example queries:

  • Find JWT material in my materials
  • Find JWT content using opencontext
image

Major Components

MCP Adapter

  • index.ts: Core MCP server logic and API endpoints
  • lib/api.ts: API call implementations including find_knowledge and get_content tools
  • lib/types.ts: TypeScript interface definitions for API response structures and data types

Mock Server

  • mock-server.ts: Simulates MCP server responses for testing

Configurations

  • Dockerfile: Updated to handle Dependencies and build process
  • tsconfig.json: TypeScript configuration
  • package.json: Added TypeScript dependencies and updated scripts

Cleanup

  • Removed index.js to avoid legacy conflicts
  • .dockerignore and .gitignore: Added entries for build outputs and test coverage

- 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment thread mcp-adapter/tsconfig.json Outdated
Comment thread mcp-adapter/tsconfig.json Outdated
Comment thread mcp-adapter/Dockerfile
CMD node -e "console.log('MCP Server health check passed')" || exit 1

# Start MCP server
CMD ["node", "dist/index.js"]

Copilot AI Aug 11, 2025

Copy link

Choose a reason for hiding this comment

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

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"]

Copilot uses AI. Check for mistakes.
kAYI0019 and others added 2 commits August 12, 2025 08:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@kAYI0019
kAYI0019 merged commit 3e2afc8 into develop Aug 11, 2025
@Yoo-SH Yoo-SH mentioned this pull request Aug 21, 2025
53 tasks
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