feat: add MCP server layer for FinBot (Week 7-8)#550
Open
ashike24 wants to merge 10 commits into
Open
Conversation
- New finbot/mcp_server/ package with submit_tool_call and get_scoring_results tools, wrapping VendorChatAssistant and UserChallengeProgressRepository respectively - Auth via existing SessionManager (session_id -> SessionContext), no new auth mechanism needed - Runs as separate Docker service (mcp_server) on port 8100, sharing sqlite_data volume + Redis with the main app - Fixed pre-existing .env bug: DATABASE_URL pointed outside the mounted sqlite_data volume, causing data loss on container rebuild for both services - Verified end-to-end: get_scoring_results fully working; submit_tool_call reaches the LLM call correctly, blocked only by a missing OPENAI_API_KEY in local dev env (pre-existing gap, unrelated to this change) - start_challenge_session from original proposal wording dropped: no such concept exists in the codebase; sessions already exist via login and challenges progress implicitly
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
Adds an MCP server layer exposing FinBot as an MCP server, so it can be
used from MCP-compatible AI clients (Claude Desktop, Codex Desktop)
instead of only the browser. Per proposal section 6.4.
What's included
finbot/mcp_server/package with two tools:submit_tool_call(session_id, message)— wrapsVendorChatAssistant.stream_response()get_scoring_results(session_id)— wrapsUserChallengeProgressRepositoryrun_mcp_server.pyentry pointmcp_serverDocker service (port 8100), sharing thesqlite_datavolume and Redis with the main app
SessionManager— no new auth mechanism.MCP clients pass an existing FinBot
session_id.Deviation from proposal
start_challenge_session(mentioned in the original proposal wording)was dropped — there's no such concept in the codebase. Sessions already
exist via login, and challenge progress is tracked implicitly as the
player interacts with the agent (via the event detection pipeline).
Bug fix included
Found and fixed a pre-existing
.envissue:DATABASE_URLpointedoutside the
sqlite_datamounted volume, soapp's SQLite data wasn'tactually persisted across container rebuilds. Fixed to point inside
the volume.
Testing
get_scoring_results: verified end-to-end against a real session — works.submit_tool_call: verified it correctly resolves the session and reachesthe LLM call, but is blocked by a missing
OPENAI_API_KEYin my localdev env (pre-existing gap, unrelated to this change — the main app's
/chatendpoint would hit the same issue).will follow up if needed.
Open questions for mentor
a dedicated API token / different auth flow for MCP clients?
start_challenge_sessiondeviation above is fine.