* Introduce project_personas table with foreign keys to projects and agent_personas * Add project_skills table with foreign key to projects and agent_skills * Include override boolean field in agent_persona_skills and project_skills * Update schema and migration files to reflect new tables and fields * Enhance CORS handling to reflect request origin
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mcpserver
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -37,12 +38,14 @@ type ToolSet struct {
|
||||
Reparse *tools.ReparseMetadataTool
|
||||
RetryMetadata *tools.RetryEnrichmentTool
|
||||
//Maintenance *tools.MaintenanceTool
|
||||
Skills *tools.SkillsTool
|
||||
Personas *tools.AgentPersonasTool
|
||||
ChatHistory *tools.ChatHistoryTool
|
||||
Describe *tools.DescribeTool
|
||||
Learnings *tools.LearningsTool
|
||||
Plans *tools.PlansTool
|
||||
Skills *tools.SkillsTool
|
||||
Personas *tools.AgentPersonasTool
|
||||
ChatHistory *tools.ChatHistoryTool
|
||||
Describe *tools.DescribeTool
|
||||
Learnings *tools.LearningsTool
|
||||
Plans *tools.PlansTool
|
||||
ProjectPersonas *tools.ProjectPersonasTool
|
||||
WorldModel *tools.WorldModelTool
|
||||
}
|
||||
|
||||
// Handlers groups the HTTP handlers produced for an MCP server instance.
|
||||
@@ -86,6 +89,7 @@ func NewHandlers(cfg config.MCPConfig, logger *slog.Logger, toolSet ToolSet, onS
|
||||
registerSystemTools,
|
||||
registerThoughtTools,
|
||||
registerProjectTools,
|
||||
registerWorldModelTools,
|
||||
registerLearningTools,
|
||||
registerPlanTools,
|
||||
registerFileTools,
|
||||
@@ -123,6 +127,33 @@ func NewHandlers(cfg config.MCPConfig, logger *slog.Logger, toolSet ToolSet, onS
|
||||
return h, nil
|
||||
}
|
||||
|
||||
func registerWorldModelTools(server *mcp.Server, logger *slog.Logger, toolSet ToolSet) error {
|
||||
server.AddResource(&mcp.Resource{
|
||||
Name: "world_model_intro",
|
||||
URI: "amcs://world-model/intro",
|
||||
MIMEType: "text/markdown",
|
||||
Description: "Mandatory startup instructions for discovering and loading the AMCS world model.",
|
||||
}, func(_ context.Context, req *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error) {
|
||||
return &mcp.ReadResourceResult{Contents: []*mcp.ResourceContents{{URI: req.Params.URI, MIMEType: "text/markdown", Text: string(amcsllm.WorldModelIntro)}}}, nil
|
||||
})
|
||||
if err := addTool(server, logger, &mcp.Tool{Name: "bootstrap_world_model", Description: "Validate and activate a project, then return its effective skills, guardrails, personas, and bounded recent context."}, toolSet.WorldModel.Bootstrap); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addTool(server, logger, &mcp.Tool{Name: "add_project_persona", Description: "Link a persona to a project and optionally make it the default."}, toolSet.ProjectPersonas.Add); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addTool(server, logger, &mcp.Tool{Name: "remove_project_persona", Description: "Unlink a persona from a project."}, toolSet.ProjectPersonas.Remove); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addTool(server, logger, &mcp.Tool{Name: "set_default_project_persona", Description: "Set a linked persona as the project's default persona."}, toolSet.ProjectPersonas.SetDefault); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addTool(server, logger, &mcp.Tool{Name: "list_project_personas", Description: "List personas linked to a project, with the default marked."}, toolSet.ProjectPersonas.List); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// buildServerIcons returns icon definitions referencing the server's own /images/icon.png endpoint.
|
||||
// Returns nil when publicURL is empty so the icons field is omitted from the MCP identity.
|
||||
func buildServerIcons(publicURL string) []mcp.Icon {
|
||||
@@ -713,6 +744,11 @@ func BuildToolCatalog() []tools.ToolEntry {
|
||||
{Name: "list_projects", Description: "List projects and their current thought counts.", Category: "projects"},
|
||||
{Name: "set_active_project", Description: "Set the active project for the current MCP session. Requires a stateful MCP client that reuses the same session across calls. If your client does not preserve sessions, pass project explicitly to each tool instead.", Category: "projects"},
|
||||
{Name: "get_active_project", Description: "Return the active project for the current MCP session. If your client does not preserve MCP sessions, pass project explicitly to project-scoped tools instead of relying on this.", Category: "projects"},
|
||||
{Name: "bootstrap_world_model", Description: "Validate and activate a project, then return effective skills, guardrails, personas, and bounded recent context.", Category: "projects"},
|
||||
{Name: "add_project_persona", Description: "Link a persona to a project and optionally make it the default.", Category: "personas"},
|
||||
{Name: "remove_project_persona", Description: "Unlink a persona from a project.", Category: "personas"},
|
||||
{Name: "set_default_project_persona", Description: "Set a linked persona as the project's default persona.", Category: "personas"},
|
||||
{Name: "list_project_personas", Description: "List personas linked to a project, with the default marked.", Category: "personas"},
|
||||
{Name: "get_project_context", Description: "Get recent and semantic context for a project. Uses the explicit project when provided, otherwise the active MCP session project. Falls back to full-text search when no embeddings exist.", Category: "projects"},
|
||||
|
||||
// learnings
|
||||
|
||||
Reference in New Issue
Block a user