Skip to content

MCP server - WIP#81

Closed
socksy wants to merge 37 commits intodevelopfrom
ben/mcp
Closed

MCP server - WIP#81
socksy wants to merge 37 commits intodevelopfrom
ben/mcp

Conversation

@socksy
Copy link
Contributor

@socksy socksy commented Aug 25, 2025

No description provided.

@socksy socksy changed the base branch from main to develop August 25, 2025 15:12
@tower tower deleted a comment from github-actions bot Aug 25, 2025
socksy and others added 28 commits August 29, 2025 21:52
This is mainly for consistency with our main repo, which is using
rust-overlay over fenix
- teams
- apps deletion
- secrets
- Add new Towerfile struct serialization support with Serialize derive
- Implement save() and add_parameter() methods for Towerfile editing
- Create TowerfileGenerator for generating Towerfiles from pyproject.toml
- Add MCP tools: tower_file_read, tower_file_update, tower_file_add_parameter, tower_file_validate, tower_file_generate
- Move MCP tests inline and remove external test file
- Add dependencies: toml_edit, tempfile for enhanced TOML handling
- Use consistent early-return error handling patterns
- Remove redundant #[serde(default)] attributes on Option fields

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive BDD test suite using behave for MCP functionality
- Create mock FastAPI server for testing without real Tower API dependency
- Add GitHub Actions workflow for automated integration testing
- Implement MCPClient and MCPTestHelper for real MCP server interaction
- Support mock server configuration via TOWER_MOCK_API_URL environment variable
- Add timeout handling and proper cleanup for test scenarios
- Remove redundant comments and simplify code structure

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
cos that's what it is, innit
Also because it seems that SSE is the normal way of running MCP servers.
Will need to update docs still, and also document that you need to run
the server in the directory with the Towerfile
This was only really here because runs kept on timing out, but that
turned out to be mainly because of a bug in the code - now that's gone
we really don't need this heavy duty timing out
This makes it possible to run the tests in isolation, as changing a
global state isn't ideal when running the tests in threads (without full
process isolation)
Also, do not error out if we fail to create a second global subscriber -
in the mcp server it appears to get to that stage a second time. Ideally
we'd find out how and stop that, but for now it isn't really that
important so better to let the error get swallowed imo.
socksy and others added 7 commits August 29, 2025 21:52
turns out they're not so common after all :((
- Use toml::toml\! macro for proper TOML serialization
- Add BDD test for tower_file_generate functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Replaces complex async lifecycle management with @async_run_until_complete
decorator and pure function approach. Tests now run reliably without hanging.
Fixed 4/5 failing MCP integration tests:

- Fix template path resolution in test setup
  (tests/integration/features/steps/mcp_steps.py)
- Enhance MCP server to return TOML content in tower_file_generate
  response (crates/tower-cmd/src/mcp.rs)
- Fix TextContent attribute access in test assertions
  (tests/integration/features/steps/mcp_steps.py)
- Fix mock API to return success for duplicate app creation instead of
  409 errors (tests/mock-api-server/main.py)

Test results: 9/10 scenarios now passing (was 5/10). Core Towerfile
reading and generation functionality works correctly through MCP
interface.
When testing the MCP integration, I found it generated a pyproject.toml
file with `hatchling`, which is both not needed, and broke the project.
Since we really only need the basics for a project, `uv init` is just
fine.

We could also add a tool for this in the MCP theoretically, since we
install uv for the user and run it behind the scenes, but this is the
easier change for now (and as long as they have uv installed, which I
would guess most Python peeps these days would, it would work fine).
@socksy socksy mentioned this pull request Sep 1, 2025
@socksy socksy changed the title MCP server MCP server - WIP Sep 1, 2025
@bradhe bradhe closed this Sep 11, 2025
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