Skip to content

Support pluggable session types in MCP server#976

Merged
dhalperi merged 1 commit intomasterfrom
spr/master/bcfbcb1c
Apr 7, 2026
Merged

Support pluggable session types in MCP server#976
dhalperi merged 1 commit intomasterfrom
spr/master/bcfbcb1c

Conversation

@dhalperi
Copy link
Copy Markdown
Member

@dhalperi dhalperi commented Apr 7, 2026

Replace the hardcoded Session(host=host) with a named session
registry backed by Session.get(). Sessions can be configured via:

  • ~/.batfish/sessions.json config file
  • register_session MCP tool (dynamic, mid-conversation)
  • create_server(default_session=...) API (programmatic)
  • BATFISH_HOST env var (backwards-compatible default)

Every tool now accepts an optional session parameter (default:
"default") instead of host, selecting from the registry.

New tools: register_session, list_sessions.


Stack:


⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

@batfish-bot
Copy link
Copy Markdown

This change is Reviewable

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 92.40506% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.65%. Comparing base (a97d160) to head (50be8f9).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
pybatfish/mcp/__main__.py 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #976      +/-   ##
==========================================
- Coverage   87.79%   86.65%   -1.15%     
==========================================
  Files          26       26              
  Lines        3769     3806      +37     
  Branches      503      508       +5     
==========================================
- Hits         3309     3298      -11     
- Misses        330      356      +26     
- Partials      130      152      +22     
Files with missing lines Coverage Δ
pybatfish/mcp/__init__.py 100.00% <ø> (ø)
pybatfish/mcp/server.py 84.84% <100.00%> (-14.40%) ⬇️
pybatfish/mcp/__main__.py 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dhalperi dhalperi force-pushed the spr/master/bcfbcb1c branch 2 times, most recently from 40ea8db to 93847a4 Compare April 7, 2026 02:18
Replace the hardcoded Session(host=host) with a named session
registry backed by Session.get(). Sessions can be configured via:

- ~/.batfish/sessions.json config file
- register_session MCP tool (dynamic, mid-conversation)
- create_server(default_session=...) API (programmatic)
- BATFISH_HOST env var (backwards-compatible default)

Every tool now accepts an optional `session` parameter (default:
"default") instead of `host`, selecting from the registry.

New tools: register_session, list_sessions.

commit-id:bcfbcb1c
@dhalperi dhalperi force-pushed the spr/master/bcfbcb1c branch from 93847a4 to 50be8f9 Compare April 7, 2026 02:31
Copy link
Copy Markdown
Member Author

@dhalperi dhalperi left a comment

Choose a reason for hiding this comment

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

@dhalperi reviewed 4 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on dhalperi).

@dhalperi dhalperi enabled auto-merge (squash) April 7, 2026 02:33
@dhalperi dhalperi merged commit 11365f1 into master Apr 7, 2026
35 checks passed
@dhalperi dhalperi deleted the spr/master/bcfbcb1c branch April 7, 2026 02:36
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